Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have my custom post type set up with hierarchicy set to true and the url works like: Lions News › S1 › Test Post 1 which is nice except that it should go one futher and be like Lions Minis › Lions News › S1 › Test Post 1 Lions Minis being the parent page to everything. Is there a way to to set that up?

The following is my setup in functions.php

/** Custom Post Types for Lions News */
 $labels = array(
'name'                          => 'Lions News Categories',
'singular_name'                 => 'Lions Category',
'search_items'                  => 'Search Lions Categories',
'popular_items'                 => 'Popular Lions Categories',
'all_items'                     => 'All Lions Categories',
'parent_item'                   => 'Parent Lions Category',
'edit_item'                     => 'Edit Lions Category',
'update_item'                   => 'Update Lions Category',
'add_new_item'                  => 'Add New Lions Category',
'new_item_name'                 => 'New Lions Category',
'separate_items_with_commas'    => 'Separate Lions Categories with commas',
'add_or_remove_items'           => 'Add or remove Lions Categories',
'choose_from_most_used'         => 'Choose from most used Lions Categories'
);

$args = array(
'label'                         => 'Lions Categories',
'labels'                        => $labels,
'public'                        => true,
'hierarchical'                  => true,
'show_ui'                       => true,
'show_in_nav_menus'             => true,
'args'                          => array( 'orderby' => 'term_order' ),
'rewrite'                       => array( 'slug' => 'lions_news/lions_articles', 'with_front' => false ),
'query_var'                     => true
);

register_taxonomy( 'lions_articles', 'lions_news', $args );

register_post_type( 'lions_news', 
array(
    'labels'                => array(
        'name'              => __( 'Lions News' ),
        'singular_name'     => __( 'Lions News' )
        ),
    'public'                => true,
    'show_ui'               => true,
    'show_in_menu'          => true,
    'supports'              => array( 'title','editor','thumbnail','comments','revisions' ),
    'rewrite'               => array( 'slug' => 'lions_news', 'with_front' => false ),
    'has_archive'           => true
)
);
/** End custom Post Types */

Thanks!

share|improve this question
add comment

1 Answer

Take a look at this line: 'rewrite' => array( 'slug' => 'lions_news', 'with_front' => false ),

share|improve this answer
    
I went for the obvious and added 'rewrite' => array( 'slug' => 'lions-minis', 'lions_news', 'with_front' => false ), but no joy? Also tired variations of true and false but I got nothing –  Nsokyi Jul 15 '11 at 13:36
    
try 'with_front' => true –  kaiser Jul 15 '11 at 13:50
    
Tried and it had no effect? –  Nsokyi Jul 15 '11 at 14:19
    
Take a look at the Codex entry at the 'rewrite' part. –  kaiser Jul 15 '11 at 16:06
    
nope, I read it seems if you change the rewrite part to: 'rewrite' => array( 'pages' => 'lions-minis', 'lions_news', 'lions_articles', 'with_front' => true ), Then it should work but it stubbornly stays the same? –  Nsokyi Jul 18 '11 at 15:39
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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