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 old_post_message( $content ) { | |
if ( get_the_time( 'U' ) < strtotime( '1st January 2013' ) ) { | |
$content = '<div class="alert alert-info alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>Due to updates, over time, that have been made to the site and the age of this article, this post may not display correctly. In particular images may be missing or product reviews display incorrectly.</div>' . $content; | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'old_post_message' ); | |
?> |
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 single_result() { | |
if ( is_search() ) { | |
global $wp_query; | |
if ( $wp_query -> post_count == 1 && $wp_query -> max_num_pages == 1 ) { | |
wp_redirect( get_permalink( $wp_query -> posts[ 0 ] -> ID ) ); | |
exit; | |
} | |
} | |
} |
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 new_avatar( $avatar_defaults ) { | |
$new_avatar = content_url() . '/uploads/[your image]'; | |
$avatar_defaults[ $new_avatar ] = 'No Avatar'; | |
return $avatar_defaults; | |
} | |
add_filter( 'avatar_defaults', 'new_avatar' ); | |
?> |
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( 'the_content_rss', 'do_shortcode' ); | |
?> |
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 site_version_removal() { return ''; } | |
add_filter( 'the_generator', 'site_version_removal' ); | |
?> |
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 time_to_read( $content = false ) { | |
if ( is_single () ) { | |
// If content has not been passed in (via the filter), fetch it | |
if ( !$content ) { $content = get_the_content(); $add = false; } else { $add = true; } | |
// Get the cache, if the content was not provided and this is not a preview |
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 no_self_pings( $links ) { | |
foreach ( $links as $loop => $link ) { | |
if ( 0 === strpos( $link, get_option( 'home' ) ) ) { unset( $links[ $loop ] ); } | |
} | |
} | |
add_action( 'pre_ping', 'no_self_pings' ); | |
?> |
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 | |
// Shortcodes to list all available shortcodes | |
function list_shortcodes() { | |
// Grab the global array of shortcodes | |
global $shortcode_tags; | |
// Sort the shortcodes into alphabetical order |
NewerOlder