I created a custom category template for a custom post type by using a base-[category].php calling category-[category].php for the category template.
All of that works fine but if you click on a post the content that shows is the content from the category content. So it doesn’t show what should be in the single content. It shows the content from the loop in the category.
What is the best way about creating custom category templates and custom post templates for custom post types?
I have created a custom post type Partnersearch (with archive).
to customize the singel I created single-partnersearch.php and now I want to customize the archive partnersearchpage.
I made archive-partnersearch and this works but it doesn’t target the base.
base-archive-partnersearch.php is a 3 column structure and base 2 column
as you can see its still using base
http://urbaneurope.studio-pit.nl/partnersearch/
Nick thanks for the help so far, your suggestions are a little bit out of my league.
Is it too much to ask you to take a look at my files? I’m not sure if this is the appropriate setting to ask, but I could use some more help.
Put the following in your lib/custom.php or functions.php file. It will print out what templates you are using in the footer, which may help you out.
// Bug testing only. Not to be used on a production site!!
add_action('wp_footer', 'roots_wrap_info');
function roots_wrap_info() {
$format = '<h6>The %s template being used is: %s</h6>';
$main = Roots_Wrapping::$main_template;
global $template;
printf($format, 'Main', $main);
printf($format, 'Base', $template);
}
The files are unlikely to help much. The directory structure may help. The base file and the archive file both need to be in the root.
I changed the structure and deleted the custom posttype. I have made two categories projects and partnersearch.
I created single-projects how can i target the base I tried base-single-projects but no results don’t know if it works that way for singles?
The WordPress template hierarchy doesn’t support the single-{$category}.php format so you’ll need a function to do that for you. You should be good to go when that’s set up; the wrapper always prepends base- to the template selected by WordPress.