Customizing the blog previews and posts page of a Genesis child theme

These are specific for the Genesis Framework – StudioPress Themes for WordPress.

Add PHP code to the child theme functions.php file or a code snippet plugin.

Change the [Read more…] text to something else.

Go to Genesis -> Theme Settings -> Content Archives. Adjust Display to show Entry content and limit content to a certain amount of characters. If there is more content a Read more link will show on the post preview page.

read more

// 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>';
}

Adjusting the post meta seen in the post header.

Adjustments are seen in the post preview and posts page.
Post date, post author posts link and post comments button.

post meta entry header text comments button

// Adjust post meta in entry header AND change comments text in comments button
// http://wpspeak.com/remove-post-date-in-genesis-framework/
//
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter($post_info) {
 $post_info = '8 January - 2016 By Paal Joachim "Add (Edit)';
 return $post_info;
}

Adjusting the FILED UNDER: -category- and Tagged: -tags- meta tag.

The meta is located below the post content preview and on the posts page.
I changed the words FILED UNDER -> Categories
Changed the word Tagged -> Keywords

categories

// 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 = '"Categories:Genesis, Themes, WordPress "Keywords:Code Snippets';
return $post_meta;
}}

Add a “Last updated” and date

I find it useful to have an updated post date below the original date. As it clearly shows when I lasted updated the post article. One can see the last updated date in the post preview and posts page.

Last updated date

// 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;
}

Order by comments made – can also be used outside of Genesis themes.

On your blog or home page order post previews by most comments.

show most comments first

// 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' );
 }
}

The CSS I used for the comment button.

/* Comment button - top right */
.content .entry-meta .entry-comments-link a {
 background-color: #a36104;
 border-radius: 10px;
 color: #fff;
 padding: 8px 8px;
 text-transform: none;
 letter-spacing: 1.3px;
}
.content .entry-meta .entry-comments-link a:hover {
 background-color: #a36104;
 color: #f89a16;
}

Hide post or page titles

CSS:

To hide the titles of posts or pages:
/* Post entry titles */
.entry-title {
 display: none;
}

remove post and page titles

//* 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' );
 }
}
Share the article:

Leave a Reply

Your email address will not be published. Required fields are marked *

5 × five =