This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'rewrite' => true | |
'public' => true 'publicly_queryable' => true /cpt-slug/cpt-post-slug Loads fine | |
'public' => false 'publicly_queryable' => true /cpt-slug/cpt-post-slug Loads fine | |
'public' => true 'publicly_queryable' => false /cpt-slug/cpt-post-slug 404 Error | |
'public' => false 'publicly_queryable' => true /cpt-slug-cpt-post-slug 404 Error | |
'rewrite' => false | |
'public' => true 'publicly_queryable' => true /?cpt-slug=cpt-post-slug Loads fine | |
'public' => true 'publicly_queryable' => true /?p=ID&post_type=cpt-slug Loads fine | |
'public' => false 'publicly_queryable' => true /?cpt-slug=cpt-post-slug Loads fine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* A brief overview of filters that are now available in Youtube Favorite Video Posts. | |
* | |
* These allow easy overriding of the default post title and content before the | |
* new post is created. | |
*/ | |
add_filter( 'yfvp_new_video_embed_code', 'myprefix_change_yfvp_post_content', 10, 1 ); | |
/* Adds a little nonsense introduction to the video before embedding the | |
* iframe that was provided by default */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'acm_register_provider_slug', 'unisport_register_acm_provider_slug' ); | |
function unisport_register_acm_provider_slug( $current_providers ) { | |
$current_providers->unisport_doubleclick = array( | |
'provider' => 'Unisport_Doubleclick_ACM_Provider', | |
'table' => 'Unisport_Doubleclick_ACM_WP_List_Table' ); | |
return $current_providers; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pre_get_posts', 'my_alter_home_posts' ); | |
function my_alter_home_posts( $query ) { | |
if ( $query->is_home() && $query->is_main_query() ) | |
$query->set( 'posts_per_page', 3 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repo_to_repo() { | |
local DEVENV="/directory/to/where/both/repos/are/stored/" | |
rsync -rv --delete --exclude='.svn' $DEVENV$1/* $DEVENV$2 | |
cd $DEVENV$2 | |
svn status | grep '^!' | awk '{print $2}' | xargs svn rm | |
svn status | grep '^?' | awk '{print $2}' | xargs svn add | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$category_ids = wp_get_object_terms( get_the_ID(), 'category', array( 'fields' => 'ids' ) ); | |
$post_tag_ids = wp_get_object_terms( get_the_ID(), 'post_tag', array( 'fields' => 'ids' ) ); | |
$related_query = new WP_Query( array( | |
'posts_per_page' => 3, | |
'post__not_in' => array( get_the_ID() ), | |
'orderby' => 'rand', | |
'no_found_rows' => true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
js_lint_check() { | |
local DEVENV=$PWD | |
local YUICOM="/path/to/yuicompressor/jar/" | |
cd $YUICOM | |
java -jar yuicompressor-2.4.7.jar -v $DEVENV/$1 -o $DEVENV/$2 | |
cd $DEVENV | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'wp_nav_menu_objects', 'edit_nav_main_objects', 10, 2 ); | |
/** | |
* Parse nav menu items and add a current-menu-item class to the first menu item | |
* in in the menu if no current-menu-item currently exists. | |
* | |
* @param $current_menu_items array of objects containing menu items | |
* @param $current_menu object containing menu information | |
* | |
* @return mixed array of objects containing menu items | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Basic configuration for multiple DFP JS ad tags in Ad Code Manager | |
* | |
* Our ad units are named 'test_ad_300x250' and 'test_ad_728x90' | |
* Our DFP ID is 12345678 | |
* Our ad slot IDs will be automatically created | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_function_that_grabs_the_feed() { | |
add_filter( 'wp_feed_cache_transient_lifetime', 'modify_feed_cache' ); | |
$my_feed = fetch_feed( esc_url( $feed_url ) ); | |
remove_filter( 'wp_feed_cache_transient_lifetime', 'modify_feed_cache' ); | |
} |