Support

Account

Home Forums Front-end Issues True – false Reply To: True – false

  • Thanks for the help, changed few extra strings to make everything work as I want to. As for value ‘1’ or TRUE(both work fine) I misspelled and wrote show_main in the key instead of show-main, heh.

    In case if someone will need this

    <?php 
    
    $posts = get_posts(array(
        'cat' => $current,
        'post_type' => array( 'page' ),
    	'numberposts'       => -1,
    	'meta_query' => array(
    		array(
    			'key' => 'show-main',
    			'value' => '1',
    		)
    		)
    		)
    );
    
    if( $posts ): ?>
    		
    	<?php foreach( $posts as $post ): 
    		
    		setup_postdata( $post )
    		
    		?>
    loop
    
    	<?php endforeach; ?>
    	
    	<?php wp_reset_postdata(); ?>
    
    <?php endif; ?>