WordPress.org

Ready to get started?Download WordPress

Forums

Insert a few items between some posts? (2 posts)

  1. octimotor
    Member
    Posted 4 years ago #

    sbj; Insert a few items between some posts?

    How, thru WordPress 2.2, can I place banners so that one might appear below 1st post down, another one appear below 5th post down, another appear below 9th post down, for example and etc.? The plug is used which shows most recent post at full length, while each older one shows about 20 -50 words then "Read More" link to the respective full post.

    For static html pages the answer is very clear. But wordpress delivers dynamic pages, looping from first / most recent post, thru the rest to end of list, or end of current page length. How do I intervine into locations inside that data base query stream?

    tags; banners placement, dynamic content

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    You'd need to edit the relevant template file and first set up some sort of post counter before The Loop begins which can then be incremented during each loop. Then it's just down to adding an if/elseif statement within The Loop to test the post counter value and render the relevant code at post 5, post 9 etc.

    By the sounds of it, the first post isn't part of the main Loop. Maybe is being pulled using get_posts? If so, it should be fairly simple to add the first banner code between this and the main page Loop.

Topic Closed

This topic has been closed to new replies.

About this Topic