$category_link_array[] = sprintf( '<div class="col-4 col-sm-2 col-xl-1 mb-4"><a href="%1$s" title=""><img src="/wp-content/themes/freerollpasswords/assets/img/%2$s.png" width="36" height="36" alt="%3$s"><span class="d-block">%4$s</span></a></div>',
get_category_link( $single_cat->term_id ),
$single_cat->slug,
$single_cat->name,
strtoupper( $single_cat->slug )
);
}
$category_link_array[] = sprintf( '<div class="col-4 col-sm-2 col-xl-1 mb-4"><a href="%1$s" title=""><img src="/assets/img/%2$s.png" width="36" height="36" alt="%3$s"><span class="d-block">%3$s</span></a></div>',
get_category_link( $single_cat->term_id ),
$single_cat->slug,
$single_cat->name
);
add_action( 'woocommerce_after_shop_loop_item', 'ruta_custom_product_card_details', 6 );
function ruta_custom_product_card_details() {
global $post;
if ( has_term( [ 'exclusive' ], 'product_cat', $post->ID ) ) {
printf( '<div class="product-card__badges_exclusive">%s</div>', __( 'Exclusive', 'text-domain' ) );
}
}
function wpp_get_post_short() {
if ( empty( $id ) ) {
__return_false();
}
$atts = shortcode_atts( [
'id' => $id
], $atts );
$post = get_post( $atts['id'] );
if ( empty( $post ) ) {
__return_false();
}
$out = "<div class=\"my-post-{$id}\">";
$out .= sprintf( '<h2>%s</h2>', $post->post_title );
$out .= sprintf( '<div>%s</div>', do_shortcode( $post->post_content ) );
$out .= '</div>';
return $out;
}
add_shortcode( 'get_my_post', 'wpp_get_post_short' );
[get_my_post id="5"]
Как сделать микро разметку под музей?
С указанием адреса, телефона, нашего сайта и описания координат.
//функция для изменения цен с помощью числа
function wpp_price_plus() {
return 100;
}
add_filter('woocommerce_product_variation_get_regular_price', 'wpp_custom_price', 99, 2 );
add_filter('woocommerce_product_variation_get_price', 'wpp_custom_price', 99, 2 );
function wpp_custom_price( $price, $product ) {
return (float) $price + wpp_price_plus();
}
add_filter('woocommerce_variation_prices_price', 'wpp_custom_variable_price', 99, 3 );
add_filter('woocommerce_variation_prices_regular_price', 'wpp_custom_variable_price', 99, 3 );
function wpp_custom_variable_price( $price, $variation, $product ) {
// Удаление кэшированной цены продукта
wc_delete_product_transients($variation->get_id());
return (float) $price + wpp_price_plus();
}
// Обработка кэширования цен
add_filter( 'woocommerce_get_variation_prices_hash', 'add_price_plus_to_variation_prices_hash', 99, 3 );
function add_price_plus_to_variation_prices_hash( $price_hash, $product, $for_display ) {
$price_hash[] = wpp_price_plus();
return $price_hash;
}
fetch( url, {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache'
}),
credentials: 'same-origin',
body: new URLSearchParams({
action: 'ty_questgo',
}),
}).then(response => response.json())
.then(response => console.log(response))
.catch(err => console.log(err));