set default template on custom post

[ad_1]

Currently i have a code where i want to set a custom template on custom post and its working fine on my localhost but when i upload it on my host(digitalocean) it just use the single.php

function singlePage_template($template){
    if(is_singular( 'singleProduct' )){
        $template = locate_template(array('single-singleProduct.php'));
    }
    return $template;
}

add_filter('template_include', 'singlePage_template');

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer