I created a meta box with a value "home" of type checkbox, however I'm having hard times retrieving into the loop, I'm using this code into the loop:
<?php if(get_post_meta(get_the_ID(), 'home') == '1' ) : ?>
<!--BLABLA TO DISPLAY -->
<?php endif; ?>
if the checkbox is checked it should work like this, however is not... the most funny part is if I set it to '0', it displays all the other pages where is not checked.
Any guess?
Thanks in advanced
UPDATE
Page Options code
$meta_boxes[] = array(
'id' => 'page-options',
'title' => __('Page Layout', 'andrewslab'),
'pages' => array('page'),
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array(
'name' => __('Home', 'andrewslab'),
'id' => 'home',
'type' => 'checkbox',
'desc' => 'Display in <strong>home page</strong>',
'std' => ''
)
)
);
Template Code
<?php
global $wp_query;
$args = array_merge( $wp_query->query, array( 'post_type' => 'page' , 'showposts' => '4' ) );
query_posts( $args );
?>
<?php while (have_posts()) : the_post() ; $meta = get_post_meta( get_the_ID(), 'home', true ); ?>
<?php if( checked( $meta, 1, false ) ) : ?>
<!--BLABLA-->
<?php endif ?>
<?php endwhile; ?>
<?php wp_reset_query() ?>
Basically I need to enter into the loop only if the checkbox is checked.