• Resolved niceandripe

    (@niceandripe)


    I’ve created two custom post types pretty much the same

    add_action('init', 'classifieds');
    
    function classifieds() {
    $args = array(
    'label' => __('Classifieds'),
    'singular_label' => __('Listing'),
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => true,
    'supports' => array('title', 'editor', 'thumbnail')
    );
    
    register_taxonomy( 'classifieds-category', 'classifieds',
    array(
    'hierarchical' => false,
    'label' => __('Categories'),
    'query_var' => 'classifieds-category',
    'rewrite' => array('slug' => 'classifieds-category' )
    )
    );
    
    register_post_type( 'classifieds' , $args );
    }

    and also

    add_action('init', 'directory');
    
    function directory() {
    $args = array(
    'label' => __('Directory'),
    'singular_label' => __('Listing'),
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => true,
    'supports' => array('title', 'editor', 'thumbnail')
    );
    
    register_taxonomy( 'directory-category', 'directory',
    array(
    'hierarchical' => false,
    'label' => __('Categories'),
    'query_var' => 'directory-category',
    'rewrite' => array('slug' => 'directory-category' )
    )
    );
    
    register_post_type( 'directory' , $args );
    }

    however if I use
    <?php echo $post_type ?>
    they both show the same – “directory” and i can’t seem to get “classifieds” for the classifieds posts?!

    ??

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘problem with post_type on custom post type’ is closed to new replies.