Forums

Archive pages with register post types and custom post types (5 posts)

  1. Dave Redfern
    Member
    Posted 2 years ago #

    Hello all,

    I am experimenting with register post types with WordPress 3.0. I have managed to create a post and using the rewrite options i have created a permalink so it is podcast/article-name.

    I have also managed to create a custom template file to print out the information.

    This is all based on the brilliant article at http://kovshenin.com/archives/extending-custom-post-types-in-wordpress-3-0/.

    Normally with previous versions of WordPress these posts would belong to a category called podcast so an archive page is automatically called /podcast/. How can i create the same effect with register_post_type because currently going to /podcast it goes to a 404 despite there being an article at podcast/article-name?

    I understand I can have a wp_query which passes through the values but I'd need to create a page or something for that query to live at. I would prefer if an archive page could be automatically created to save having lots of empty pages in the wordpress admin.

    Many thanks

    Dave.

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Though not sure if it's the best solution, Jamie's code http://wordpress.pastebin.com/q2NtJZ7R supports visiting something like:
    http://localhost/wp30/manager/manager-1-title/

    Also see http://core.trac.wordpress.org/ticket/13197 for a potential problem with koveshenin's article.

  3. Dave Redfern
    Member
    Posted 2 years ago #

    Hello Michael,

    Thanks for responding. Not sure if I explained myself correctly. I have got the permalinks working to each individual articles but how do i get a page for the group of posts?

    Previously these would be assigned to a category which would then have a archive page. I'd like the same but for post types.

    I know I can create a page with a custom template but I was wondering whether there was any method similar to the way categories work?

    Thanks

    Dave.

  4. MichaelH
    Volunteer
    Posted 2 years ago #

    I was pretty sure that example allowed you to visit for example:
    http://localhost/wp30/manager

    [edit went back and tested and it doesn't allow that...sorry the url has to be something like: http://localhost/wp30/?post_type=manager ]

  5. MichaelH
    Volunteer
    Posted 2 years ago #

    Guess you could always create a page then access that post_type=xyz in a query either in a Page Template or using a plugin such as PHP Exec.

Topic Closed

This topic has been closed to new replies.

About this Topic