0

For the Page post type: I can create a logout page in the CMS and create a page-logout.php for its template.

I created an Account post type but I can't use account-user-registration.php for a User Registration post under Account post type.

1

As Pages are a special built in Posttype, they get an own template hierarchy. Other "normal" post types and custom post types can only be templated by "single-$posttype.php". You can however hook into the single_template filter and make wordpress redirect to your template file:

function get_custom_post_type_template($single_template) {
     global $post;

     if ($post->post_type == 'account') {
          $located = locate_template( 'account-'.$post->post_name.'.php' );
          if ( !empty( $located ) ) {
                  return $located;
          }
     }
     return $single_template;
}
add_filter( 'single_template', 'get_custom_post_type_template' );

I didn't test this, but it should work ^^

Happy Coding,

Kuchenundkakao

-2

I use this: archive-{$post-type}.php

  • 2
    Please explain why this would help solve the situation. – kaiser Jul 24 '14 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.