• I create a plugin with custom post type (Ex: portfolio, TESTIMONIAL,…), And I create file single-portfolio.php and taxonomy-portfolio.php on plugin but it doesn’t working, if I create File on theme location it work very well. Thanks your support!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey,

    WordPress Plugin doesn’t work like themes. Follow the link may it will help you.
    https://developer.wordpress.org/plugins/the-basics/best-practices/

    Thanks

    • This reply was modified 9 years, 4 months ago by Poonam Namdev.
    Moderator bcworkz

    (@bcworkz)

    WP does not search plugin folders for templates. For WP to find them, the template must be in the active theme’s folder. In order to cause WP to use plugin templates, use the ‘template_include’ filter to specify your plugin template be used when appropriate. Return the full path to the file, which can be in part determined with plugin_dir_path().

    Determining when your template is appropriate to use could be a challenge. I suggest you try examining elements in the object returned by get_queried_object() to determine if it’s appropriate to use your plugin template.

    Thread Starter aminor1993

    (@aminor1993)

    Yeah ! I did, Thanks you guys !

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘The template in plugin doesn’t woking’ is closed to new replies.