How might you display a Google ad after the first post or anything you like? It is very simple. You just need to add the variable $loopcounter
in the Loop. If the $loopcounter
is less than or equal to 1, then include your option. Check out the code:
<?php if (have_posts()) : while (have_posts()) : the_post(); $loopcounter++; ?> // your loop <?php if ($loopcounter <= 1) { include (STYLESHEETPATH . '/you-file.php'); } ?> <?php endwhile; ?> <?php else : ?> <?php endif; ?>
Pretty simple huh. Well in the $loopcounter
line, you may change the include to point to any file or maybe a custom widget like so:
<?php if ($loopcounter <= 1) { dynamic_sidebar( 'Plus Post' ); } ?>
Or use your code directly in between the {
& }
.
The post discusses five essential tools for content curators: Scoop.it, Pinterest, Zemanta, Storify, and List.ly.…
WordPress is a highly popular open source content management system that is not only best…
If you've started looking for themes for your business site, you will understand that there…
In a previous post I talked about how to show/hide a single div html code…
Data Breach Infographic developed by LifeLock.com
According to a recent study conducted by Stanford University, about 10 percent of the United…
View Comments