WordPress is an open CMS and easy to edit or code but if you are new to it then it is very hard to edit it. Now here we are trying to make it simple to you by sharing simple tutorial too in our previous posts that you can see there. NOw its time to make a simple tutorial if you want to add any data after your WordPress posts.
So let consider that you want to ad adsense code, social sharing button, banner ads, affiliate links, any text or anything else just after your full posts not pages or any other blog page so for this you have to edit theme but there if you make a little mistake then your whole blog can be mess up so if is better not to touch that. But you can still do it by using out simple code tutorial. Just use the below code and add anything whatever you want.
Now without any more preface, here its time to directly go to the tutorial to get the steps. Then you have to follow that s steps using the below shared code that will do what we said above. After this just do the customization that you want and thats it it. So move on to do it.
Features:
1.) Pure PHP code.
2.) Just have to edit function.php
file.
3.) No extra editing required.
4.) Can add Text/HTML too.
5.) Conditional tag added.
How To Add Any Data After Posts In WordPress?
Step 1:) Copy the below code and Paste in in your Theme Function(function.php) file.
/* ------------------------------------------------------------------------- * * Add Any Data After Posts In WordPress /* ------------------------------------------------------------------------- */ function exe_add_data($content){ if(!is_feed() && !is_home()) { $content .= '+++ENCODED HTML CODE HERE+++'; } return $content; } add_action('the_content', 'exe_add_data');
Step 2:) Save and you are done.
Customization:
You just have to replace +++ENCODED HTML CODE HERE+++ with your desired content. You must have to add encoded HTML/JavaScript/JQuery code here ot can add Text too. To encode your code, just use out HTML Code Encoder to encode your code and use the encode cvode in above code.
Theme Files Editing Warning:
Keep in mind that every code that you will add in your themes files will be removed when you will change the theme. So after changing your theme, you have to follow this article again and you will get everything back same as it is now.
Last Words:
This is what we have and shared in easy steps for newbies so that they can easily know how it works. Stay with us because we are going to share a whole guide step by step about WordPress and make it easy for you. If you liked it then share it and be with us to get next tutorial. If you have any problem then feel free to ask us. We will help you with what we can or have.
Be the first to write a comment.