wc_terms_and_conditions_page_content()
Output t&c page's content (if set). The page can be set from checkout settings.
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wc_terms_and_conditions_page_content();
Список изменений
| С версии 3.4.0 | Введена. |
Код wc_terms_and_conditions_page_content() wc terms and conditions page content WC 10.5.2
function wc_terms_and_conditions_page_content() {
$terms_page_id = wc_terms_and_conditions_page_id();
if ( ! $terms_page_id ) {
return;
}
$sanitizer = wc_get_container()->get( HtmlSanitizer::class );
$page = get_post( $terms_page_id );
if ( $page && 'publish' === $page->post_status && $page->post_content && ! has_shortcode( $page->post_content, 'woocommerce_checkout' ) ) {
echo '<div class="woocommerce-terms-and-conditions" style="display: none; max-height: 200px; overflow: auto;">' . wc_format_content( $sanitizer->styled_post_content( $page->post_content ) ) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}