WordPress.org

Forums

Custom posts query and problems on pages other than index.php (1 post)

  1. michuk
    Member
    Posted 8 years ago #

    I used the code from http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query 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...

Topic Closed

This topic has been closed to new replies.

About this Topic