1
votes

Asked on WordPress Development Overflow here first. The same question was asked here with no real response. They claim it's not possible but I have used plugins that accomplish this.

In WordPress I am having a problem figuring out how to use the default page post type templates in my custom post type and I think I am using the wrong search keywords everywhere because I having no luck...

I have a client that requested an "easy-to-maintain" method of displaying two other languages of their site. They said that a translator is out of the question because a lot of their context uses subtle slangs that only are used within certain communities of people.

I figured the easiest way to make a visible and friendly method of entry would be to accompany their current "pages" post type with two more of those language names. Problem is that their main "pages" post type has a drop down menu with a choice of four templates. I cannot seem to get their new post types to include these as well.

I have tried adding in the single-name.php and archive-name.php but this gives me only one of those four types, which is expected, I do understand that much. However, I have used plugins and themes that have custom post type templates in a drop down so I know its do-able. My post_type has all the usual stuff turned on i.e. ...

'capability_type' => 'page',
'hierarchical' => true,
'supports' => array('title','editor','custom-fields','page-attributes')

I also need to know if anyone who does know what to do here would suggest just simply making a custom meta box that looks for the page template stuff? Or is there a much smoother WordPress related function that I can use?

Any help would be appreciated greatly.

1

1 Answers

1
votes

Your problem is that you are confusing custom post types with custom page templates. If you have a custom post type of 'cars' then the template with the file name archive-cars.php will show all the cars posts and single-cars.php will show a single cars post.

You are asking about page templates. You can call those whatever you like, the important thing is that for them to appear in the page template dropdown you need to include a specific piece of code in the head of the template;

<?php
/*
Template Name: My Custom Page
*/

See the codex for more information;

http://codex.wordpress.org/Page_Templates#Custom_Page_Template