Support » Fixing WordPress » Custom posts query and problems on pages other than index.php

  • I used the code from to create a new index.php page with sample query (it fetches all posts that have a special custom field set).

    I need to have another page, let’s say “news.php” on which I want to display posts with another custom query (a different value of the custom field).

    Now, first query (in index.php) works great. The problem is with the second one — it generates a good query but in the loop it displays the same post X times (as many times as many rows the query fetched). I access the second query from http://mypage/news/list – this calls news.php file with a param “list” – I used WP rewrite concept used in plugin UltimateTagWarrior).

    Do you have any ideas why the same loop works in index.php and doesn’t work on the rewritten page? Do I need to add some includes, register some globals, or sth like that? I’m really stuck and cannot find much help on this subject…

  • The topic ‘Custom posts query and problems on pages other than index.php’ is closed to new replies.