1

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?

4
  • 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. Jan 24, 2012 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, 2012 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! Jan 24, 2012 at 3:47
  • Yes, a migrated question will be automatically redirected
    – mrtsherman
    Jan 24, 2012 at 3:49

1 Answer 1

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.

1
  • 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. Jan 25, 2012 at 2:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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