Last active
April 17, 2016 13:07
-
-
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/
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 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; | |
} |
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
.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