WordPress.org

Ready to get started?Download WordPress

Forums

Custom Posts Types and Templates (4 posts)

  1. coopersita
    Member
    Posted 4 years ago #

    Hi all,

    I'm using WP3.0, and I'm very excited about the new Custom Post Types and Taxonomies support (I'm using GD Custom Posts And Taxonomies Tools), but I have some questions as to how they all tie in with templates.

    I understand from the codex, that "single-<posttype>.php" will work for posts posted in a particular post type, but what about archives for each post type? Do I just call my template "posttype.php", and it will work? I tried it but it didn't seem to work... Is it using "archive.php" by default?

    What I have done, which seems cumbersome, is to create a custom template with my custom query to load all posts that correspond to the specific custom type, and then create a page linked to the custom template...

    How come it's so easy to create the templates for the singles, but so hard for the archives?

  2. Kate6373
    Member
    Posted 4 years ago #

    This is a great question I'd like an answer to as well. Please help!

  3. coopersita
    Member
    Posted 4 years ago #

    I found this: http://www.ballyhooblog.com/custom-post-types-wordpress-30-with-template-archives/ but it didn't work for me...

    I also found this: http://somadesign.ca/projects/smarter-custom-post-types, which works like a charm, but it registers the posts as well as create the template support. I commented out the following line (around line 120) so it won't register the new post type:

    public function register_post_type() {
    	//register_post_type( $this->post_type, $this->args );
    }

    I'm not that familiar with the inner workings of WordPress to know what else to delete from the class to make it efficient, and still work, though.

  4. Jake Goldman
    10up Engineer
    Posted 4 years ago #

    If you're still struggling, I've put together a plug-in that, er, "plugs" this missing piece in WordPress 3.0.

    http://www.cmurrayconsulting.com/software/wordpress-custom-post-type-archives/

    Adds template files, permalink support, and some other tweaks for custom post type "archives."

Topic Closed

This topic has been closed to new replies.

About this Topic