Forums

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
    Posts
  • #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

    =’.time());?>

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

    #53974
    TheLeggett
    Member

    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: http://codex.wordpress.org/Function_Reference/wpdb_Class

    #53965

    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

    #53927

    how can I reference time() in the custom query

    #53925

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

    #53906
    
    $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);
    ?>
    #53828

    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.