• Hi to all
    I try many different way to register multiple post type, one works, the second no and I can’t spot why!

    My last test was about:
    require_once('portfolio-type.php'); on functions.php file

    -in portfolio-type.php I put the double registration like that:

    if ( function_exists( 'add_theme_support' ) ) {
        add_theme_support( 'post-thumbnails' );
        set_post_thumbnail_size( 280, 210, true ); // Normal post thumbnails
        add_image_size( 'screen-shot', 720, 540 ); // Full size screen
    }
    
    add_action('init', 'genera_post_type'); 
    
    function genera_post_type(){
    
    	portfolio_register();
    
    }
    
    function portfolio_register() {
        $args = array(
            'label' => __('Portfolio'),
            'singular_label' => __('Project'),
            'public' => true,
    	'has_archive'=>true,
            'show_ui' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
    	'show_in_menu' => true,
    	'show_in_nav_menus'   => true,
            'rewrite' => true,
            'supports' => array('title', 'editor', 'thumbnail')
           );  
    
     $args2 = array(
            'label' =>'Ideas',
            'singular_label' => 'Idea',
            'public' => true,
    	'has_archive'=>true,
            'show_ui' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
    	'show_in_menu' => true,
    	'show_in_nav_menus'   => true,
            'rewrite' => true,
            'supports' => array('title', 'editor', 'thumbnail')
           );  
    
        register_post_type( 'idea' , $args2 );
        register_post_type( 'portfolio' , $args );
    }

    For portfolio I got no problem, everything is correct.
    For Idea post type everything works but when I try to visit a generated post I always see a 404 error of page not found.
    I try to add single-idea.php or not, but same result in both case, I try to register the post in different context but same result…
    How can I solve this?
    Many thanks in advance

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘multiple post type registration’ is closed to new replies.