Skip to content

Instantly share code, notes, and snippets.

@topleague
topleague / footer-text.php
Created June 8, 2017 09:05
Customize the Footer Text in Genesis Sample Theme
@topleague
topleague / edit-post-info.php
Last active June 8, 2017 09:57
Customize the Post Info Conditionally on Home Page and Single Post in Genesis Sample Theme
// Customize the Post Info Conditionally on Home Page and Single Post in Genesis Sample Theme
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter( $post_info ) {
if ( is_front_page() || is_archive() ) :
$post_info = '[post_date] [post_comments zero="0 Comments" one="1 Comment" more="% Comments"]';
return $post_info;
@topleague
topleague / featured-image.php
Last active December 3, 2019 07:11
Relocate Featured Image to the Top of Post in Genesis Sample Theme
@topleague
topleague / blog-template.php
Last active October 23, 2017 06:09
Remove Title and Description on Blog Template Page
// Removes Title and Description on Blog Archive and Category Archive
remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' );
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
@topleague
topleague / customize-entry-meta.php
Created June 8, 2017 09:44
Customize Entry Meta (Filed Under and Tagged Under)
// Customize Entry Meta Filed Under and Tagged Under
add_filter( 'genesis_post_meta', 'sleek_pro_meta_footer' );
function sleek_pro_meta_footer( $post_meta ) {
$post_meta = '[post_categories before=""] [post_tags before=""]';
return $post_meta;
}
@topleague
topleague / relative-date.php
Created June 9, 2017 09:05
Apply Relative Date Lengths in Genesis
// Apply Relative Date Lengths in Genesis
// (credit: http://www.billerickson.net/genesis-relative-date-length/)
add_filter( 'genesis_post_info', 'sp_post_info_filter' );
function sp_post_info_filter($post_info) {
if ( !is_page() ) {
$post_info = '<i class="fa fa-clock-o"></i> [post_date format="relative" relative_depth="1"] <i class="fa fa-eye"></i> [postview] [post_comments zero="0 Comments" one="1 Comment" more="% Comments"]';
return $post_info;
}}
@topleague
topleague / post-views.php
Last active June 9, 2017 09:09
Add Post Views on Genesis Framework
// Add Post Views on Genesis Framework | Credit: http://www.joemaraparecio.com/how-to-add-post-views-in-genesis/
// Set Post Views :It counts everytime single posts is viewed
if ( !function_exists( 'ja_setPostViews' ) ){
function ja_setPostViews( $postID ){
$count_key = 'ja_post_views';
$count = get_post_meta($postID, $count_key, true);
if( $count == '' ){
$count = 0;
@topleague
topleague / enews-footerwidget.css
Last active June 12, 2017 09:46
How to Design Newsletters Opt-in Form in Footer Widget in Genesis
/* Single Column Footer Widget + Newsletter Design */
.footer-widgets-1 {
width: 100%;
}
.enews-widget input {
font-size: 17px;
margin-bottom: 12px;
width: 400px;
@topleague
topleague / post-word-count.php
Last active June 14, 2017 11:41
Display Word Count in Post Info in Genesis
// Display Post Word Count in Genesis
// Note: Special Thanks to Victor Front: Ref: https://www.facebook.com/groups/genesiswp/permalink/1536463436404848/
// And Sridhar: https://sridharkatakam.com/display-word-count-posts-genesis/
// Print Post Word Count and Create a Shortcode
add_shortcode( 'word-count', 'post_word_count' );
function post_word_count() {
return sprintf( __( '%s Words', 'leaguewp' ), str_word_count( strip_tags( get_post_field( 'post_content', get_the_ID() ) ), 0 ) );
}
@topleague
topleague / author-says.php
Last active June 28, 2017 09:09
Modify Author Says in Genesis
//* Modify the author says text in comments
add_filter( 'comment_author_says_text', 'topleague_comment_author_says_text' );
function topleague_comment_author_says_text() {
return 'writes'; // if you want to remove the text, simply keep it ''
}