Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active April 17, 2016 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srikat/c219599ba52cf0a0a77c8f9850294078 to your computer and use it in GitHub Desktop.
Save srikat/c219599ba52cf0a0a77c8f9850294078 to your computer and use it in GitHub Desktop.
How to add Favorites feature in Genesis. https://sridharkatakam.com/add-favorites-feature-genesis/
// Customize entry meta in the entry header to show Favorite button for logged in users and Favorites count for non logged in users
add_filter( 'genesis_post_info', 'sk_post_info_filter' );
function sk_post_info_filter( $post_info ) {
if ( is_user_logged_in() ) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit] [favorite_button]';
} else {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit] <span class="favorite-count">Favorited: [favorite_count] times</a>';
}
return $post_info;
}
.entry-meta .simplefavorite-button {
float: right;
padding: 0;
background-color: transparent;
color: #333;
text-transform: none;
}
.favorite-count {
float: right;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment