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

Danny G Smith dgs at riskiii.com
Thu Apr 29 23:55:28 UTC 2010


That never occurred to me to try.  Works perfectly now, and even makes sense why you have to do it.  Is there a WordPress function that I could put at the end of my script so that it would do it automatically.  I worry if I roll this into a script, it could be hard to explain to end users when they call it.  

Anyway, thank you, you completely knew what was wrong.


Danny G Smith
dgs at riskiii.com




On Apr 29, 2010, at 6:49 PM, ampt wrote:

> Did you regenerate the permalink structure?
> Try visiting the Permalinks page under Settings in the WP Admin, this
> will update the permalink structure. Then see if you can view your
> custom post.
> 
> 
> On 30 April 2010 05:26, Danny G Smith <dgs at riskiii.com> wrote:
>> 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
>>         )
>>      );
>>   }
>> }
>> 
>> 
>> 
>> _______________________________________________
>> wp-testers mailing list
>> wp-testers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-testers
>> 
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers



More information about the wp-testers mailing list