Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm stucked at some point developing my theme.

I created a custom posts types to support an image gallery. So far, it's working great (have a look on 'galeria' on psaikali.com). I registered this custom post type (register_post_type( 'artwork', $args )) and activated the 'page attributes' function, to define a different template for my posts ('supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes', 'custom-fields' )).

But it just shows the 'order' of the page, not the 'template selection' part. Does anyone knows what's wrong ? I did create the template file called single-artwork.php ...

Screenshot of the page attributes page I see : http://img213.imageshack.us/img213/5348/notemplate.jpg

Thanks for the help !

share|improve this question

2 Answers 2

well single-POSTTYPE.php is for the single view of that post type. Do you actually have a file my-custom-template.php which looks like this?

/*
Template Name: My Custom Template
*/

share|improve this answer

You should be able to create a single-your-post-type-name.php file and have it work. I currently have it working fine on 3 or 4 sites so if it's not working for you you're doing something wrong.

Based on your code sample single-artwork.php should work as a single page post template. You could also redirect on single.php with:

<?php
if( get_post_type() == 'artwork' ) {
include_once ( TEMPLATEPATH.'/path/to/template.php' );
} else {
include_once( TEMPLATEPATH.'/normal/template.php' );
}
?>

I'd prefer to see the single-posttype.php route since WordPress is doing the routing at a deeper level and it's always nicer to just use WordPress built in stuff.

share|improve this answer
    
Thanks for the answers, the single-artwork.php was not working, but now it is. I guess that last time, I had the single-artwork.php BUT no single.php. That's why it was redirecting to my index.php. Anyway it's working now ! –  Pierre Oct 27 '10 at 15:04
    
Glad I could help. If this worked then please accept the answer. –  curtismchale Oct 28 '10 at 1:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.