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 {
& }
.
Here is a simple way to call query_posts with an array of options. For all…
Looking to add a favicon to you site? Inside your WordPress theme's functions file (functions.php)…
Wow, have you heard? WordPress has announced that the newest version, 2.8 which was thought…
I just came across this article over at WPLover. Was very good, especially since I…
Today has released an update to his Hybrid Theme. Version 0.5.1 can be found at…
If you've downloaded the Swekey plugin and plan on using it for users to login…