'content/post-lists/headings/archive_heading' ) ); elseif ( czr_fn_is_registered_or_possible( 'search_heading' ) ) czr_fn_render_template( 'content/post-lists/headings/regular_search_heading' ); endif; do_action( '__before_loop' ); if ( ! czr_fn_is_home_empty() ) { if ( have_posts() && ! is_404() ) { //Problem to solve : we want to be able to inject any loop item ( grid-wrapper, alternate, etc ... ) in the loop model //=> since it's not set yet, it has to be done now. //How to do it ? //How does the loop works ? //The loop has its model CZR_loop_model_class //This loop model might setup a custom query if passed in model args //this loop model needs a loop item which looks like : // Array = 'loop_item' => array( // ( // [0] => modules/grid/grid_wrapper // [1] => Array // ( // [model_id] => post_list_grid // ) // ) // ) // A loop item will be turned into 2 properties : // 1) 'loop_item_template', // 2) 'loop_item_args' // //Then, when comes the time of rendering the loop view with the loop template ( templates/parts/loop ), we will fire : //czr_fn_render_template( // czr_fn_get_property( 'loop_item_template' ),//the loop item template is set the loop model. Example : "modules/grid/grid_wrapper" // czr_fn_get_property( 'loop_item_args' ) <= typically : the model that we inject in the loop item that we want to render // ); //Here, we inject a specific loop item, the main_content, inside the loop //What is the main_content ? //=> depends on the current context, @see czr_fn_get_main_content_loop_item() in core/functions-ccat.php czr_fn_render_template('loop'); } else {//no results if ( is_search() ) czr_fn_render_template( 'content/no-results/search_no_results' ); elseif ( is_404() ) czr_fn_render_template( 'content/no-results/404' ); } }//not home empty /* * Optionally attached to this hook : * - In single posts: * - Author bio | 10 * - Related posts | 20 * - In posts and pages * - Comments | 30 */ do_action( '__after_loop' ); ?>