if checked="checked" get_template_part('content','featured')

i have a custom post type called ‘our athletes’. on that custom post type is a custom metabox with several fields in it, one of which is checkbox called ‘featured’. if they check that box then i want the info to show up in the header.

i don’t know php very well, but tried this and got no where:

<?php $checkedfeatured = get_post_meta( get_the_id(), '_cmb_featured_checkbox', true ); if ($checkedfeatured) { get_template_part('content','featured'); } ?>

This post is a bit old now. It was read 500 times without a solution.

Did you solve it yet? If not maybe you can help us to help you.

First, what kind of template are you using ? WordPress? What is the name of the template?
There is a lot of help with templates all over the internet and we can help you better if we know
more about what you have set up already.

Let us know if you solve it or not. Maybe we can help further…

Try this…

if (post_type_exists(‘our athletes’)) {

               // checks your custom checkbox field
                if ((get_post_meta($post->ID, 'mini_readmore', true))=='featured') {
                   //include your header file here
                   
                }

}

Sponsor our Newsletter | Privacy Policy | Terms of Service