WC_Template_Loader::comments_template_loader( string $template )

Load comments template.


Description Description


Parameters Parameters

$template

(Required) template to load.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-template-loader.php

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
public static function comments_template_loader( $template ) {
    if ( get_post_type() !== 'product' ) {
        return $template;
    }
 
    $check_dirs = array(
        trailingslashit( get_stylesheet_directory() ) . WC()->template_path(),
        trailingslashit( get_template_directory() ) . WC()->template_path(),
        trailingslashit( get_stylesheet_directory() ),
        trailingslashit( get_template_directory() ),
        trailingslashit( WC()->plugin_path() ) . 'templates/',
    );
 
    if ( WC_TEMPLATE_DEBUG_MODE ) {
        $check_dirs = array( array_pop( $check_dirs ) );
    }
 
    foreach ( $check_dirs as $dir ) {
        if ( file_exists( trailingslashit( $dir ) . 'single-product-reviews.php' ) ) {
            return trailingslashit( $dir ) . 'single-product-reviews.php';
        }
    }
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.