[wp-testers] new custom post types - problem viewing new custom post

Danny G Smith dgs at riskiii.com
Thu Apr 29 19:26:51 UTC 2010


I have created a new custom post based on the code I saw in a presentation by Aaron Brazell, but modified for my use.  I am going to create these types to be used with a jQuery slider to give me a rotated featured image, and more than one instance, as is currently available in current plugins.  

The problem, after I create the page, and click on "View Carousel Posts", I get a 404 page.  Can anyone see a problem this the code?

Now for the code for the custom post type:

$carousel = new Carousel;

add_action('init', array($carousel, 'carousel_tax'),  1);
add_action('init', array($carousel, 'carousel_type'), 2);

class Carousel {

   function __construct() {}
   function __destruct()  {}
   
   function carousel_type()
   {
      register_post_type('featured', array(                                          // first var is part of the permalink
         'label'                 => __('Carousel Posts', 'carousel-container'), // first var used in left hand menu
         'execute_from_search'   => true,
         'public'                => true,
         'capability_type'       => 'post',
         'hierarchical'          => false,
         'supports'              => array(
               'title',
               'excerpt',
               'editor',
               'thumbnail',
               'revisions',
               'custom-fields' 
               ),
         'taxonomies'            => array('post-tag', 'category', 'carousel-tax')
         )
      );
   }
   
   function carousel_tax()
   {
      register_taxonomy('carousel-tax', 'carousel-container', array(
         'hierarchical'    => false,
         'show_ui'         => true,
         'label'           => __('Page where Carousel Posts will show', 'carousel-container') // first shows up on  the page, second used to reference
         )
      );
   }
}





More information about the wp-testers mailing list