Skip to content

Instantly share code, notes, and snippets.

@danielbachhuber
danielbachhuber / gist:9508957
Created March 12, 2014 15:13
Helpful P2 comment settings
<?php
/**
* Permit anyone to post HTML in the comments
* Because ThunderP2 is only accessible by qualified users,
* this is just fine.
*/
add_action( 'init', function() {
remove_filter( 'pre_comment_content', 'wp_filter_kses' );
add_filter( 'pre_comment_content', 'wp_filter_post_kses' );
@nacin
nacin / london-contribute.md
Created November 24, 2013 12:40
WordCamp London 2013 Contributor Day Notes from the introduction to contributing to core.
@robneu
robneu / wordpress-widgeted-page-template-helper.php
Last active December 22, 2015 14:09
Sometimes you might want to create a custom page template that is built entirely using widgets. This can give your content a lot of flexibility for the end user; however, it could also be confusing. If you're not using the standard WordPress editor at all in your template, you should disable it and explain why it has been removed. This code will…
<?php
/**
* If your theme or plugin has a page template that
* uses widgets to build the layout, users might be
* confused as to why the standard editor doesn't
* work as expected. This will disable the editor
* and introduce a notice explaining its absence.
*
* @author FAT Media <http://youneedfat.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
@stephenharris
stephenharris / bbpress-kses.php
Last active February 3, 2020 08:44
By default bbpress can be quite strict on the HTML it allows in posts (tags are whitelisted). The following loosens those restrictions and is taken from this post: http://buddypress.org/support/topic/tutorial-allow-more-html-tags-in-bp-forum-topics/
<?php
function myprefix_kses_allowed_tags($input){
return array_merge( $input, array(
// paragraphs
'p' => array(
'style' => array()
),
'span' => array(
'style' => array()
),

Build your own private, encrypted, open-source Dropbox-esque sync folder

Prerequisites:

  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption
@norcross
norcross / no-comment-notes.php
Created July 19, 2013 16:41
remove comment notes field
<?php
function no_comment_notes($fields) {
$fields['comment_notes_after'] = '';
return $fields;
}
add_filter('comment_form_defaults', 'no_comment_notes');
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
@rfmeier
rfmeier / functions.php
Last active October 29, 2018 14:36
Add custom nav item to Genesis primary menu
<?php
//* do no include php tags
add_filter( 'wp_nav_menu_items', 'custom_nav_item', 10, 2 );
/**
* Callback for Genesis 'wp_nav_menu_items' filter.
*
* Add custom right nav item to Genesis primary menu.
*
* @package Genesis
@jdevalk
jdevalk / archive-speaking_event.php
Last active December 12, 2021 20:13
Genesis helper code for schema
<?php
add_filter( 'genesis_attr_content', 'yoast_schema_empty', 20 );
add_filter( 'genesis_attr_entry', 'yoast_schema_event', 20 );
add_filter( 'genesis_attr_entry-title', 'yoast_itemprop_name', 20 );
add_filter( 'genesis_attr_entry-content', 'yoast_itemprop_description', 20 );
add_filter( 'genesis_post_title_output', 'yoast_title_link_schema', 20 );
/**
* We'll use the post info output to add more meta data about the event.

Installation

To install, you need to have the WordPress i18n library on your computer. Check it out using SVN:

sudo svn co http://i18n.svn.wordpress.org/tools/trunk/ /usr/lib/wpi18n

You don't have to put the library in /usr/lib/wpi18n, but if you don't put it there, make sure to set the $WP_I18N_LIB environment variable in your .bashrc or .bash_profile file (with no trailing slash):

export WP_I18N_LIB="/path/to/i18n/lib"