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));
Правильно ли я понял, что он ищет по совпадение названия ссылок страниц, если вводишь слово например developer и есть такое слово например на 8 страниц в ссылках то он и выводит на страницу результат, но почему тогда только 5 выводит, а ещё 3 нет?