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_action( 'woocommerce_before_main_content', 'bbloomer_loop_tag' ); | |
function bbloomer_loop_tag() { | |
if ( is_product_tag() ) { | |
echo 'This will show on every Cat pages'; | |
} else { | |
echo 'This will show on all other Woo pages'; | |
} | |
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_action( 'woocommerce_before_main_content', 'bbloomer_loop_tag_slug' ); | |
function bbloomer_loop_tag_slug() { | |
if ( is_product_tag( 'red' ) ) { | |
echo 'This will show on the Red Tag page'; | |
} elseif ( is_product_tag( 'yellow' ) ) { | |
echo 'This will show on the Yellow Tag page'; | |
} | |
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_action( 'woocommerce_before_main_content', 'bbloomer_woo_page' ); | |
function bbloomer_woo_page() { | |
if ( is_woocommerce() ) { | |
echo 'This will show on Woo pages'; | |
} else { | |
echo 'This will show on WP pages'; | |
} | |
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_action( 'woocommerce_sidebar', 'bbloomer_cart_checkout' ); | |
function bbloomer_cart_checkout() { | |
if ( is_cart() ) { | |
echo 'This will show on the Cart sidebar'; | |
} elseif ( is_checkout() ) { | |
echo 'This will show on the Checkout sidebar'; | |
} | |
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
function bbloomer_find_id_in_cart() { | |
foreach ( WC()->get_cart() as $cart_item_key => $values) { | |
$product = $values['data']; | |
if ( $product->get_id() == 123 ) { | |
// do something | |
} | |
} |
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
/* ========== Получаем информацию о компании со страницы настроек ==========*/ | |
function get_company_details() | |
{ | |
$pod = pods('company-info'); | |
$fields = array( | |
'company-phone' => $pod-> field('company-phone'), | |
'company-email' => $pod-> field('company-email'), | |
'company-time' => $pod-> field('company-time'), | |
); |
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
Адрес: | |
[pods name="company-info" slug="company-address"]{@company-address}[/pods] | |
Режим работы: | |
[pods name="company-info" slug="company-time"]{@company-time}[/pods] | |
Телефон: | |
[pods name="company-info" slug="company-phone"]{@company-phone}[/pods] | |
Электронная почта: |
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
/* Страница настроек «О компании» */ | |
/* ========== Получаем информацию о компании со страницы настроек ==========*/ | |
function get_company_details() | |
{ | |
$pod = pods('company-info'); | |
$fields = array( | |
'company-name' => $pod-> field('company-name'), | |
'company-email' => $pod-> field('company-email'), | |
'company-phone' => $pod-> field('company-phone'), |
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
<?php | |
$args = array( | |
'label' => '', // Text in Label | |
'class' => '', | |
'style' => '', | |
'wrapper_class' => '', | |
'value' => '', // if empty, retrieved from post meta where id is the meta_key | |
'id' => '', // required | |
'name' => '', //name will set from id if empty |
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
/* Выводим категории над списком товаров */ | |
function woocommerce_product_category( $args = array() ) { | |
$woocommerce_category_id = get_queried_object_id(); | |
$args = array( | |
'parent' => $woocommerce_category_id | |
); | |
$terms = get_terms( 'product_cat', $args ); | |
if ( is_product_category() ) { | |
if ( $terms ) { | |
echo '<ul class="woocommerce-categories">'; |