I have moved into WordPress for a few days and was quite impressed by all the available features, plugins and polished themes. I have spent quite some times reading documentation about themes and custom types. So far so good... Now that I'm trying to do real things, it seems (but I maybe missing something) that WP has some sever limitations.
I want to come up with a classical ISV site. A typical hierarchy would be:
- -- Product A
- ---- Overview
- ---- Release History
- ------- Release 1.5
- ------- Release 1.4
- ------- Release 1.3
- ------- etc.
- ---- Features
- ---- etc.
- -- Product B
- ---- Overview
- List item
Focusing on Release History, I came up with:
- a custom content type: "releases".
- a custom taxonomy to specify the product associated with a specific "release".
- I created a template to display the list of "releases".
- Created a single-release.php to display the detail of a release.
- Created a page based on my template.
The page URL that display the list of "releases" will basically fit into the hierarchy (/products/product-a/release-history/). However the URL of the custom post type will be something like: /%post_type%/%post_slug%/ (ie: /releases/version 1.2/
I'm struggling for 2 days trying to find a solution for coming with a coherent URL scheme.
I have tried to use to use Custom post permalinks plugin to come up with an URL that would include my custom taxonomy representing the product (better than nothing even if it's not perfect) but for some reason the plugin doesn't work on my side.
Overall, unless I'm missing something, Custom Post Types sound great but are quite a nightmare if you don't have a flat structure. I would certainly have preferred a concept of custom content type that is not URL dependant or an easy way to plug a custom post type at any level in the page hierarchy.
That said, I may be completely missing the point. Does anybody have any idea, experience when setting up a site with this kind of hierarchy? Any help appreciated...
Not completely sure what are the conventions when updating here but I will leave the initial text for clarity purposes. The purpose of this update is to clarify and add further details.
Created a WP page 'Products' - no parent - URL: http:///products/
Product A (specific product)
Created a WP page 'Product A' - parent: 'Products' - URL: http:///products/product-a/
Created a WP page 'Overview' - parent: 'Product A' - URL: http:///products/product-a/overview/
Releases (list of release for the specific product )
Created a WP page 'What's New' - applied a template that displays a list of all available releases (each release has a link to display the detail of that specific release) - parent: 'Product A' - URL: http:///products/product-a/product-releases/.
Releases are implemented using a custom type (see below). It was therefore quite easy to implement the template and link to release permalink. Though I haven't implemented it yet, my idea was that the template would display the release list for any product based on a taxonomy (product-id) defined at the page level. I could therefore have another page using the same template that would display the releases for another product by having the proper 'product-id' taxonomy attached to this other page.
Release (detail of a release)
Releases are implemented using a Custom Post Type (let's call it 'product-release'). In addition, I'm using a custom Taxonomy (product-id) to attach each release to a specific product (obviously, I don't want to create another Custom Post Type for the releases related to another product).
Created a 'single-product-release.php' file to display a specific release. The problem with this approach is that a specific release will be displayed with the following URL:
- It's not really descriptive, the least we can say (I should at least get some product identifier in the url)
- it somewhat breaks the hierarchy (though one could certainly argue regarding if it's wrong or not)
My Options (as far as I can see as a WordPress newbie)
Get rid of the permalink stuff
Maybe I could display the detail of a release using some template and passing some argument in the URL. I could use this template with a page that would go exactly where I want in the hierarchy.
Obviously not an approach I would follow ... for many reasons I won't detail here (that's already a long post/question).
Find a way to append (or rather prefix) my 'product-id' value to the Custom Post Type permalink
We could have something like http:///product-a/product-releases/release-x. I would have to accept that releases live somewhat outside of the 'natural' hierarchy which would be http:///products/product-a/product-releases/release-x.
I could go even further by prefixing with 'products' - something like /products/%product-id%/%product-release%/. However, I'm wondering if this Rewrite Rule would not clash with the 'pages' created under the 'products' page...
Any input appreciated.
I implemented the approach proposed by bobdiaes. This works fine for my content type however this will clash with the WP pages that are mixed in the hierarchy.
Using bobdiaes piece of code, I came up with the following Permaling for my product-release custom post type:
I will therefore have the proper product URL for displaying the detail of a release for a specific product. ie:
However, I want to have some WP pages in the mix:
/products/my-great-product/should provide an overview of the product.
/products/my-great-product/product-releases/should display the list of releases + the details of the latest release.
At first, it sounds quite natural to create WP pages to do what I need. I will organize my page hierarchy so that the pages fit in the exact URL scheme. However, this approach will clash with the URL rewriting used for the "product-release" Custom Content Type and I won't be able to browse the pages (404).
Well, well, well...
So what are my options now
Give up the idea of using WP
Well, I think I'm going to insist some more. Beside this problem, there are many things to like with WP.
Use Pod CMS
Though I haven't tested it yet. It sounds like a nice framework/tool. However, I would loose the ability to easily translate my content using WPML.
The fact that they will be able to use custom post types rather than their own table in version 2.0 will certainly let them rely on current plugins for translation purposes. What they are preparing for version 2.0 sounds interesting. They will be able to use Custom Post Type instead of their own tables.
Pod CMS 2.0 could be THE SOLUTION.
Using WP pages instead of a 'product-release" Custom Post Type
The idea here would be to create a page for each product release (with product-releases page as the parent). I suppose it must be easy to loop through child pages for displaying the list of releases.
Obviously, it has quite some drawbacks:
- The current admin page interface may not be very practical to handle hundreds of pages...
- Because the page is already a specialized Custom Post Type (as far as I understand), I would have to remember the specific custom fields I need each time I use a page like a pseudo-content type unless I want to create all fields that may be needed all over the web site. Quite an horrible solution if you ask me.
Replace WP pages by some Custom Post Type
Not sure about the possible rewrite rules clash but here is the idea. Instead of having an overview page, I could come up with a 'product-overview' Custom Post Type and use a permalink rewriting rule the same way I did for 'product-release' Custom Post Type. Will update with my findings.
I'm sure I'm not the only facing this WordPress URL hell. Though I have to admit that the Generalisation of a "post" into a custom post type is quite clever, the permalink stuff comes with its own constraints.
A word of caution - being new with WP, I may have overlooked something completely obvious
Well, as frustrating as it may be, it seems that this is just impossible. Well there is certainly a solution that involves some tricky URL rewriting but certainly nothing trivial for an approach that is however quite common.
Basically, I believe at this stage, that one should tie to a rather simple URL scheme. Will try the wordpress forum, but I don't have much hope.