Index.php query based on pretty URL? (2 posts)

  1. hadyn
    Posted 5 years ago #

    Hey guys,

    I have pretty permalinks set up on my site, so that a post that fits under the "deals" type (which is part of a custom taxonomy, not a wp "category") will have an address such as:


    What I want to do is make it possible for users to enter "http://www.site.com/deals/" as their URL, and be presented with the regular index.php, except that content is filtered to only display the "deals" posts.

    I know I can do this by setting up a page specifically for that URL and having a specific query that only looks for deals... but I'd rather it all be done via the index page, so that I don't have to set up a custom page for each different type of content.

    So my question is: how can I tell the wpquery on index.php to filter results based on whether the URL ("http://www.site.com/") has an additional segment on the end, such as "deals/"?

    I'm familiar with passing php variables in URLs by using the "?" symbol, but in this case I want my URLs to maintain their "pretty" appearance.

    Any help is much appreciated!

    Thanks in advance,

  2. hadyn
    Posted 5 years ago #


    It's all automatic - I just (stupidly) had a custom query in my index.php which I had forgotten about. I've removed the query and - presto - it all works as expected!

Topic Closed

This topic has been closed to new replies.

About this Topic