I am creating a theme in WordPress.

I am using query_posts('tag=front') to limit the posts on the front page. However, I want to let the user navigate through all posts, regardless of tags when on the a permalink page. I am using next_post_link(); to deal with this.

I am using this to limit the posts on the index.php:

query_posts( 'tag=front' );

I am using this to let the user click through each project, on single.php:

<?php next_post_link('%link', 'Next post &rarr;', TRUE); ?> 

However, it is only looping through posts tagged with front, and not all posts regardless of tags. I want it to loop through all.

You can see it live here: http://kurt-theme.info/

  • What do you mean by 'a permalink page'? Sep 10, 2013 at 13:34
  • oh dear lord, query_posts faints
    – Tom J Nowell
    Sep 10, 2013 at 14:09
  • What would you recommend as an alternative?
    – tmyie
    Sep 10, 2013 at 14:11

1 Answer 1

  1. query_posts() should not be used, look into pre_get_posts hook.
  2. Whatever you do inside index.php template does not influence inside of single.php template. Two different top level templates aren't (normally) loaded at the same time.
  3. You are explicitly requesting next_post_link() to limit next post to the same category via third argument, are you sure that's not your issue?
  • You were right. It was the third argument. Thanks!
    – tmyie
    Sep 10, 2013 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.