This problem has come up once before, but I found another way of dealing with the issue.
However, this time, it seems that I’m going to need to find a solution. I’ve set up a custom post type (more details later) – and I want the category and tags pages to sit at a URL in this frame.
So, I have “/portfolio/” and “/portfolio/my-portfolio-item1”, and I also want “/portfolio/tags/my-tag” and “/portfolio/categories/category-name”.
To achieve this, I’ve set up some re-write rules to redirect the request like so
1 |
RewriteRule ^portfolio/tags/(.*)/$ wp-content/themes/example-site/portfolio-tag-category.php?tag=$1 [L] |
So, whilst the page exists within the template folder, it doesn’t get activated under the usual structure of a WP page. This means things like the loop, categories, clouds etc are all in-accessable.
To counter this, just add the following lines to the top of (in this case) portfolio-tag-category.php
1 2 |
include('../../../wp-config.php'); global $wpdb, $table_prefix; |
Image Credit: kevin dooley
Comment or tweet @douglasradburn