• Hi,

    I am currently redisigning my custom theme and I have put two loops on the index.php file.

    The first loop gets only sticky posts so I can have a featured posts section. In this loop I get content-featured.php which has only the html and php code for displaying the sticky posts.

    My second loop gets all the posts but excludes sticky posts so no duplicate posts. In this loops I get the content.php template.

    My question is, is this the correct way to go about this? having two loops and two templates? I want the theme to conform to wordpress standards and I wasnt sure if maybe I was doing it the hard way.

    Any theme dev pros, is there an easier way to have a featured posts section?

    It seems to working OK so far mind you.

Viewing 1 replies (of 1 total)
  • Hi gamerwithadegree ??

    You can have multiple loops on your page. No problem.

    Just make sure to use wp_reset_query() to clear results of the previous loop or to create new WP_Query!

Viewing 1 replies (of 1 total)
  • The topic ‘Two loops on index.php with two content templates?’ is closed to new replies.