Automattic\WooCommerce\Blocks\BlockTypes
ClassicTemplate::render_archive_product() │ protected │ WC 1.0
Render method for the archive product template and parts.
Метод класса: ClassicTemplate{}
Возвращает
Строку
. Rendered block type output.
Использование
// protected - в коде основоного (родительского) или дочернего класса
$result = $this->render_archive_product();
Код ClassicTemplate::render_archive_product() ClassicTemplate::render archive product
WC 9.3.3
<?php
protected function render_archive_product() {
ob_start();
/**
* Hook: woocommerce_before_main_content
*
* Called before rendering the main content for a product.
*
* @see woocommerce_output_content_wrapper() Outputs opening DIV for the content (priority 10)
* @see woocommerce_breadcrumb() Outputs breadcrumb trail to the current product (priority 20)
* @see WC_Structured_Data::generate_website_data() Outputs schema markup (priority 30)
*
* @since 6.3.0
*/
do_action( 'woocommerce_before_main_content' );
?>
<header class="woocommerce-products-header">
<?php
/**
* Hook: woocommerce_show_page_title
*
* Allows controlling the display of the page title.
*
* @since 6.3.0
*/
if ( apply_filters( 'woocommerce_show_page_title', true ) ) {
?>
<h1 class="woocommerce-products-header__title page-title">
<?php
woocommerce_page_title();
?>
</h1>
<?php
}
/**
* Hook: woocommerce_archive_description.
*
* @see woocommerce_taxonomy_archive_description() Renders the taxonomy archive description (priority 10)
* @see woocommerce_product_archive_description() Renders the product archive description (priority 10)
*
* @since 6.3.0
*/
do_action( 'woocommerce_archive_description' );
?>
</header>
<?php
if ( woocommerce_product_loop() ) {
/**
* Hook: woocommerce_before_shop_loop.
*
* @see woocommerce_output_all_notices() Render error notices (priority 10)
* @see woocommerce_result_count() Show number of results found (priority 20)
* @see woocommerce_catalog_ordering() Show form to control sort order (priority 30)
*
* @since 6.3.0
*/
do_action( 'woocommerce_before_shop_loop' );
woocommerce_product_loop_start();
if ( wc_get_loop_prop( 'total' ) ) {
while ( have_posts() ) {
the_post();
/**
* Hook: woocommerce_shop_loop.
*
* @since 6.3.0
*/
do_action( 'woocommerce_shop_loop' );
wc_get_template_part( 'content', 'product' );
}
}
woocommerce_product_loop_end();
/**
* Hook: woocommerce_after_shop_loop.
*
* @see woocommerce_pagination() Renders pagination (priority 10)
*
* @since 6.3.0
*/
do_action( 'woocommerce_after_shop_loop' );
} else {
/**
* Hook: woocommerce_no_products_found.
*
* @see wc_no_products_found() Default no products found content (priority 10)
*
* @since 6.3.0
*/
do_action( 'woocommerce_no_products_found' );
}
/**
* Hook: woocommerce_after_main_content
*
* Called after rendering the main content for a product.
*
* @see woocommerce_output_content_wrapper_end() Outputs closing DIV for the content (priority 10)
*
* @since 6.3.0
*/
do_action( 'woocommerce_after_main_content' );
wp_reset_postdata();
return ob_get_clean();
}