| @@ -1,5 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- view template receives variables via extract(); prefixing is impractical. | |
| 3 | + | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 2 | 7 | use WPDeveloper\BetterDocs\Utils\Helper; |
| 3 | 8 | |
| 4 | 9 | $_defined_vars = get_defined_vars(); |
| 5 | 10 | $_params = isset( $_defined_vars['params'] ) ? $_defined_vars['params'] : []; |
| @@ -16,8 +21,12 @@ | ||
| 16 | 21 | 'post_query' => $post_query, |
| 17 | 22 | 'docs_list_title_tag' => isset( $_params['docs_list_title_tag'] ) ? $_params['docs_list_title_tag'] : 'h2' |
| 18 | 23 | ] |
| 19 | 24 | ); |
| 25 | + // Nested subcategories — emitted here (not inside the shared leaf template, | |
| 26 | + // which the block and Customizer archive layouts also use) so it stays | |
| 27 | + // scoped to this widget. Sibling after the grid, so it is not a grid cell. | |
| 28 | + $view_object->get( 'template-parts/archive-nested-categories', $_params ); | |
| 20 | 29 | } elseif ( isset( $_params['query_args'] ) ) { |
| 21 | 30 | $post_query = new WP_Query( $_params['query_args'] ); |
| 22 | 31 | $view_object->get( |
| 23 | 32 | 'template-parts/archive-doc-list', |
| @@ -25,8 +34,10 @@ | ||
| 25 | 34 | 'post_query' => $post_query, |
| 26 | 35 | 'docs_list_title_tag' => isset( $_params['docs_list_title_tag'] ) ? $_params['docs_list_title_tag'] : 'h2' |
| 27 | 36 | ] |
| 28 | 37 | ); |
| 38 | + // Nested subcategories for Layout 2 (scoped to this widget — see above). | |
| 39 | + $view_object->get( 'template-parts/archive-nested-categories', $_params ); | |
| 29 | 40 | } |
| 30 | 41 | |
| 31 | 42 | if ( isset( $pagination ) && $pagination ) { |
| 32 | 43 | $current_term = isset( $edit_mode ) && $edit_mode && isset( $widget_type ) && $widget_type == 'elementor' ? Helper::get_highest_docs_term() : ( isset( $_params['term'] ) ? $_params['term'] : '' ); |