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 | |
/** | |
* Check if a meta box has been registered. | |
* Returns true if the supplied meta box id has been registered. false if not. | |
* Note that this does not check what page type | |
* @param String $meta_box_id An id for the meta box. | |
* @param String $post_type The post type the box is registered to (optional) | |
* @return mixed Returns boolean or a WP_Error if $wp_meta_boxes is not yet set. | |
*/ |
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 | |
/* ------------------------------------------------------------------------------ | |
* FILTER JETPACK OPEN GRAPH TAGS ADDITIONAL TWITTER CARD SUPPORT, FACEBOOK PUBLISHER, AND OG:META FIXES | |
* For the WordPress VIP environment. | |
* @see https://dev.twitter.com/docs/cards | |
* @see https://developers.facebook.com/blog/post/2013/06/19/platform-updates--new-open-graph-tags-for-media-publishers-and-more/ | |
* ---------------------------------------------------------------------------- */ | |
add_filter( 'jetpack_open_graph_tags', function( $tags ){ |
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 coauthors_feed() { | |
$authors = get_coauthors_feed(); // array of creator nodes, one for each author | |
echo wp_sprintf( '%l', $authors ); | |
} | |
// uses dublin core specification for creator, so please specify dc namespace. | |
function get_coauthors_feed(){ | |
$output = array(); |
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 | |
/** | |
* Force the unregistering of SailThru widgets and dequeue unused scripts and styles. | |
* If you don't have the SailThru widget on your site the plugin should not load the widget's styes and scripts. | |
* @todo the SailThru plugin should be improved to only enqueue when widgets are active | |
* I've submitted the fix patch: https://github.com/sailthru/sailthru-wordpress-plugin/pull/21 | |
* Only use this hack if you never intend to use the SailThru widget, as it will break the Sailthru widget if you choose to activate it. | |
*/ | |
add_action( 'widgets_init', function(){ | |
unregister_widget( 'Sailthru_Subscribe_Widget' ); |
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
/** | |
* Tracking contnet reading with Google Analytics | |
* | |
* Requires jQuery and Underscores. | |
* Assumes Univerals Google Analytics object is available. | |
* 1) wrap your tracked content ( post body ) with div#content_tracking_start and div#content_tracking_end | |
* 2) Load this script in your footer after jQuery,Underscores, and GA. | |
* | |
* A) When the content is scrolled into the viewport we send off an event with the number of seconds between the start of the page and appearance of the content | |
* B) When the bottom of the content is scrolled into viewport we send off an event with nubmer of active seconds from the start of content and end of content. |
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 support for serial commas to Co-Authors Plus WordPress plugin. | |
* Filters coauthors_default_between_last to support serial commas (oxford comma) for 3 or more coauthors | |
*/ | |
add_filter( 'coauthors_default_between_last', function( $between_last ) { | |
if ( ' and ' === $between_last && count( get_coauthors() ) > 2 ) { | |
$between_last = ', and '; | |
} |