Display a custom 404 page without a redirect
Display a custom 404 page without a redirect
Display a custom 404 page without a redirect
Function get_template_part() load file only from theme directory (or child theme). There is no filter or action hook that would change this behavior. You will need to write your own get_template_part() variant to load files from the plugin directory (replace the locate_template() call from the original function). Or write an explicit: $query->the_post(); include plugin_dir_path( __FILE__ … Read more
do_action doesn’t trigger if it’s in a template that gets loaded via REST endpoint
Try this: if ( !is_home() && !is_cart() && !is_checkout() && !is_account_page() ) : if ( is_page( ‘contact-us’ ) ): get_template_part( ‘template-parts/header/header’, ‘map’ ); else: get_template_part( ‘template-parts/header/header’, ‘slider’ ); endif; endif; is_home() will return true if the current page/query is for the blog homepage, otherwise it returns false. You can read up about is_home() on the … Read more
Main – Loads a template part into a template. The function provides a mechanism for child themes to overload reusable sections of code in the theme. So you have always the right path, file and a solid chance for developers, other code to change the result. See also this solid answer to a similar question. … Read more
Are you wanting to replace the template file for the entire page or include a certain feature? As @JacobPeattie mentioned in the comments you may want to check out template hierarchy for replacing the whole template. The get_template_part() function can be used to include a template part into another file. I think that’s your use … Read more
What you’re looking for is get_stylesheet_directory(). get_template_part( get_stylesheet_directory() . ‘/modules/content/bevestiging.php’); This gives you the file path for the current theme.
how to use a different template (index.php) in wordpress
Ajax and get_template_part
The root problem here is a missing endif; on the second loop. But, there are a few changes we can make to improve this and make things work, this loop, will work a lot better: <h3>Other standards</h3> <div class=”row”> <div class=”col-12″> <?php $query = new WP_Query( [ ‘post_type’ => ‘page’, ‘post_parent’ => 27, ‘posts_per_page’ => … Read more