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

Need help with adding custom menu content

For inject <span> into menu, you do it using below code: //Setup this code into your current function.php file add_filter(‘wp_nav_menu_items’,’add_span_in_menu’, 10, 2); function add_span_in_menu( $items, $args ) { if( $args->theme_location == ‘primary’) { $myContent=”YOURCONTENT” $items .= ‘<li><span class=”number”>’ . $myContent . ‘</span></li>’; } return $items; } Above snippet will add <span> with content to your … Read more