WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Associate a page or post type with a template

[Resolved] Associate a page or post type with a template

Viewing 5 replies - 1 through 5 (of 5 total)
  • Well, there’s no way that we can predict anything about your layout/theme and that’s a very important thing. We can’t by any means be sure that we wouldn’t break your site’s layout.

    If you check out http://codex.wordpress.org/images/1/18/Template_Hierarchy.png, you’ll see that CPTs will use files like archives.php/single.php if you don’t have a more specific file for the Post Types. If you don’t have either of those, which you really should, it’ll use index.php.

    Thanks Michael,

    Don’t get me wrong – I love this plugin! I’ve just recently been using a separate plugin (formidable) to publish 200 pages at a time and they are all using the default page template versus the fullwidth page I want them to have.

    Ideally I’d like to be able to say use single.$posttype.php and create a different template for my theme for each content type…

    Ok if that’s not possible are you saying that I could specify a particular cpt to use say archives.php versus single.php for example – could I modify one of the other standard templates to be fullwidth i.e archives.php and tell the plugin to use that by default?

    Thanks again 🙂

    Rich

    archives.php is the default template file to show the posts listing, similar to index.php with your blog posts. They’ll be shown in order by post date, newest to oldest. Unlike the “post” post type, it just uses archive.php first. Same idea with single.php, for single instances of posts in the post type. There won’t be anything to tell the plugin, it’ll just happen automatically.

    If you want different layouts for both the archive and the single view, you’ll need to specify/create the single-$posttype.php and archive-$posttype.php files yourself. At that point, they’ll be used first for your CPTs

    Hi,

    I had no idea it was that simple. Is this mentioned somewhere in the plugin and I’ve missed it then apologies. If not, I really think you should make this obvious – it’s such a great feature :). I’ve been wanting to do this for months but had no idea where to even start.

    Thanks for your response and again, thanks for a superb plugin!

    Rich

    I can add an enhancement issue on github to explain some of this more in the FAQ section.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Associate a page or post type with a template’ is closed to new replies.