• Resolved headonfire

    (@headonfire)


    This is the first time I’m working with WP_Rewrite, I’ve studied Codex pages and some tutorials, but still missing the point. Any help would be much appreciated.

    I’m building pretty complex site, it will have different sections, one of which – ‘News’ is native WordPress post type ‘post’ with native categories and tags, and other sections are custom post types with own custom taxonomies.

    Here’s the URL structure I need:

    example.com/ – magazine-style home page, uses home.php theme template.
    example.com/news/ – default WP blog (built-in ‘post’ post type), list of all posts (index.php template)

    example.com/news/%category%/ – (preferred) or
    example.com/news/category/%category%/ – category archive

    example.com/news/%category%/%postname%/ – (preferred) or
    example.com/news/category/%category%/%postname%/ – single post

    example.com/news/tag/%tag%/ – tag archive (filter)

    And the same logic for custom post types, for example, Events with own custom taxonomies – categories and types:

    example.com/events/ – events archive (index)
    example.com/events/%category%/ – events category archive
    example.com/events/%category%/%eventname%/ – single event
    example.com/events/%type%/ – events type archive (filter)

    How can I achieve this?

Viewing 1 replies (of 1 total)
  • Thread Starter headonfire

    (@headonfire)

    Ok, support seems to be unavailbale… Meanwhile I figured everything out.

    To get the ‘news’ part done just use permalinks settings /news/%category%/%postname%/. For other post types and taxonomies it’s just a matter of proper use of add_permastruct, add_rewrite_rule and other native functions. It is pretty difficult topic for those trying to do this for the first time, needs a lot of testing. And Codex articles aren’t very descriptive. But once you understand how it works you feel yourself the Lord of URLs =)

Viewing 1 replies (of 1 total)
  • The topic ‘Changing permalink structures via WP_Rewrite’ is closed to new replies.