Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • I agree with daniel27lt!

    Forum: Plugins
    In reply to: Custom field page id's
    Thread Starter Cornelis Scheltinga

    (@cscheltinga)

    Fixed it:

    $bar_key = null;
    	$page_id = 'none';
    
    if ( is_page() && !is_front_page() ){
    		$bar_key = 'cs_bar_pages';
    		$page_object = get_queried_object();
    		$page_id = get_queried_object_id();
    	}
    	else if ( is_front_page() ) {
    		$bar_key = 'cs_bar_homepage';
    		$page_object = get_queried_object();
    		$page_id = get_queried_object_id();
    	}
    
    $args = array(
    		'post_type' => 'notifications',
    		'posts_per_page' => 1,
    		'orderby' => 'menu_order',
    		'order' => 'ASC',
    		'meta_query' => array(
    			'relation' => 'OR',
    			array(
    			'key' => $bar_key,
    			'value' => 'yes',
    			),
    			array(
    			'key' => 'cs_bar_specific_pages',
    			'value' => $page_id,
    			'compare' => 'LIKE',
    			),
    			array(
    			'key' => 'cs_bar_specific_posts',
    			'value' => $post_id,
    			'compare' => 'LIKE',
    			),
    		)
    	);

    Thread Starter Cornelis Scheltinga

    (@cscheltinga)

    Already got it. It was the second array which causes the trouble.
    It should have ‘value’ => ‘0’, instead of ”. Strange why it worked on my localhost anyway.

Viewing 3 replies - 1 through 3 (of 3 total)