Add Post Info To Pages In Genesis

Simply paste this code at the end of your child themes functions.php file. The code will generate and print page info after your page titles.

This code includes the new loop hooks for Genesis 2.0 HTML 5 enabled child themes.

You can easily modify this code to include or exclude the date, author, comment and other links.

Example Of Post Info On Page

post info pages

Post Info With Schema On Pages Only

This code will display post info with micro data on pages only and removes post info from single posts. The code only works using Genesis 2.0 on child themes which support HTML 5 and the new loop hooks.

To enable post info on single posts, simply remove the remove action line of code at the top of snippet. Here’s the code which also displays the default post info on single posts and micro data supported post info on pages.

Default Single Post Info & Micro Data Post Info On Pages

You can easily modify this code by using another conditional tag and hook position to display in a different location on posts, pages and archives.

Display Post Info On Specific Pages

You can use either the page slug, page i.d or page name in an array to add post into to specific pages. Using the page name is not recommended as it doesn’t always work.

Note: The Genesis 2.0 framework includes built in schema which outputs micro data in all HTML 5 child themes running 2.0.

Further Customization Of Post Info

Here’s different ways you can remove, add and customize post info links in Genesis child themes.


Comments

10 responses to “Add Post Info To Pages In Genesis”

  1. Zach Shivers Avatar
    Zach Shivers

    Thank you for the article.

    I have added the code for “Post Info With Schema On Pages Only” to my child themes functions.php file ( /themes/balance/functions.php)

    I have cleared the browser cache and cleared all caches in w3tc plugin.

    I do not see the post info on any pages.
    Google structured data testing tool shows that the ‘author” and “update” field are missing still.

    Please advise what I need to do to resolve this issue.

    Thank you.

    1. Brad Dalton Avatar
      Brad Dalton

      Hello Zach

      Only works on HTML 5 themes unless you change the loop hooks.

      It won’t get you any more traffic and Google can take months to update.

  2. Hi Brad,

    I tried your suggested piece of code but still nothing happens.

    Perhaps it’s better if I explain what I would like to achieve:

    I have a page which I selected to be the static home page. On this page (home page) I would like to show the page creation date below the title.

    Hope you can help me out with this. Thanks!

    1. Brad Dalton Avatar
      Brad Dalton

      You mean the published date?

      Why not simply add it to your custom home page?

      The code in the tutorial works for the New Genesis 2.0 HTML 5 enabled child themes.

      If you’re still running XHTML, you will need to change the hooks.

  3. Oops, seems like the code I placed in the comment pulled info from this post 🙂

    1. Brad Dalton Avatar
      Brad Dalton

      I couldn’t see any problem with this post. Where exactly?

  4. Hey Brad,

    I don’t have the simple edits plugin, only the simple hooks plugin. But yeah it could be that unhooking it stops the code from working. I tried deactivating the plugin but to no avail.

    This is the code I’m using (I would like to show the post info on a specific page):

    Cheers!

    1. Brad Dalton Avatar
      Brad Dalton

      I don’t think that code will work.

      Firstly, you don’t use an array for a single page so its is_page(‘007’)

      Secondly, you should add the 3rd parameter for that hook which is 12, so its:

  5. Hi Brad,

    I’m trying to use your code to add the date to a specific page but it isn’t working.

    I’m using the copyblogger theme and the latest version of Genesis. Also I have unhooked the genesis_post_info using simple hooks plugin. My theme isn’t html 5 ready yet as I don’t have the appropriate knowledge to bug fix everything when something goes wrong.

    So, I would like to display the date only on 1 specific page (which is the home page actually).

    Thanks!

    1. Brad Dalton Avatar
      Brad Dalton

      If you have the Genesis Simple Edits plugin activated, adding PHP code might not work as they both hook into the same filter and the plugin wins.

      Unhooking the Genesis post info may also cause any code using that hook to stop working.

      What code did you add to your child themes functions.php file?

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.