I am using Metabox to create metaboxes for Worpdress Post and it works like a charm. Now I have installed MetaBox Custom Post Type Extension for create CPT and it works good to. I have Types plugin installed for same purpose, create CPT so I can work either with Metabox or Types. I have created a CPT with slug publicity and I want to add some Metaboxes only to that CPT. How I can achieve this? I know how to create the Metaboxes using the plugin I just don't know how to make a difference between Wordpress post and this custom post type, perhaps by adding some conditional at functions.php and checking for post type slug and then including needed files but not sure and I need some push, any advice?

2 Answers 2


When defining your MetaBox before registering it, just set the PostTypes it is applicable for:

$f711_meta_boxes[] = array(
    'id' => 'details',
    'title' => __( 'Details', 'f711_theme' ),
    'pages' => array( 'publicity' ), // change this values
    'context' => 'normal',
    'priority' => 'high',
    'fields' => array(

            'name' => __( 'Fischi ist', 'f711_theme' ),
            'desc' => __( 'Jaja, Beschreibung', 'f711_theme' ),
            'id' => 'f711_is',
            'type' => 'select',
            'options' => array( __( 'gut', 'f711_theme' ), __( 'super', 'f711_theme' ))

if ( 'your_cpt' == get_post_type()) { ... }


if (is_singular( array('your_cpt'))) { ... }

is_singular() is only true when on a single post page. If you're on an archive page, you need is_post_type_archive('your_cpt') { ... }

Here's a list of useful WP Conditional tags.

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.