Last active
February 13, 2016 15:45
-
-
Save paaljoachim/3e68c7c09340f7c4b596 to your computer and use it in GitHub Desktop.
Post preview and posts - Genesis code snippets
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
// Customize the post meta "FILED UNDER: -category name-" categories text and below the post preview in a blog page and change it at the bottom of a post. | |
// http://wordpress.stackexchange.com/questions/50961/removing-post-meta-from-category-pages */ | |
// | |
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' ); | |
function sp_post_meta_filter($post_meta) { | |
if ( !is_page() ) { | |
if (is_archive() ) $post_meta = ''; | |
else $post_meta = '[post_categories before="Categories: "] [post_tags before="Keywords: "]'; | |
return $post_meta; | |
}} |
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
// A last updated date seen below the original post date. | |
// | |
add_filter( 'genesis_post_info', 'sk_post_info_filter' ); | |
function sk_post_info_filter($post_info) { | |
if (get_the_modified_time() != get_the_time()) { | |
$post_info = $post_info . '<br/>Last updated on: ' . the_modified_date('j F, Y', '', '', false); | |
} | |
return $post_info; | |
} |
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
// Modify the Genesis content limit read more link - Genesis Settings page - Display post content certain amount of characters. I selected 175. | |
// | |
add_filter( 'get_the_content_more_link', 'sp_read_more_link' ); | |
function sp_read_more_link() { | |
return '... <a class="more-link" href="' . get_permalink() . '">[Continue reading..]</a>'; | |
} |
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
// On your blog or home page show Post with most comments first. | |
// http://wpsites.net/wordpress-tips/show-posts-with-most-comments-first-on-your-home-page/ | |
// | |
add_action( 'pre_get_posts', 'wpsites_show_posts_most_comments_first' ); | |
function wpsites_show_posts_most_comments_first( $query ) { | |
if ( $query->is_home() && $query->is_main_query() && !is_admin() ) { | |
$query->set( 'orderby', 'comment_count' ); | |
} | |
} |
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
//* Remove page titles from all single posts & pages (requires HTML5 theme support) | |
add_action( 'get_header', 'child_remove_titles' ); | |
function child_remove_titles() { | |
if ( is_singular() ){ | |
remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment