Created
May 19, 2021 12:33
-
-
Save DxDiagDx/642b54b481c63d95d63e72054a9abbe7 to your computer and use it in GitHub Desktop.
WooCommerce: добавить вкладку со ссылкой на страницу
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Добавляем вкладку «Оплата и доставка» в карточке товара (фронтенд) | |
*/ | |
add_filter('woocommerce_product_tabs','add_tabs'); | |
function add_tabs($tabs){ | |
$tabs[ 'payment_delivery' ] = array( | |
'title' => 'Оплата и доставка', | |
'priority' => 40, | |
'callback' => 'payment_delivery_description_tab' | |
); | |
return $tabs; | |
}; | |
function payment_delivery_description_tab() { | |
$description = get_post_field( 'post_content', 27, 'display' ); // Подтягиваем текст со страницы «Оплата и доставка» (ID =27) | |
echo $description; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment