Support » Plugin: Social Feed Gallery » template path file load bugfix

  • Resolved Lana Codes

    (@lanacodes)


    I think the template_path() method in QLIGG_Frontend class in frontend.php is not working properly.

    You do it this way:
    – check theme directory
    – check plugin directory

    But this way you can’t load file from the theme. Because files are always available in the plugin.
    So the plugin template file always overwrites the theme template file.

    So you have to change the order to function correctly:

    – default check plugin directory
    – check theme directory

    Properly working code:

    function template_path( $template_name, $template_file = false ) {
    
       if ( file_exists( QLIGG_PLUGIN_DIR . "templates/{$template_name}" ) ) {
          $template_file = QLIGG_PLUGIN_DIR . "templates/{$template_name}";
       }
    
       if ( file_exists( trailingslashit( get_stylesheet_directory() ) . "insta-gallery/{$template_name}" ) ) {
          $template_file = trailingslashit( get_stylesheet_directory() ) . "insta-gallery/{$template_name}";
       }
    
       return apply_filters( 'qligg_template_file', $template_file, $template_name );
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘template path file load bugfix’ is closed to new replies.