Move Genesis After Entry Widget to Inside Post Entry

Share this on:

The Genesis After Entry widget area is normally added after a single post entry and before the comments section. But you may want to have an after entry widget area inside the post entry content area. This tutorial shows you how to move the after entry widget area.

move genesis after entry widget into post entry content image

You can move the after entry widget area easily. For this tutorial, I’m using Genesis Sample child theme, but gave it a darker gray background, so you can more easily see the post content area. I also added a blue background to the after entry widget.

All the code in this tutorial will be added to your child theme functions.php. Be sure to use a text editor.

The Code

<?php
// Remove line above before adding to functions.php

// Add support for after entry widget
add_theme_support( 'genesis-after-entry-widget-area' );

// Remove the after entry widget from after blog post entry
remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );

// Add the after entry widget at the end of the post content
add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 10 );

Explanation of Code

  • The first line adds theme support for the after entry widget area.
  • The second line removes the after entry widget area from it’s default location below the post entry, and above the comments section.
  • The third line adds back the after entry widget area into the post entry area.
  • The priority number, 10, in the third line adds it at the end of the post; using a 9 would add it to the beginning of the post, just below the title and entry meta.

Move After Entry to Just Below the Category and Tag Meta

If you wanted the after entry widget area to be just below the categories and tags, but still inside the post entry area, you would add the following to your functions.php.

<?php
// Remove line above before adding to functions.php

// Add support for after entry widget
add_theme_support( 'genesis-after-entry-widget-area' );

// Remove to relocate after entry widget
remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );

add_action( 'genesis_entry_footer', 'genesis_after_entry_widget_area', 15 );

Notice that the last line adds to the genesis entry footer (the category and tags meta), and uses a priority number of 15.

Add to Post Entry and to Posts and Pages

A previous tutorial showed how to add the after entry widget area to posts and pages. To combine this tutorial with the previous, you would add the following code to your functions.php.

<?php
// Remove opening php tag when using

// Add support for after entry widget
add_theme_support( 'genesis-after-entry-widget-area' );

// Remove after entry widget
remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );

// Add after entry widget to posts and pages
add_action( 'genesis_entry_content', 'amethyst_after_entry', 10 );
function amethyst_after_entry() {

   if ( ! is_singular( array( 'post', 'page' )) )
        return;

        genesis_widget_area( 'after-entry', array(
            'before' => '<div class="after-entry widget-area">',
            'after'  => '</div>',
        ) );

}

And Some Styles

If you want the same styling as in the image, you can add the following to your Custom CSS editor or your child theme style.css.

.after-entry {
  background-color: #83CAFE;
  margin: 40px -60px 0;
  padding: 40px 60px;
}

Now you have a lot of options for your after entry widget area.

You can have a beautiful, hardworking website for your small business.

Tell me about your website project for a personalized solution!


Do you need website tips?

Sign up to get easy-to-use WordPress tutorials, Genesis theme customizations, and other helpful tips for your small business website.

Your email address will be used to send you blog posts. Privacy Policy


photo of Marcy Diaz who owns Amethyst Website Design

Comments

5 responses to “Move Genesis After Entry Widget to Inside Post Entry”

  1. Sayed Avatar
    Sayed

    Hi Marcy

    Thank you for creating this helpful article.

    Could you please tell me how to reposition the footer widget area to before the footer?

    1. Marcy Diaz Avatar

      This tutorial is on moving the after entry widget. In Genesis the footer widgets are already right above the site-footer area. I see your’s there. You’re also using a Genesis third-party theme, and so it’s best to ask in their support. All the best.

  2. Revilo Avatar
    Revilo

    Great Post, exactly what I was looking for but I do have the problem that I have the widget area 2 times on my blog now. Looks like the remove action doesn’t work?

    Any idea to fix this? Studiopress Theme.

    1. Marcy Diaz Avatar

      The remove action works fine. Look in your theme again. Most likely your theme already added the after-widget area, so you just need to remove it.

      1. Revilo Avatar
        Revilo

        Yes, you are right. My theme had it in a different area. After renaming it it worked fine. thx for the hook!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.