Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
30 Million+
Websites using our plugins
20+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Add Custom After Post Widgets in WordPress

When someone reaches the end of your post, they’ve already given you something valuable: their attention. They read through your content and are now deciding what to do next.

An after-post widget lets you turn that moment into a deliberate next step instead of letting the visitors simply leave. We’ve used this approach on WPBeginner for years to get more email subscribers, increase our pageviews, and grow our sales.

In this guide, we’ll show you how to easily add custom after-post widgets in WordPress, step by step.

Add Custom After Post Widgets in WordPress

Example of a Custom After Post Widgets in WordPress

You can add just about anything to your after post widget including a call-to-action to join your email list, a related articles block to boost your pageviews, or even a product banner or discount to increase your sales.

Example of a newsletter signup form added after a post

Here are two easy ways to add a custom after-post widget to any WordPress theme.

Method 1. Add After Post Content Using a Plugin

The Add Widget After Content plugin adds a dedicated widget area right after your post content, and it works with any WordPress theme, classic or block.

Install and activate it to get started. You can follow our guide on installing a WordPress plugin if you need help. Once it’s active, go to Appearance » Widgets.

On a classic theme, this screen already exists, and the plugin adds an After Content area to it. On a block theme, WordPress normally doesn’t show the Widgets screen, so the plugin adds it along with the new ‘After Content’ area.

Add a widget in after content area

Click the plus icon inside that block to add any widget you want. We added a newsletter signup form, which was built with the WPForms plugin for this tutorial.

Feel free to configure the newly added widget and then click the ‘Update’ button to save your changes.

By default, the plugin shows your after-post widgets on every post and page. If you don’t want them to appear in certain places, you can exclude entire categories or post types from the widget area.

Simply go to Appearance » Widget After Content, choose the categories or post types where you don’t want the widget area to appear, and click ‘Save Changes’.

Select post types where after post content will not appear

You can also hide the widget area on individual posts or pages.

To do this, open the post or page you want to exclude and scroll down to the ‘Widget After Content’ meta box. Select the checkbox next to ‘Remove widget after content for this post.’ and then update your post.

Remove after post content widget from a specific post

Now visit your website and open any post where you configured to show the widget, and you’ll see it appear right below the post content.

Preview of content added after a post using a plugin

Method 2. Add Content After Posts Using Custom Code

If you’re comfortable adding code, you can customize exactly what appears after your posts instead of using a widget’s built-in layout.

However, the smallest mistake while adding code to your theme files can break your site.

We recommend using the free WPCode plugin to add and manage the snippet safely. If you need help, see our tutorial on how to install a WordPress plugin.

Once the WPCode plugin is active, go to Code Snippets » + Add Snippet and choose the ‘Add Your Custom Code (New Snippet)’ option.

Choose'Add Your Custom Code (New Snippet)' option

On the new screen, select ‘PHP Snippet’ as the code type. Then, give the snippet a name and copy the following code into it.

function wpb_add_content_after_post( $content ) {

    if ( is_single() && in_the_loop() && is_main_query() ) {
        $custom_content  = '<div class="wpb-after-post-content">';
        $custom_content .= '<h4>Enjoyed This Post?</h4>';
        $custom_content .= '<p>Sign up for our <a href="https://example.com/newsletter/">newsletter</a> to get more tips like this.</p>';
        $custom_content .= '</div>';

        $content .= $custom_content;
    }

    return $content;
}
add_filter( 'the_content', 'wpb_add_content_after_post' );

The is_single() check limits the content to individual posts, so the widget won’t appear on pages or archive listings. The rest of the snippet adds a heading, message, and newsletter link after the post content. Make sure to swap the example.com address for your own newsletter page before you set the snippet live.

Set the snippet to ‘Active’ and save it. Finally, visit a post on your site to see your custom content below the article.

Preview of content added after a post using code

Video Tutorial

If you’d prefer video instructions, then watch it.

Subscribe to WPBeginner

After Post Widgets FAQs

What is the difference between a widget and a plugin?

A widget is a small block of content you can drop into a specific area of your site, like a sidebar, footer, or the after-content area covered in this guide.

A plugin adds new functionality to your entire site, and it’s often what gives you new widgets or widget areas to use in the first place.

How do I add a widget after a post in WordPress?

The easiest way is with the free Add Widget After Content plugin. It adds a widget area below your post content where you can add widgets such as a newsletter signup form or related posts.

Or you could add the same feature with a code snippet. We recommend using the free WPCode plugin so you don’t break your site accidentally with your snippet.

Why is my after-post widget not showing?

The most common cause is an exclusion in the plugin settings. Check whether you’ve hidden the widget on that specific post or page, or excluded its category or post type under Appearance » Widget After Content.

We hope this article helped you learn how to add custom after post widgets in WordPress. You may also want to see our tutorial on how to create a custom WordPress widget and our guide on best WordPress plugins.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

12 CommentsLeave a Reply

  1. This method is really great and helped me promote my Patreon. I took advantage of Optin Monster and placed a banner at the end of the article that encourages users to take action and join my Patreon. I didn’t have high expectations, but this campaign is working really well. So, these after-post widgets have significant potential and marketing power.

  2. Hello!

    I installed the Add Widget After Content plugin and It doesn’t appear in the Widget area of my Website backend. Any ideas on what to do?

    • You would want to check with the support for the plugin and they should be able to take a look and assist.

      Admin

  3. Our site has multiple authors. Can you customize the widget for each post as apposed to just disabling it?

  4. I haven’t seen this plugin before, it fullfill the separation of style and function rule.
    Maybe I should start adding widget areas this way, and not building child themes just for a widget area or two.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.