wc_replace_policy_page_link_placeholders()
Replaces placeholders with links to WooCommerce policy pages.
Хуков нет.
Возвращает
Строку
.
Использование
wc_replace_policy_page_link_placeholders( $text );
- $text(строка) (обязательный)
- Text to find/replace within.
Список изменений
С версии 3.4.0 | Введена. |
Код wc_replace_policy_page_link_placeholders() wc replace policy page link placeholders WC 9.8.1
function wc_replace_policy_page_link_placeholders( $text ) { $privacy_page_id = wc_privacy_policy_page_id(); $terms_page_id = wc_terms_and_conditions_page_id(); $privacy_link = $privacy_page_id ? '<a href="' . esc_url( get_permalink( $privacy_page_id ) ) . '" class="woocommerce-privacy-policy-link" target="_blank">' . __( 'privacy policy', 'woocommerce' ) . '</a>' : __( 'privacy policy', 'woocommerce' ); $terms_link = $terms_page_id ? '<a href="' . esc_url( get_permalink( $terms_page_id ) ) . '" class="woocommerce-terms-and-conditions-link" target="_blank">' . __( 'terms and conditions', 'woocommerce' ) . '</a>' : __( 'terms and conditions', 'woocommerce' ); $find_replace = array( '[terms]' => $terms_link, '[privacy_policy]' => $privacy_link, ); return str_replace( array_keys( $find_replace ), array_values( $find_replace ), $text ); }