The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End (RESOLVED) :: Isolating catagory children and filtering using meta values

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #30722

    This is long so bear with it… :)

    I am so happy I found this site… I had someone help me with this code but even he doesn’t know why it isn’t working. I have been working through it and understand 80% of it… I’m getting there.


    I have some code to help filter posted events based on location name which are defined as sub categories under the main category ‘location’ (id 35). The location name in the drop box to the right should only display if the end date of the event is the same or less than todays date (the end date is defined as a custom field called ‘endDate’. The end date is defined in the ‘custom field’ area when posting via worpress 3.x as the variable ‘endDate’ looking like 2010/10/08 (Y,m,d)

    All location names (Langley, West Vancouver, etc) are parented to the category ‘location’.

    The issue is that two ‘locations’ (Langley and Salt Spring Island) for events are showing up in the drop down list which endDate has have come and gone. These two locations should not be showing in the list.

    The resulting list that is being displayed on the screen after the drop down menus is correct. There are only two events currently that has an endDate later than todays date.

    My issue is with the Location drop down not filtering correctly based on date.

    My code is below. Please help me out.


    =meta_value= '.$todaysDate.' &orderby=meta_value&order=ASC');

    $the_post_cats = array();

    if (have_posts()) : while (have_posts()) : the_post();

    $the_post_cats = array_merge($the_post_cats, wp_get_post_categories($post->ID));


    Any help would be greatly appreciated.



    Well, we can close this one.

    Embarrassingly it was a missing ‘&’

    query_posts(‘cat=12,13,52&meta_key=endDate&meta_compare=>=meta_value= ‘.$todaysDate.’ &orderby=meta_value&order=ASC’);

    should have been

    query_posts(‘cat=12,13,52&meta_key=endDate&meta_compare=>=&meta_value= ‘.$todaysDate.’ &orderby=meta_value&order=ASC’);

    Three months on a single ‘&’ symbol

    Hope this some how helps someone else. :)

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.