Cross category querying with category specific results

Discussion in 'PHP' started by JakeThePeg, Sep 15, 2009.

  1. #1
    Howdy. I have a category search on the Home page of my Wordpress powered site shackn.com. It uses the following code:

    <form action="<?php bloginfo('url'); ?>" method="get">
     <?php wp_dropdown_categories('hierarchical=1'); ?>
     <input type="submit" name="submit" value="view" />
     </form>
    Code (markup):
    In relation to the way I write posts and assign them to specific categories, my technique is as follows:

    *Every post is assigned a location from the children of "Location" category.
    *Every post is ALSO assigned to EITHER the "Accommodation" or "Surfbreaks" category.

    On the "Results page", after the user selects from the drop-down list on the homepage and presses "Submit", I would like the results of this search, to only display posts from only the "Surfbreaks" category, but not the "Accommodation" category as well.

    Any ideas how do I do this?
     
    JakeThePeg, Sep 15, 2009 IP