WordPress.org

Support

Support » Themes and Templates » Posts query only showing current months posts

Posts query only showing current months posts

  • adammydesign
    Member

    @adammydesign

    I am using the current code along with custom post types to make an event page a client.

    This query is for featured events on the home page but it only display events that are in the current month. Any event that is (at this present time) in October, are not displayed.

    Please help me with this. The query is as follows.

    <?php
    
    	 $todaysDate = date('dd/mm/yy'); // Get today’s date in the right format
    
         $my_query= new WP_Query('posts_per_page=5&post_type=compass_events&meta_key=_cmb_event_date_order&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC&category_name=featured');
    
    		while ($my_query->have_posts()) : $my_query->the_post();
               ?>
    
            <?php
    			$_cmb_ = get_post_custom($post->ID);
    			$eventdate = $_cmb_['_cmb_event_date'][0];
                $eventtime = $_cmb_['_cmb_event_time'][0];
                $eventprice = $_cmb_['_cmb_event_price'][0];
                $eventsupports = $_cmb_['_cmb_event_supports'][0];
    
    		?>

    Thank you in advance.

  • The topic ‘Posts query only showing current months posts’ is closed to new replies.