Unyson
Unyson copied to clipboard
File inclusion in shortcodes view.php
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 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?
My bad. Did not define 'wp_debug' true , That's why I did not see any error. LOL