Never miss a thing!

Sign up to have the latest news and announcements from my site delivered straight to your inbox.
  • This field is for validation purposes and should be left unchanged.

Reader Interactions


  1. Carrie,

    Great article. There are some cool features in Genesis that can simplify your code. For example, when working with custom fields, you can skip the part where you get the post ID and such by using genesis_custom_field. So your code looks like:

    if( ! is_page() ) {
    $location = genesis_get_custom_field( ‘location’ ) ? genesis_get_custom_field( ‘location’ ) : ‘Nowhere’;
    echo $location . do_shortcode( ‘ [post_date]‘ );
    I’m showing the post date short code there, this has some extra options that can be added. You can read up on that here.

  2. Interesting. I have been using Simple Hooks for a while but with the latest Genesis I find it easier to simply insert the Analytics code in the footer Theme Settings page. The Simple Edits plugins fills out my other needs. Do you think Simple Hooks should be used instead of Simple Edits? Sometimes I think we have a boatload of plugins installed…..

    • Mromero, good suggestion on Google Analytics. Simple Edits is a great plugin, too, and if it does all you want, leave it at that – the interface is certainly easier!

      However, if you needed the extended functionality of Simple Hooks, I’d ditch Simple Edits and just use the one plugin. That’s just my opinion – I don’t like too many plugins if I can help it. 🙂

  3. Hi, Can you please let me know how to add a banner after 5 posts in the blog page, I have total 10 posts in the blog page.


    • Hey Frank, the logic above should work ($wp_query->current_post == 0). Try changing the current_post == 5 instead of 0 and see if that does the trick.

  4. Hi Carrie,
    Wow, love your posts/info. Very helpful.
    Hey, I’m trying to do the same thing for post_date as you’ve shown for location– that is to have the date appear for only one category of posts.
    I’ve unhooked genesis_post_info() from the genesis_post_content hook (because I don’t want 90% of it! And I’ve re-located the author to another location– for all posts).

    I think I could use most of your code above, but I’m not quite sure how to “re-word” it for the post date. And would it make a difference if I put instruction for this in Simple Hooks, or (with code adjusted) do it in my functions.php? I feel like I’m setting myself up for a conflict by removing, then adding the same function on the same hook!

    • Hi Lorin,
      Glad you found it helpful! You can use the [post_date] shortcode for just displaying the date.

      < ?php if (is_category('your-cat-id-or-slug')) { echo [post_date]; } ?>

      I haven’t tested that code, but that’s the idea. 🙂 You can check the Conditional Tag Codex for categories to make sure your conditional statement is right for whatever category you’re calling out.

      As to your question of Simple Hooks vs functions.php, this article might be helpful:

      If you do it in Simple Hooks, just the conditional code and the print statement will work (as in the example above). If you decided to add it to your functions.php, you’ll need to wrap that code in a function (a la that StudioPress link).

      • Hi Carrie, Thanks so much for your quick response!
        Unfortunately, WP didn’t like that — I guess– because I unhooked the post_info at the genesis_before_post_content hook and maybe Genesis now can’t grab the [post-date] because there’s no post_info from which to grab it??

        Should I:
        add the post_info first up at genesis_after_post_title hook where I want it, then follow with your code? Just not sure I know the syntax to do that in simple hooks.


        Or should I scrap this and leave the post_info intact (in Simple Hooks) and just go to my functions.php and try a conditional filter:

        /** Show only author on ALL posts except Diary category, in which case show author and date*/
        add_filter (‘genesis_post_info’, ‘post_info_filter’);
        function post_info_filter($post_info) {
        if (is_category( ‘diary’) {
        $post_info = ‘[post_author_posts_link][post_date] ‘;

        } else if {
        $post_info = ‘[post_author_posts_link]‘;
        return $post_info;

        (The above code returns an error in my Dreamweaver, but I can’t figure out why.) : (
        Sorry. I’m just learning WP and Genesis!

        • Ah, okay. I missed your before content / after content bit in your first comment.

          If you take the Simple Hooks route, you’ll want to Unhook genesis_post_info() from the genesis_before_post_content Hook. THEN you add in your conditional statement in the genesis_after_post_content Hook.

          If you go the functions.php route, do the code above, but first you’ll need to unhook it:

          /** Remove the post info function */
          remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );

          /** and then hook your custom function in AFTER the post */
          add_action (‘genesis_after_post_content’, ‘your_custom_function’);

          function your_custom_function($post_info) {
          if (is_category( ‘diary’) {
          $post_info = ‘[post_author_posts_link][post_date]‘;
          } else if {
          $post_info = ‘[post_author_posts_link]‘;
          return $post_info;

          As for syntax, beware those quote marks when copy/pasting. I think your problem was a misplaced closing bracket though. 🙂

          • Thank you SO much. Yes, I found that missing closing bracket, but it still returned an error!
            I found this somewhere and adapted it:

            function post_info_filter($post_info) {
            if (is_category(‘diary’)) {
            $post_info = ‘[post_author_posts_link][post_date] ‘;
            return $post_info;
            $post_info = ‘[post_author_posts_link]‘;
            return $post_info;
            else {
            add_filter( ‘genesis_post_info’, ‘post_info_filter’ );

            Seems it wants me to have that last line about the filter!

            You’ve been so generous with your time (and blog comments space!).
            To sum up, I think I mistakenly thought of post_info as having or being a short code when it is it is the parts of it that do. Secondly, if I UNhook the post_info from Simple Hooks default position, and want to REplace it at a position that occurs BEFORE that: genesis_after_post_title, is there a one-line action or function IN SIMPLE HOOKS that will do that trick? And does it matter if I’m placing it at a point BEFORE the default?

            Thanks so much in advance. I’ll let you off the ‘hook’ after this!
            ; )
            In my fourth full day of trying to solve this one problem,

    • Okay Lorin, you’re funny and you get bonus points for that.

      A couple of things. Take a look at the Genesis Visual Hook Guide to get a feel for where those hooks come into play.

      As long as something happens within the loop (i.e. post_info) you can move it/access it anywhere within the loop. You just can’t access it OUTSIDE the loop. So you can safely put it after the post title or after the post content – it’s alllll in the loop.

      As for the magic short codes (here’s a list), you can pop them right in to Simple Hooks! Just be sure you check the “Execute Shortcodes on this hook” option. You can let it fly solo, but in your case you’re needing the conditional PHP statement, so be sure you’re also checking the “Execute PHP” option.

  5. Great info and tips in this post! I’m a big fan of this plugin. I was just trying to put some PHP into a hook and was worried that it would break my site if there were any syntax errors as is the case with custom functions. Good to hear that this is more forgiving.

    • Hey Pepper,

      You’ll want to use the is_home() or is_front_page() conditional instead of is_archive(). So, if you wanted to change the code above to show an ad on the home page after the first post, you’d do:

      if( ($wp_query->current_post == 0) && is_home() )

      Note: If is_home() doesn’t work, try is_front_page() instead. Here’s a good article on the difference between the two.


        • Are you using the Simple Hooks plugin? If so, insert it in the genesis_after_post_content code block shown in the example above) but with the modified code.

          If you’re going to edit directly in your functions.php file (be careful if you do this – a typo can take your site down!), then use this bit of code:

          function cd_ad_after_first_post() {
          global $wp_query;
          if( (0 == $wp_query->current_post) && is_home() )
          echo ‘This is an ad!’ //Replace this with your ad code
          add_action( ‘genesis_after_post_content’, ‘cd_ad_after_first_post’ );

    • A custom post class relates to using custom CSS on a post, so it doesn’t have any bearing on adding some text before your content. What are you wanting to do?

  6. Hi Carrie,

    absolutely great tutorial and I managed to use conditional tags in my genesis hook to place ads conditionally. Thanks.

    I just want to know if it is possible to center my ad when placing the code in hooks plugin? If yes then how?

  7. I’ve used the code to place an ad under my first post on category pages…what would I need to do to have different ads on different category pages?



  8. Got any ideas on how I can use hooks to disable commenting for a certain category? I’m using a Genesis child theme that pulls portfolio items onto the portfolio page via a specific category in the blog. We’re going to utilize the portfolio page as a “meet the staff” page, so I’ve got the category “our staff” and would like to just disable the comments for just this particular category so that, when adding a new staff member, my client doesn’t have to remember to disable comments on those particular posts.

  9. Hey cool Carrie, you just came up third from the top when I googled “how to use genesis simple edits plugin” just now. And, thanks to you, I’m using the Simple Hooks plugin instead. It’s great! This is a very helpful post–especially the comments exchanges… Thank you. 🙂

  10. Carrie,
    Great stuffs you’ve got here with your Simple Hooks plugin, I’m using it in my new site.
    I was searching for the code snippet that could sort out my pain when i found you on the search results..
    I am working on a new site, using genesis + magazine ver2.1. With “Comments” enabled for both “Page” and “Post” and codes for email opt-in form(let’s name this newsletter) insert in “genesis_after_post_content Hook”

    I was going to add a new “page” using magazine’s “landing page” .

    I create the short sales copy within GetResponse’s webform builder(let call this bonus), paste the code to the new page’s “html” text box and hit publish. And the following happens:

    1) Title shows up: landing-bonus

    2) The “enter email here” box, “submit button” and “submit” text are all over the place

    3) The previous “opt-in” form (newsletter) below all “content” after post/page shows up.

    4) Comment box shows up

    My question, I will use “landing” in all future landing pages, but how to remove:

    b)”newsletter” opt-in form
    c)”comment box”

    from showing up at the magazine child theme “landing page”?

    How to insert the webform code into magazine’s landing page so that the email box, submit button, submit button’s text shows up the right way it should be?

    Have a great day!

    • Hey Joshua,
      Your questions are a little more in-depth than I can get into off the top of my head in a comment. 🙂 But I think you might want to edit the landing page template directly to get your desired output since you’re going to re-use it with the same format.


  11. I am sorry but the code above didn’t work on my child theme News pro, paste exactly the code above to “genesis_after_content Hook” and allow Execute PHP but nothing happened.

    Could you please help ?


  12. Muchas gracias Carrie
    Me has ayudado mucho con este articulo. He estado buscando la solucion de blog archive page en muchos sitios pero tu lo explicas genial y facil.
    Saludos desde España

    Thank you very much Carrie
    You’ve helped me a lot with this article. I’ve been searching the archive page blog solution in many places but you explain your great and easy.
    Thank you
    Greetings from Spain

  13. Hi Carrie, your tip on adding analytics through Simple Hooks was spot-on. Possibly now with a newer update, underneath the box where I paste the tracking code, it says:

    Execute Shortcodes on this hook?
    Execute PHP on this hook?

    Do I need to check those boxes, or leave them unchecked? Thank you!

  14. Hello Carrie, I love this article but i have a question, what should i do to show ads between post one and two and in between post five and six. I want to show ads

  15. Fantastically helpful post Carrie, but I feel rather silly that I cannot see genesis_before_post_content or genesis_after_post_content in my simple hooks list.
    I am using Genesis 2.3.1 with the Magazine Pro child theme (3.0.1), and Simple Hooks 2.1.2
    Any ideas?

  16. I used to use Genesis simple hook long before but now I only use default Genesis settings to achieve that. But I must say using for beginners that plugin is great.

  17. Hello Carrie, I really love this article but i have a question, what should i do to show ads between post 1 and 2 and in between post five and six. I want to show ads

  18. Hello Carrie, Its best article, i bookmark your blog to get more updates. but i have a question, what should i do to remove copyright by genesis option in footer of genesis theme ?

  19. Carrie, I’m using simple hooks to add some boilerplate text after each post. Is there a way to prevent this boilerplate text from showing on my archive pages?

  20. hi! – thanks so much for a great article – wondering if you can help as I’ve been trying for hours to do this! – I want to add code into genesis simple plugins hook that shows a different image and link for each different category on my site – and only for posts.

    I get lost at the <?php stuff – as I never seem to open and close at the right times – can you help?

    Basically code should write: –


    Hope this makes sense – and thanks in advance SO MUCH

    • Heya! Check this post on using WordPress conditionals for the right syntax to use. (i.e. you’re looking at is_single( 'post' ) to check for individual posts.

      Now that I’m thinking about, there may be a plugin that does this? It may help to use the word “taxonomy” in your Google search (that’s the technical term in WordPress for “category”)

  21. 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?

  22. 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]


Leave a Reply

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