• Hi again GDragoN,

    I am not sure this is a default WordPress 3.0 functionality, or if this is something to be handled by plugins.

    I have checked out this post about Smarter Custom Post Types in WP 3.0, and the author mentions that one can do the following:

    2.Custom landing page templates: if you registered “movie” as your post type, you can use movie/index.php or movie.php in your theme directory (falls back to index.php if they don’t exist)

    Now for the looks of it, it seems that he is explaining that his plugin allow such functionality, wich WP 3.0 doesn’t by default.

    Is there something similar we can do with your GD Custom Posts And Taxonomies Tools plugin? Or perhaps it is a core feature of WP 3.0?

    Well if it all depends of a plugin and yours doesn’t do it yet, consider it yet another suggestion then =)

    Just got the new version of your plugin today. Man you’re on fire.

    Thanks for your support!

    Regards,
    P.

Viewing 7 replies - 1 through 7 (of 7 total)
  • WP already uses template file for the custom post types. Plugin can’t actually create the file since it’s theme dependent, but for custom post type ‘movie’, you need ‘movie.php’ in the theme. It’s not the landing page, it has the same purpose as ‘single.php’ for posts and that will be fallback if the ‘movie.php’ is not found.

    My xScape Theme Framework based themes (3 themes released, all only premium) support custom post type templates, and if you use custom post types, xScape allows to create and use template for post type, all controlled from control panel. You can check out the demo for all the themes: http://xscape.info/ and try all of them for free including control panel.

    Milan

    Thread Starter pmdci

    (@pmdci)

    Milan,

    Actually, if you want a single.php for post-type movie, you need to create a page called single-movie.php, and NOT movie.php

    At least this is how I did it. I did create a single-partner.php and it works like a charm.

    My understanding is that movie.php would be a landing page when browsing the custom post-type.

    Reason why I was asking this is because something weird is going on. I have more than one custom post type, and I created a custom page for all of them such as page-partners.php. These templates are basically the same regarding their PHP functions and layout. The main difference between these pages are the are the arguments for query_posts() and some CSS.

    So I can browse my site like this:

    * /partners/
    * /cars/
    * hotels/
    * etc

    Now this is the funny bit. If I type in the URL not the page I created for them, I get redirected to the custom page, for all post types BUT ONE. Example:

    Type this: /car –redirects–to–> /cars
    Type this: /partner –redirects–to–> /partners
    Type this: /partner –redirects–to–> /

    How weird is that1?!? Since you are the custom taxonomy and post type king around here, I was wondering if you might have any idea of why this is happening 🙂

    I would really apreciate your help. As for your themes, they look amazing. But my client has an entire style guide that I have to follow, fixed with, concept of menu positions and all that. The design of the theme itself (the eye-candy) is 95% complete. If I tried to work with another theme from scratch it would be a nightmare. But I will sure consider your themes for my next projects.

    Regards,
    P.

    I was a bit puzzled by the question. You are right, single-____.php is used for custom post types. As for the use of folders as landing pages, that is not going to work as explained in the article, because it simply can’t, and the article is 100% wrong on that. But, the article describes the use of some custom class, so it’s possible that that class makes that happen, because, as I said WP can’t do it.

    If you want http://www.sample.com/movies/ to be your landing page you need to create movies folder in website root (and you can’t have movies page in WP), not theme folder, and put index.php in it to work as landing page. But that’s outside of the WordPress use and in that you can’t use WordPress directly without making that index.php to load everything on it’s own.

    I really hate such ad-hoc methods to make things to work outside the normal WP operation, because there is a way to make it with WP alone using pages with custom templates.

    Milan

    Thread Starter pmdci

    (@pmdci)

    Hi Milan,

    Thanks for your reply.

    That is my concern exactly.

    Somehow I managed to make index.php/hotel/ and index.php/partner/ (these being the “rewrite” of custom post types, point to index.php/hotels/ and index.php/partners/ (the custom page templates I created to handle these custom post types).

    However, for some reason I don’t know, if browse to index.php/car/ (another custom post type), it doesn’t redirect me to index.php/cars/ (the custom page template I created for this post type). Instead, it takes me back to index.php/

    Weird uh?

    It’s not wierd, it’s not proper rewrite to have file and than folder name after it. And as I said, I still prefer to use WordPress to do all than by using pages and custom templates.

    Thread Starter pmdci

    (@pmdci)

    Milan,

    I agree with you and this exactly what I am doing. I have never EVER created a directory or subdirectory anywhere called /partner or /partners.

    1. partner is my custom post type name, and so I thought that when browsing www.mysite.com/partner WordPress would show me such post types.

    2. partners is a page I created, which uses the template page-partners.php. This page I created is to only show posts of the type partner.

    I did the exact same process I described above for two other custom post types.

    Now, for some reason, when I browse to www.mysite.com/post-type-name (ex: http://www.mysite.com/partner), it redirects me to www.mysite.com/custom-page-for-post-type (ex: http://www.myite.com/partners).

    To be honest, I like this behaviour, and this works fine for EVERY post type I created, WITH THE EXCEPTION OF ONE which instead, when I browse to www.mysite.com/car, it redirects me to http://www.mysite.com/ (the root page).

    Now this is what I find odd, since all those page templates have almost the exact same PHP code and html layout. What changes is the CSS and some arguments of the query_aposts() function, so each page shows their related post type, in the order I want and so on.

    This is why I think it is weird…

    Thread Starter pmdci

    (@pmdci)

    Just for clarification and benefit of those that might step into this post:

    * single-<post-type-name>.php: Can be used for showing single posts from the custom post type <post-type-name>. For example, single-book.php would be used to display single posts from the post type book.

    * page-<page-name>.php: This template is used when viewing the page with the name <page-name>. For example, page-about.php would be displayed when a user visits the page named about.

    * <taxonomy-name.php>: Haven’t tested this one yet. But according to this post in the Codex, it can be used to display a customised page template when querying the taxonomy of name <taxonomy-name>. For example, when querying the taxonomy city, a custom template called city.php could be used.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: GD Custom Posts And Taxonomies Tools] template for /<post-type-name> – not sure this’ is closed to new replies.