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

Home Forums Back End php problem on WordPress ~ Please help!

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

    I added a field called date (a date time stamp)….The movies should then be queried based on the date. If the date is less than or equal to today, the movies will show on the now playing page. If the date is greater, then they will show on the coming soon page. I need to simply get the query string to work correctly


    The problem I have is that it pulls in numerous copies of all of the posts.


    I’m almost positive that you can’t use comparison operators in the query_posts function, such as “>=”.

    If that’s so, this will require a custom query… maybe something like this?

    wpdb->get_results(" SELECT * FROM $wpdb->posts WHERE post_date > '2011-03-24 00:00:00' ");

    Some useful info if you’re not familiar with querying the database this way:


    No, I’m not used to doing custom queries…..I don’t know where to start to do this even after looking over the codex


    how can I reference time() in the custom query


    I have tried the code below, but I don’t get results…

    $querystr = "
    SELECT wposts.*
    FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
    WHERE wpostmeta.meta_key = 'date'
    AND wpostmeta.meta_value <= time()
    $pageposts = $wpdb->get_results($querystr, OBJECT);

    I found a super simple solution ~

    Sure wish I would have found it sooner!

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