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've been learning about custom post types from Morten Rand-Hendriksen's great tutorial on making a WordPress portfolio theme on lynda.com. He demos how to set up a custom taxonomy for "recipes" and create links like domain.com/?recipes=post-title. I think this is really cool because you get a post-title with the contextual clue of "recipes" without being stuck with a bunch of nested hierarchical subdirectory archives that may be boring to look at and contain repetitious content.

For a large, multifaceted domain, I think it would be neat if there is a way to make a site behave as it has a permalink structure like this: domain.com/%post_type%/%postname%/ for posts and custom post types, while staying with domain.com/page-name for pages.

I'm thinking of domain.com/blog/post-name for anything in the blog, though domain.com/?blog=post-title would still work.

What do you think, and what is the most practical way to go about this?

share|improve this question

migrated from stackoverflow.com Jan 24 '12 at 9:18

This question came from our site for professional and enthusiast programmers.

    
I am brand new here. Should I delete and re-post there? My first choice would be to avoid a plugin, since I'm mucking around in there trying to learn the code anyway. –  Elizabeth Able Jan 24 '12 at 3:41
    
I have flagged it to be migrated, but you would have to wait for moderator to pay attention. I would repost at the wordpress site and if this one gets migrated delete it. People get cranky if they think it's a double post. If that happens just explain politely why you have two similar posts. –  mrtsherman Jan 24 '12 at 3:42
    
I'd already shared this link via FaceBook. If migration comes w/ a redirect on this link (?), I can wait. Thanks much! –  Elizabeth Able Jan 24 '12 at 3:47
    
Yes, a migrated question will be automatically redirected –  mrtsherman Jan 24 '12 at 3:49
add comment

1 Answer 1

When you're registering a custom post type in WordPress, one of the arguments is 'rewrite', which allows you to set up a slug for your custom post type. In your example above, you would set the rewrite argument to 'rewrite' => array('slug' => 'recipes') to create a URL structure like http://example.com/recipes/general-tsos-chicken

You can also add custom post types with a plugin like Custom Post Types UI. That plugin has a field in the advanced options for adding a rewrite slug.

share|improve this answer
    
last night I looked over the code from Morten Rand-Hendriksen's tutorial and found (d'oh!) 'rewrite' => array('slug' => 'recipes') and got new custom post types running with the slugs I want. I haven't found all the labels and whatnot yet, but I will. –  Elizabeth Able Jan 25 '12 at 2:07
add 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.