woocommerce_product_archive_description() WC 1.0
Show a shop page description on product archives.
Хуков нет.
Возвращает
Null. Ничего.
Использование
woocommerce_product_archive_description();
Код woocommerce_product_archive_description() woocommerce product archive description WC 5.0.0
function woocommerce_product_archive_description() {
// Don't display the description on search results page.
if ( is_search() ) {
return;
}
if ( is_post_type_archive( 'product' ) && in_array( absint( get_query_var( 'paged' ) ), array( 0, 1 ), true ) ) {
$shop_page = get_post( wc_get_page_id( 'shop' ) );
if ( $shop_page ) {
$description = wc_format_content( $shop_page->post_content );
if ( $description ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<div class="page-description">' . $description . '</div>';
}
}
}
}