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 {
& }
.
I might like to start off by saying Happy Birthday WordPress. I don't have any…
Planning Who let you in? Format Daily Weekly Monthly Hour/half hour A show's Outline -…
I'm sitting downstairs at WordCamp 2009 in San Fransisco. Up on stage right now, Andy…
Choosing the best photo editing apps for e-commerce depends on your specific needs and budget.…
For your information. The WordPress fonts are as follows: the old WP logo was Dante,…
WordPress announced the release of 2.8 beta 2, download it or check out the changes since…
View Comments