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 | |
/** | |
* Widget Shortcode | |
* - allows you to insert a widget into any content area using a shortcode | |
* - credit: http://wp.smashingmagazine.com/2012/12/11/inserting-widgets-with-shortcodes/ | |
* - read the comments on the Smashing Magazine article for pros and cons of this function | |
*/ | |
add_shortcode( 'mcw_widget', function ( $atts ) { | |
// configure defaults and extract the attributes into variables | |
extract( shortcode_atts( |
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 | |
/** | |
* Custom Image Sizes | |
* - adds all custom image sizes to the list of choices in Insert Media | |
*/ | |
add_filter( 'image_size_names_choose', function ( $sizes ) { | |
global $_wp_additional_image_sizes; | |
if ( !empty( $_wp_additional_image_sizes ) ) { | |
foreach ( $_wp_additional_image_sizes as $id => $data ) { | |
if ( !isset( $sizes[$id] ) ) |
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 | |
/** | |
* Reduce the font sizes in the WordPress tag cloud | |
*/ | |
add_filter( 'widget_tag_cloud_args', function( $args ) { | |
$args['smallest'] = 11; | |
$args['largest'] = 24; | |
$args['unit'] = 'px'; | |
return $args; | |
}); |
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 | |
/** | |
* Adds the post type and slug to the <body> class, e.g., "page-about". | |
*/ | |
add_filter( 'body_class', function( $classes ) { | |
global $post; | |
if ( isset( $post ) ) { | |
$classes[]= "{$post->post_type}-{$post->post_name}"; |
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 Title Field | |
* - adds image caption to image tags; will show up as gallery captions | |
* - this example uses image caption if defined, with fallback to post title | |
* - edit as desired to choose post title, description, or caption (excerpt) | |
*/ | |
add_filter( 'wp_get_attachment_link', function( $anchor, $id ) { | |
$_post = get_post( $id ); | |
if ( !$_post ) { |
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 | |
/** | |
* This code went into the file in piklist/parts/metaboxes | |
*/ | |
/* | |
Title: Section Name | |
Post Type: page | |
Top pages only: true | |
*/ |
NewerOlder