How to add content after each post in WordPress

0
432
How to add text after each post in wordpress

There are several methods to add content after each post in WordPress.

We will cover two methods, one using a plugin and another by modifying functions.php.

How to add content after each post in WordPress using a plugin

Go to http://yourdomain.com/wp-admin/plugin-install.php

Search for the plugin Widget After Content and click Install

Once the plugin is installed, click Activate

Once the plugin is activated, go to your widgets http://yourdomain.com/wp-admin/widgets.php

There, you will see the After Content widget and can drag into it anything you want such as a text or html box to add your content.

In the example below, we added a text box to include the affiliate disclosure in.

Add content after each WordPress post

You can make further customizations of the plugin in the plugin settings page here: http://yourdomain.com/wp-admin/themes.php?page=awac-options

Add text after each post in WordPress

How to add content after each post in WordPress using functions.php

Go to Theme Editor http://yourdomain.com/wp-admin/theme-editor.php

Click functions.php in the list of templates on the right hand side.

Add the follow code at the bottom of the functions.php content:

Replace “YOUR CONTENT GOES HERE” with the content you want included. You can add new $content line and format your text in html however you see fit.

function text_after_content($content) {
 if(!is_feed() && !is_home()) {
 $content.= "<p>YOUR CONTENT GOES HERE</p>";
 }
 return $content;
 }

add_filter ('the_content', 'text_after_content');

So What?

The first method is definitely the easiest given that it allows you to add many widgets without touching the code. But the second method is more advanced especially if you are comfortable editing functions.php.

Disclosure: This page includes links to sites we affiliate with. Purchasing through them will earn us a commission. Keep in mind that we only recommend the products and services that we believe in.

LEAVE A REPLY