Can I set a global base path for get_template_part?
Can I set a global base path for get_template_part?
Can I set a global base path for get_template_part?
Using the get_template_part method within an mu-plugin not possible?
This is not possible, a PHP file can only contain a single page template. There is no way to combine the files.
You have assigned the queries result inside the first condition. So the values assigned to this variable “cm_offerta_post_figli” won’t be accessible inside the second elseif condition. Please put the below code on the top of First condition. It will work. <?php $cm_offerta_post_figli = new WP_Query( array( ‘post_type’ => ‘cm_offerta’, ‘post_parent’ => get_the_ID(), ‘order’ => ‘ASC’, … Read more
Load templates, pass arguments, and render output from functions.php
how to replace h1 entry title with h2 in category pages only
For which reasons can get_template_part’s $args fail to work? (WP 5.8.1 – PHP 7.4.23)
You are re-initializing your $x variable on every iteration of the loop. Maybe you want to move its initialization outside the loop? To get $x variable value in the content-right.php file you can declare it as global: global $x; $x = 0; while( have_posts() ) { the_post(); $x++; get_template_part( ‘content’, ‘right’ ); } Then you … Read more
From your comment: (formatted for brevity) The cute thing is I debugged that TEMPLATE_MODULE_DIR . ‘my-template.php’ and the path in a plugin’s subfolder is right in fact as I said in my post, with include_once it loads perfectly So because you said it’s in a plugin subfolder (in wp-content/plugins), then as I said in the … Read more
How to get all template files used for rendering a single post/page?