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
View footer-text.php
@topleague
topleague / customize-entry-meta.php
Created June 8, 2017 09:44
Customize Entry Meta (Filed Under and Tagged Under)
View customize-entry-meta.php
// 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 / 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
View edit-post-info.php
// 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 / relative-date.php
Created June 9, 2017 09:05
Apply Relative Date Lengths in Genesis
View relative-date.php
// 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
View post-views.php
// 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
View enews-footerwidget.css
/* 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
View post-word-count.php
// 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 / trackbacks-headlines.php
Created June 28, 2017 06:57
Modify Trackbacks Headline text in Genesis
View trackbacks-headlines.php
//* Modify trackbacks title in comments
add_filter( 'genesis_title_pings', 'topleague_title_pings' );
function topleague_title_pings() {
echo '<h3>Trackbacks</h3>';
}
@topleague
topleague / comment-policy.php
Created June 28, 2017 07:10
Add A Comment Policy Box in Genesis
View comment-policy.php
//* Add a comment policy box in comments
add_action( 'genesis_after_comments', 'topleague_comment_policy' );
function topleague_comment_policy() {
if ( is_single() && !is_user_logged_in() && comments_open() ) {
?>
<div class="comment-policy-box">
<p class="comment-policy"><small><strong>Comment Policy:</strong>Zero tolerance for spammy comments.</small></p>
</div>
<?php
}
@topleague
topleague / leave-a-reply.php
Created June 28, 2017 07:19
Modify Leave a Reply in Genesis
View leave-a-reply.php
//* Modify the 'Leave a Reply' title in comments
add_filter( 'comment_form_defaults', 'topleague_comment_form_defaults' );
function topleague_comment_form_defaults( $defaults ) {
$defaults['title_reply'] = __( 'Share Your Thoughts' );
return $defaults;
}