Skip to content

Instantly share code, notes, and snippets.

View remkus's full-sized avatar

Remkus de Vries remkus

View GitHub Profile
define( 'CHILD_THEME_VERSION', filemtime( get_stylesheet_directory() . '/style.css' ) );
@boonebgorges
boonebgorges / gist:4754549
Created February 11, 2013 13:57
Dynamically add items to a wp_nav_menu list
<?php
function bbg_activity_subnav( $items, $menu, $args ) {
// Find the Activity item
$bp_pages = bp_core_get_directory_page_ids();
if ( isset( $bp_pages['activity'] ) ) {
$activity_directory_page = $bp_pages['activity'];
} else {
return $items;
<?php
/*
Plugin Name: Memcached Redux
Description: The real Memcached (not Memcache) backend for the WP Object Cache.
Version: 3.0
Plugin URI: http://wordpress.org/extend/plugins/memcached/
Author: Scott Taylor - uses code from Ryan Boren, Denis de Bernardy, Matt Martz
Install this file to wp-content/object-cache.php
*/
@billerickson
billerickson / functions.php
Created February 20, 2013 17:14
List the 5 most popular posts tagged "basic".
<?php
echo '<h4>Popular Basic Posts</h4>';
$args = array(
'posts_per_page' => 5,
'orderby' => 'meta_value_num',
'meta_key' => 'be_stats',
'order' => 'ASC',
'tag' => 'basic',
);
@pdewouters
pdewouters / gist:5000490
Last active December 14, 2015 00:39
Require Genesis for plugin activation
/**
* Method that runs only when the plugin is activated.
* @since 0.1.0
* @return void
*/
public function activation( $network_wide ) {
if ( $this->is_genesis_active() && $this->is_genesis_version_compatible() ) {
// do activation stuff
}
<?php
add_action( 'genesis_before_post', 'dc_blah_feat' );
/**
* Echo parent page post thumbnail for a page.
*/
function dc_blah_feat () {
if ( is_page() )
echo prefix_get_page_parent_featured_image();
}
@tomjn
tomjn / auditor-twitter-followers.php
Last active December 16, 2015 22:49
A plugin that extends the auditor to track who in the Interconnect/IT offices has the most twitter users
<?php
/*
Plugin Name: Twitter Follower Audit Tracker
Plugin URI: http://interconnectit.com/products/the-auditor/
Description: Uses the auditor to track twitter follower counts, requires v1.63+
Author: Tom J Nowell, interconnect/it
Version: 1.1
Author URI: http://interconnectit.com
*/

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"

@jdevalk
jdevalk / archive-speaking_event.php
Last active July 2, 2025 13:58
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.
@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