Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

File inclusion in shortcodes view.php

Open webangon opened this issue 9 years ago • 2 comments

Is file inclusion (require,include) works in view.php?

I have owl slider but different styles. So based on backend shortcode options I am trying to render different views.But file inclusion seems does not work nor show any error.

I have switch condition in shortcode's view.php `switch ($type) {

    require get_template_directory() . '/template-parts/loop/list-img.php';

    break;

case "grid-two":
    
    require get_template_directory() . '/template-parts/loop/grid-two.php';

    break;					        
default:
    echo "Your favorite color is neither red, blue, nor green!";

}`

webangon avatar Mar 04 '17 16:03 webangon

@webangon Yes, file inclusion works fine in view.php, there was never a problem with that.

Are you sure that you're echoing HTML inside your list-img.php or grid-two.php?

andreiglingeanu avatar Mar 04 '17 16:03 andreiglingeanu

My bad. Did not define 'wp_debug' true , That's why I did not see any error. LOL

webangon avatar Mar 04 '17 16:03 webangon