1 Star2 Stars3 Stars4 Stars5 Stars (9 votes, average: 5.00 out of 5)

Advertisements or Content After First Post in WordPress or Genesis

Sometimes its a good idea to add advertisements or content after the first post in WordPress. The following tutorial will also show you how to do it on a Genesis framework.

Add advertisements or content after the first post in WordPress *

In the picture below we see an advertisement after the first post on SawDustGirl.com. Then the posts continue as they normally would.

Add advertisements or content after the first post in WordPress

Subscribe To My YouTube Channel:

In order to accomplish this task open up your index.php in your child theme. You can do it in a parent theme but when you update the theme your changes will be overwritten and you will have to do this process all over again.

Copy the code below and paste it in the while loop. See video for detailed instructions on this process.

<?php
global $wp_query;
if( ($wp_query->current_post == 0) ) {
?>
<div>
YOUR CONTENT OR SCRIPT
</div>
<?php
}
?>

If you only want the additional content to appear on archived pages you can use the code below and past it into your archive.php in the while loop.

<?php
global $wp_query;
if( ($wp_query->current_post == 0) && is_archive() ) {
?>
<div>
YOUR CONTENT OR SCRIPT
</div>
<?php
}
?>

Add advertisements or content after the first post in Genesis *

First of all make sure that you have Simple Hooks installed on your Genesis Framework. Once you are sure of that look for Simple Hooks under the Genesis Tab. genesis simple hooks

 

Scroll down to where it says  genesis_after_post_content Hook and past the code below. replace YOUR CONTENT HERE with whatever you need to replace it with. Make sure that you check the box “Execute PHP on this hook.

genesis_after_post_content Hook

<?php
global $wp_query;
if( ($wp_query->current_post == 0) ) {
?>
<div>
YOUR CONTENT HERE
</div>
<?php
}
?>

Add Content before or after each post or title *

Please see our WordPress Functions page after watching this video.

Advertisements or Content After First Post in WordPress or Genesis was last modified: April 18th, 2015 by Maximus Mccullough

Advanced Programming Made Easy

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

more tips

Reoccuring Tips

Tips

Advertisements-or-Content-After-First-Post-in-WordPress-or-Genesis

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.