Change menu based on page template via functions.php

The $args the filter is receiving includes the theme_location used when the menu was registered, so assuming your main location is primary, you can add the following to your if statement to target only that menu: if ( is_page_template( ‘page-template-custom.php’ ) && isset( $args[‘theme_location’] ) && ‘primary’ === $args[‘theme_location’] ) ) { … See: https://developer.wordpress.org/reference/hooks/wp_nav_menu_args/ … Read more

wc_get_template new template does not showing up

plugin_dir_path( FILE ) will return the current directory. Not sure where you call this q343_get_template() function if it’s on a subdirectory then plugin_dir_path( FILE ) is returning that subdirectory path. From WordPress Code Reference https://developer.wordpress.org/reference/functions/plugin_dir_path/ The “plugin” part of the name is misleading – it can be used for any file, and will not return … Read more

does wp function the_content(); accept another tag inside

Why do you want to put your code between the braces in the_content()? What are you trying to accomplish? Maybe this solves your problem? <?php $custom_attach = get_post_meta( get_the_ID(), ‘wp_custom_attachment’, true ); $name=”button”; if(!empty($custom_attach)) { echo ‘<span class=”icon-download”>’; echo ‘<a href=”‘.$custom_attach[‘url’].'”>’.$name.'</a>’; echo ‘<span>’; } the_content(); ?> This echoes the <span> -element with the class icon-download … Read more