0

I want to create my own custom page (gallery) tab like PAGES in the control panel. Its help me to organize the gallery pages under "Gallery" name. How can I do this? I can do this with custom posts but this time templates won't shown up. :/ Actually I want to exactly copy of the "Pages" and name it "Gallery". Then I create my custom pages under it. Hope you'll understand my problem.

0

This should fairly closely mimic "Pages".

function gallery_type_custom_init() {
    $args = array( 
        'public' => true, 
        'label' => 'Gallery',
        'capability_type' => 'page',
        'hierarchical' => true,
        'supports' => array( 
               'title', 
               'editor', 
               'thumbnail', 
               'excerpt', 
               'page-attributes', 
               'custom-fields' 
      )
    );
    register_post_type( 'Gallery', $args );
}
add_action( 'init', 'gallery_type_custom_init' );

If you need this to use your custom page templates, though, it won't work. That part is hard-coded for page post types only.

  • Thanks for response. I did this but as I said; when I did this page templates can't shows. I want to use this custom sections with my custom page template. How to integrate it? – android93 Jul 29 '13 at 0:07
  • And as I said, custom page templates only work with "page" post types. That is hard-coded into the WordPress core. It might be possible to hijack that functionality but you are better off using some other mechanism, like custom post meta. – s_ha_dum Jul 29 '13 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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