Ready to get started?Download WordPress


Custom Post Type Template Redirect
Why do you need this? (2 posts)

  1. Tammy Hart
    Posted 4 years ago #

    All you have to do is create a simple called single-POSTTYPE.php (ig, single-books.php), so why do you need this plugin?


  2. DavidPilcher
    Posted 4 years ago #

    The single-POSTTYPE.php option also works in child themes whereas the plugin only finds the file if it's in the main theme directory.

    You should use locate_template() instead of TEMPLATEPATH to make it available to child themes.

    Not the tidiest of code, but it works:

    $testing = locate_template(array($wp->query_vars["post_type"] . '.php'));
    if ( $testing <> "" ) {
    $cptdt_template = $testing;
    $testing = locate_template(array('t_' . $wp->query_vars["post_type"] . '.php'));
    if ( $testing <> "" )
    $cptdt_template = $testing;

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic