Posts Tagged ‘First’

WordPress: get posts within the loop

Click here to read WordPress: get posts within the loop

This post will explain how to get posts at the WordPress loop, so you can place code (probably advertisement code) after a specific post (first, second, third) or at intervals (e.g.: every 3 posts).

Before starting, it is a good idea to create a backup copy of your theme’s index.php file, just in case anything goes wrong.

This is a five page post, so here is the page index:

  1. Get the first post
  2. Get the 2nd, 3rd or any other post
  3. Get odd/even posts
  4. Get post intervals
  5. Final considerations

Let’s begin by finding where to place the code. That’s why we need to find the WordPress Loop in the index.php file.

(more…)