As do most people who have tried it, we love the Genesis WordPress framework! It is our go to framework for nearly all of our WordPress websites. Some of the features that we appreciate about Genesis are that it is streamlined, fast and highly customizable. Although, it must be noted, that it does require some coding to take advantage of all it offers. Given how much we use Genesis, I’m sure we’ll be posting lots of tips about it as they come up in our own projects.
For example, while working on recent sites during the past couple of weeks, it dawned on me that I’m consistently using a handful of code snippets on essentially every site I build, and thus thought it might be useful for new Genesis users to have these available in one place.
For folks that have worked with Genesis for sometime, this is undoubtedly old news, but many newbies may not be aware of quite how this works. To use the codes below, you’ll need to open the functions.php file of the child theme that you are using in your favorite text editor. Using them is then a simple task of adding these codes to the bottom of the file and pressing save!
The first code I’d like to share is how to remove the edit button on the front end of the site. While some may find it useful, for myself it is a distraction that I really prefer is not there. To remove that button add the following code:
//* Remove the edit link
add_filter ( 'genesis_edit_post_link' , '__return_false' );
Another code snippet I find myself using frequently allows feature images to display on single posts, which is a feature that is not enabled by default. To add this feature, simply add the following:
/* Code to Display Featured Image on top of the post */
add_action( 'genesis_before_entry', 'featured_post_image', 8 );
function featured_post_image() {
if ( ! is_singular( 'post' ) ) return;
the_post_thumbnail('post-image');
}
And last but not least, there is the all important footer customization code. It is slightly more complicated and some may find it easier to use a plug in to take care of this, but I find it nice and easy to add the following code after editing the info as desired. Don’t mess with the first through third lines or the last one, unless you know what you are doing, but line 4, the one that is in bold, is fair game after $creds=’. Make sure you keep everything inside the set of single quotes.
//* Change the footer text
add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter');
function sp_footer_creds_filter( $creds ) {
$creds = '© 2023 · My Custom Link · Built on the Genesis Framework';
return $creds;
}
There are many other code snippets that make customizing the Genesis framework a real breeze, which we’ll be sure to share in future posts. But for now, these are three of the most common I find myself using personally.
One last note, some of you may be inclined to leave out the the comment that precedes the actual code in the snippets. Don’t do it! One of the reasons Genesis is easy to customize is because everything is well-commented. By removing the comments for the code snippets you make life much harder for your future self and all those that have to deal with your code one day.
If you have some favorite Genesis code snippets, please feel free to share them in the comments below!
Leave a Reply