Support » Plugin: Custom Permalinks » [Plugin: Custom Permalinks] Issue with templates for Custom Post Type

  • Hey,

    I’m having issues with single post template for my custom post type after enabling Custom Permalinks plugin. It appears to be overwriting custom post type template single-{custom_post_type}.php and instead uses single.php.

    When I disable Custom Permalinks plugin everything works fine.

    Any ideas how to fix it or a way around to this problem would be appreciated.

    Thanks,
    Piotr

    http://wordpress.org/extend/plugins/custom-permalinks/

Viewing 1 replies (of 1 total)
  • If anyone would be interested here is a work around solution which I’m using for now.

    It’s a filter located in functions.php file, which overwrites default template file if the page has a ‘post’ type and URL includes custom-post-type slug.


    // Template selection
    function custom_template_include($incFile) {
    $url = $_SERVER['REQUEST_URI'];

    if ( (get_post_type() == "post") && (strpos($url, "/custom-post-type-slug/") !== false) ) {
    if (have_posts()) {
    $file = TEMPLATEPATH.'/single-custom-post-type.php';
    if (file_exists($file)) {
    $incFile = $file;
    } else {
    $wp_query->is_404 = true;
    }
    } else {
    $wp_query->is_404 = true;
    }
    }

    return $incFile;
    }
    add_filter('template_include', 'custom_template_include');

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Custom Permalinks] Issue with templates for Custom Post Type’ is closed to new replies.