0

I created metabox.If the checkbox is checked if the posts are listed. How do I browse the posts marked with checkbox ?

Metabox Code.

Metabox output:

Metabox Output

2

1 Answer 1

1

Thanks guys.I did it with WP_Meta_Query (https://codex.wordpress.org/Class_Reference/WP_Meta_Query)

Solution:

<?php $query = new WP_Query( array( 
             'meta_key' => 'j4cob_yaz_ayarlar_show_on_slider_',
             'meta_value'   => 'show-on-slider',
             'posts_per_page' => 6
             ) ); ?>
   <?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
.
Loop
.
<?php endwhile; 
             wp_reset_postdata();
             else : ?>
            <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
          <?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.