Support

Account

Home Forums Front-end Issues query based on current page Reply To: query based on current page

  • Is it outputting anything at all? Like a empty list?

    What do you get if you output the results of the query

    
    <?php
    			
    	$business_event = get_posts(array(
    		'post_type' => 'event',
    		'orderby'    => array(
    			'event_date' => 'ASC',
    			'time_start' => 'ASC'
    			),
    		'meta_query' => array(
    			array(
    			'key' => 'business_name', // name of custom field
    			'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
    			'compare' => 'LIKE'
    			)
    		)
    		));
    
    // show results of above.
    echo '</pre>'; print_r($business_event); echo '</pre>';
    	?>