Add After Post Widget Area In Genesis

There’s at least 3 different ways to display content after your post.

1. You could install the Simple Hooks plugin and simply paste in some html or opt in form code to be displayed after all your posts content.

The only problem is it would also be displayed on your archive pages as well. Unless you add a conditional statement so its only displayed on your single posts.

Here’s the code for displaying HTML after single posts:

Paste this code into the box to be executed using the genesis_after_post_content Hook.

Simple Hooks

Make sure you check the box to Execute PHP on the hook.

This method works well for displaying HTML however does not create a widget area for use with the Genesis eNews extended widget.

Creating Widget Area After Post

2. Another way to add a widget area after your post content is to:

  • Register your widget genesis_register_sidebar
  • Hook it in to the location you want to add your widget content using a php action hook genesis_after_post_content & custom function wpsites_after_post_widget
  • And style your widget area using CSS code .after-post-widget
Note: This code has been taken from another Genesis child theme & modified. Paste it in your child themes functions.php file.

Register & Hook Widget After Single Posts

This code registers the new widget area which you can use to display content after all single posts.

The Enews Extended plugin enables you to connect to MailChimp, Aweber, Feedblitz and Feedburner.

Genesis Built in After Post Widget

3. Genesis now includes a built in function which enables you to add 1 line of PHP code to the end of your child themes functions file to display the after entry widget area. This is the easiest and most efficient way to add a new widget after single posts.

add_theme_support( 'genesis-after-entry-widget-area' );

Styling

You’ll need to add some styling which will be theme specific.

Here’s some CSS you can customize to match your own themes styling.

.after-post-widget {
background-color: #f5f5f5;
margin: 5px 0 10px;
padding: 10px;
overflow: hidden;
}

Change Width

You can also change the width of the entry field as well as the font size of the text inside the email box.

Editing this code will effect your eNews Widget on a site wide basis.

.enews #subbox {
    -moz-box-sizing: border-box;
    background-color: #fff;
    box-sizing: border-box;
    color: #888;
    font-size: 16px;
    margin: 0 0 10px;
    padding: 15px;
    text-transform: uppercase;
    width: 65%;
}

You can use either a percentage or pixel value for the width.

Using Different Code

There’s different PHP code you can use to create after post widgets in Genesis.

Not all StudioPress child themes use the same code, so you may want to try different snippets to find out which one works best in your child theme.


Comments

17 responses to “Add After Post Widget Area In Genesis”

  1. Ryan Hanley Avatar
    Ryan Hanley

    Brad,

    Any reason this wouldn’t work on Parallax Pro?

    I’m usually pretty good at this stuff and for the life of me I can’t get the inline to work on Parallax. I know the built in after post widget is marked .after-entry and I made that change. Everything else should work the same right?

    All I get no matter what is Full-width input and button.

    it’s driving me nutz!!!

    Ryan

    1. Brad Dalton Avatar
      Brad Dalton

      You mean 3 widgets inline?

  2. How do you add a “before entry” widget to Magazine Pro theme? Looking to the hook reference guide I cannot figure out what hook to use…

    1. Brad Dalton Avatar
      Brad Dalton

      You can use genesis_before_entry or any other hook http://genesistutorials.com/visual-hook-guide/

  3. Hello Brad,

    Wondering if you can help… I want to add a sentence above a section of my homepage, and I want a little spacing below the sentence.

    I used the following code but the style for padding is being ignored.

    sentence here

    I have also tried to enclose the sentence in tags, as well as simply adding a couple tags after the sentence. No matter what I try, there is no way to add a little space after the sentence.

    I am using the latest versions of Genesis and Genesis Hooks.

    The hook I am working with is: genesis_before_content_sidebar_wrap

    Do you happen to know why any attempt to create space/padding is being ignored?

    Thanks, Ross.

    1. Brad Dalton Avatar
      Brad Dalton

      Does the code include a div class and i.d?

      Better to use a custom function that generates a new class for styling and adding padding than using Simple Hooks.

      The code you pasted into Simple Hooks doesn’t include a class which you can use to style your text and apply the padding-bottom property to.

  4. Jenny Avatar

    I use genesis & i copied/pasted the code into my file but got a php error with the “register_sidebar” line.

    1. Brad Dalton Avatar
      Brad Dalton

      Hi Jenny.

      Which code? There’s 4 snippets there and they’re all tested so they work.

      Did you copy the code using the view raw link?

      Did you use a text editor like Notepad++?

      All code works but the apostrophes can change if you don’t copy and paste correctly causing errors.

      Did you paste the code into your WordPress theme editor or the functions.php file?

      I think you must have copied the code for Simple Hooks and pasted it into your functions.php file which doesn’t include code for regsitering the sidebar as its simply echoing the text.

      Use the 2nd snippet in your functions.php file please.

      Here’s a new post i published today with 3 PHP code snippets and some sample CSS included as well that should help,

    1. Thanks Larry. That’s good for HTML code and a lot faster than adding a widget.

      Your Html Goes Here

    2. Hey Larry. Would you like a write a guest post on WP Sites??

      1. Larry James Avatar
        Larry James

        Thank you for asking me to write a guest post on your blog Brad. I would be happy too. It will have to wait until after Christmas though. I will be in touch with you after the holidays.

        Thanks again for asking 🙂

  5. Larry James Avatar
    Larry James

    I use the Genesis Simple Hooks plugin, and I just add a conditional statement. It works great for me. I use the example below and output shows on my posts, not on the archive pages.

    My HTML goes in here

    Just make to check the box that says “Execute PHP on this hook?”

    1. Hi Larry. Can i see the code you use in Simple Hooks?

      1. Larry James Avatar
        Larry James

        I thought I put it in there, he it is again. I have pasted it below.

        Html Code Goes Here

        1. How about Pastebin and paste the link here.

Leave a Reply

Join 5000+ Followers

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