Using ‘get_template_directory_uri’ correctly

get_template_directory_uri(), as the name suggests, gets the URI of the theme. You want the filesystem path, which is get_template_directory(): <?php require get_template_directory() . ‘/woocommerce/single-product/test.php’ ?> Better yet, use the WordPress template loading system: <?php locate_template( ‘woocommerce/single-product/test.php’, true /* Locate AND load the file */ ) ?>

Access meta box checked value in another file

You haven’t quite got a grip on the switch statement, read up here. $template = get_post_meta( get_the_ID(), ‘_my_theme_post_template’, true ); switch ( $template ) { case ‘template-2’: get_template_part( ‘inc/post-loops/template-1’ ); break; case ‘template-1’: get_template_part( ‘inc/post-loops/template-2’ ); break; default: // Neither values matched, do something else? break; }

footer menu changes primary menu

Your argument is wrong. It is theme_location not theme-location. The underscore matters. Also, what you are doing with esc_html__() is overly complicated. You aren’t passing HTML through the function, and I am fairly sure you never should pass HTML for this, just a string. All you need is __()

How can I include the js and css file of my custom theme dynamically in header.php

I guess you wanted to enqueue all the files in your css and js directory of your theme. Thats the reason you are trying to use the scandir(). get_template_directory_uri() returns URL not the directory path. You need to use get_template_directory() for directory. If you wanted to do that, then do it in functions.php function enqueue_all_front_resources(){ … Read more