3 Great Uses for Genesis Simple Hooks Plugin

If you’ve poked around my site at all, it’s no secret: I’m a big fan of the Genesis Framework for WordPress. After getting a fresh install up and running, one of the first plugins I download is Genesis Simple Hooks, which is, as the name suggests, an easy way to tap into the Genesis Framework and modify the output with your own bits of code.

Now, some of what you could accomplish with Simple Hooks could also just be written into your functions.php file, but here’s why I prefer Simple Hooks: Miss one single quote or semi-colon in functions.php and you can kill your entire site. You’ll have to re-upload a fresh copy of functions.php via FTP to restore your site to its buttery goodness. Simple Hooks, on the other hand, is a little more forgiving. A syntax error in your code can result in an ugly error, but it won’t sink the ship.

Of course, there are instances when it’s better to use functions.php (like writing actual functions!), but that’s not the main focus of this post. So getting back to the topic at hand – What are some easy things you can do with Simple Hooks?

**Disclaimer** I’m no code pro. Everything I’ve learned about Genesis and WordPress has been the result of bootstrapping my way around the web and support forums. Below are examples that have worked for me, but I would welcome the input of more advanced developers to suggest more elegant ways of doing things!

3 Things you can do with Genesis Simple Hooks

Number 1: Install Google Analytics.

Of course there are plugins out there that do this for you, but it’s such a simple snippet of code, why use one more plugin when you can simplify?

From your WordPress Admin dashboard go to Genesis > Simple Hooks and use a quick Ctrl + F to search for the genesis_after hook, located in the Document Hooks section.

Genesis Simple Hooks - Document Hooks

Anything you put in this section will execute on the page immediately before the closing </body> tag, which is where I like to stash my Google Analytics. Drop in the script provided from your Google Analytics account and click Save Changes. Voila! Tracking is installed throughout your site!

Number 2: Place an ad after the first post on your blog archive page.

Oh how I love conditional statements! WordPress is chalk full of built-in functional references that you can use to know “where” you are in the code. Am I on a page? Do this! Am I on a post? Do that!

You can use Simple Hooks to insert these little “where am I” checks into The Loop and modify your output accordingly. For instance, let’s say you want to show a single ad only after your first post on an archive page.

Get back into your Simple Hooks settings and do a search for genesis_after_post_content. It’s in the Post/Page Hooks section.

Post Meta Hook - Genesis Simple Hooks

What we’re doing here is using a conditional statement to check two things:

  1. We’re on the first post in the loop ($wp_query->current_post == 0) and (&&)
  2. We’re on an archive page (is_archive)

If both those statements ring true, we want to show our ad, which I’ve wrapped in it’s on CSS class so we can style. Note that I’ve checked Execute PHP since I’m including PHP code. Here’s the code in the screenshot above in case you’d like to use it:

global $wp_query;
if( ($wp_query->current_post == 0) && is_archive() ) {
// insert your ad code here

Number 3: Use a Custom Field in the Post Info.

Let’s say you’re a travel blogger and like to include a custom field called “Location” in each of your posts. (psst…Here’s a quick “how-to” for creating custom fields)

Custom Field

In this example, we’ll go ahead and add a function to functions.php to let us grab the Location whenever we want. Here’s the code for that.

function getLocation($thePostID) {

	$custom_fields = get_post_custom($thePostID); 

	if (array_key_exists("Location",$custom_fields)) {
		$locale = $custom_fields['Location'][0];
	else {
		$locale = "Nowhere";
	return $locale;

Next, let’s head over to our Genesis Simple Hooks settings and find the genesis_before_post_content hook in the Post/Page Hooks section.

Let’s unhook genesis_post_info() since we don’t want any of the default post info to print. Also, we’re only using our custom Location field on posts, not pages, so we’ll use a conditional statement to figure out where we are.

<?php if (!is_page()) {  //Use a core WP function to Make sure it's NOT a page
   $thePostID = get_the_ID(); // core WP function used within the Loop to grab a post ID
   echo getLocation($thePostID) ." - ". the_date(); // pass the post ID to our getLocation function, add the date, and print!

Lastly, don’t forget to check the Execute PHP  box since we’re including PHP in our hook! Voila! Now our location and date will print on single post pages, between the title and the content.


Alright, so there’s a few ways you can use Genesis Simple Hooks to customize your website. Don’t forget to check the plugin forum or the StudioPress forums and search for other ways you can use Simple Hooks. Have a question or want to suggest a better way to accomplish the above examples? Leave a comment!

86 thoughts on “3 Great Uses for Genesis Simple Hooks Plugin”

  1. I’m using Simple Hooks to insert a Google AdSense ad using the genesis_before_entry hook.

    I want the ad to appear only on posts and not on pages. What php would I wrap around my AdSense block?

  2. Hi Carrie –

    That’s what I was trying to get, the conditional statement. It turns out, this is what I needed:

    [stuff I want everywhere but on pages]

  3. Thanks for this, Carrie! I was looking for how to add conditional tags when using Genesis Simple Hooks

    Also, your course on LinkedIn Learning “WordPress Themes: Customizing Themes with Genesis” has seriously helped me!

Leave a Comment

Your email address will not be published. Required fields are marked *

Carrie Dils uses Accessibility Checker to monitor our website's accessibility.