0

I installed a theme called "The Dawn". It supports the addition of new type of post and a taxonomy. Here's the code:

register_post_type('portfolio', array(  
    'description' => 'TheDawn Portfolio',
    'show_ui' => true,
    'menu_position' => 5,
    'menu_icon' => get_bloginfo('template_directory') . '/images/admin/portfolio.png',
    'exclude_from_search' => false,
    'labels' => array(
        'name' => 'Portfolio',
        'singular_name' => 'Portfolio Item',
        'add_new' => 'Add Portfolio Item',
        'add_new_item' => 'Add New Portfolio Item',
        'edit' => 'Edit Portfolio Item',
        'edit_item' => 'Edit Portfolio Item',
        'new_item' => 'New Portfolio Item',
        'view' => 'View Portfolio Item',
        'view_item' => 'View Portfolio Item',
        'search_items' => 'Search Portfolio Items',
        'not_found' => 'No Portfolio Items found',
        'not_found_in_trash' => 'No Portfolio Items found in Trash',
        'parent' => 'Parent Portfolio Item',
    ),
    'supports' => array('title', 'editor', 'comments', 'excerpt', 'custom-fields', 'revisions', 'thumbnail', 'author', 'page-attributes'),
    'public' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => false,
    //'rewrite' => array('slug' => 'portfolio', 'with_front' => true),
    'taxonomies' => array( 'post_tag' ),
    ) 
);

register_taxonomy( 'portfolios', 'portfolio', array( 'hierarchical' => true, 'label' => 'Portfolio Categories', 'query_var' => true, 'rewrite' => false ) );    

This works fine ... but I do not know what to put in the htaccess. Indeed, base, there is no url rewriting (rewrite => false). So I have URLs like this: my-site /?portfolio=my-item.

I find it very ugly. So I forced rewrite (rewrite => true): urls are generated my-site/portfolios/my-item. Except that now, if I click on my menu ... Wordpress generates 404.

I guess I need to change the htaccess. What should I put?

thank you

  • 1
    Try going to your settings-->permalinks and hitting "Save" . WordPress is not aware of the code change you made until it refreshes the permalinks. – Wyck Oct 20 '11 at 15:36
  • @Wyck +1... Go to permalinks and hit save. This will solve your 404 issue. – Rutwick Gangurde Oct 20 '11 at 16:01
  • Yes, it works ! Thank you ! Create a answer and I vote for you =) – Raphaël Oct 20 '11 at 16:09
0

Try going to your settings-->permalinks and hitting "Save" . WordPress is not aware of the code change you made until it refreshes the permalinks.

Adding this^ so you can close this Question.

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.