Custom Post Type Templates not working
-
I’m working with a custom post type called ‘portfolio’, and I’m trying to use custom post type templates to create an archive page and a single page for the post type. However, I’m unable to get either to work. When I visit the url for a post using the post type, I get the 404 page.
The post type is called ‘portfolio’, and the files are called ‘single-portfolio.php’ and ‘archive-portfolio.php’. I have flushed the permalink settings (rewrite rules). I’m running XAMPP on a Mac.
Code:
add_action('init', 'portfolio_register'); function portfolio_register() { $args = array( 'label' => __('Portfolio'), 'singular_label' => __('Projekt'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'has_archive' => true, 'rewrite' => true, 'supports' => array('title', 'editor', 'thumbnail') ); register_post_type( 'portfolio' , $args ); }
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Custom Post Type Templates not working’ is closed to new replies.