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'm trying to create this page structure within WordPress:

- Home                (http://example.com/)
- Blog                (http://example.com/blog/)
  - Blog Post         (http://example.com/blog/blog-post-name/)
- Projects            (http://example.com/projects/)
  - Projects Post     (http://example.com/projects/project-post-name/)

Following the WordPress Codex guide Making Your Blog Appear in a Non-Root Folder I'm able to create this structure:

- Home                (http://example.com/)
- Blog                (http://example.com/blog/)
  - Blog Post         (http://example.com/blog/blog-post-name/)

But not the "Projects" section. The Codex documents how to move where your blog sits, but not handle different post types in this way.

I'm trying to achieve "Blog" page as the index of all "Blog Post" posts, and "Projects" page the index of all "Project Post" posts.

share|improve this question
    
How do you register the post type? Please add that code to your question. –  toscho Jan 11 '13 at 23:06
    
I haven't set up my post types yet, since I assumed the best way to do it would be based on the way these pages were set up. Any recommendations on that would be appreciated. –  AlecRust Jan 11 '13 at 23:08

1 Answer 1

Set your regular permalinks to

/blog/%postname%/

Register your custom post type with has_archive => TRUE and with_front => FALSE.

Example:

add_action ( 'init', 'register_project_cpt' );

function register_project_cpt()
{
    register_post_type(
        'projects',
        array (
            'has_archive'          => TRUE,
            'hierarchical'         => TRUE,
            'public'               => TRUE,
            'publicly_queryable'   => TRUE,
            'rewrite'              => array (
                'slug'       => _x( 'projects', 'slug', 'text_domain' ),
                'with_front' => FALSE
            ),
            'show_in_nav_menus'    => TRUE,
            'show_in_menu'         => TRUE,
            'show_in_admin_bar'    => TRUE,
            'show_ui'              => TRUE,
            'supports'             => array(
                'author',
                'comments',
                'editor',
                'excerpt',
                'page-attributes',
                'revisions',
                'thumbnail',
                'title',
            )
        )
    );
}

In wp-admin/options-reading.php choose a page for the blog post archives, that will be used on /blog/ then.

enter image description here

share|improve this answer
    
Thanks for that. I've set the permalinks "Custom Structure" to /blog/%postname%/ and set the reading settings to Front page: Home and Posts page: Blog, however the "Project" post type isn't showing up in the Admin Panel after pasting your provided code in to functions.php –  AlecRust Jan 12 '13 at 0:23

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.