$thumb_ID = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
function new_weather () {
// Выдача из транзитного кэша
$cached = get_transient( 'weather_cache' );
if ( $cached !== false )
return $cached;
$result = simplexml_load_file( 'http://export.yandex.ru/weather-ng/forecasts/27612.xml' );
$temperature = $result->fact->temperature;
// Запись в транзитный кэш на 1 час
set_transient( 'weather_cache', $temperature, 1 * HOUR_IN_SECONDS );
return $temperature;
}
$('.modal-post').click(function(){
var data={
action: 'modal_post_action',
security : CrAjax.security,
id: $(this).data('post')
}
$.post(CrAjax.ajaxurl, data, function(response) {
$('#modal-2 .modal-content').html(response);
});
})
function modal_post_action_callback() {
check_ajax_referer( 'cr-special-ajax', 'security' );
$id = (int) $_POST['id'];
$array = array(
'post_type' => 'collection',
'post__in' => array($id)
);
$query = new WP_Query($array); // можно через get_post();
global $withcomments; // если хотите добавить форму комментариев
$withcomments =1; // для того же
while ( $query->have_posts() ) {
$query->the_post();
// тут цикл
die();
}
add_action( 'wp_ajax_modal_post_action', 'modal_post_action_callback' );
add_action( 'wp_ajax_nopriv_modal_post_action', 'modal_post_action_callback' );
add_action( 'pre_get_posts', 'cr_custom_post_per_page' );
function cr_custom_post_per_page( $query )
{
if ($query->is_main_query() && !$query->is_feed() && !is_admin()) {
$first_page_post_count = 8;
$empty_pages_post_count = 16;
$paged = $query->query_vars['paged'];
if ($paged > 1) {
$posts_per_page = $empty_pages_post_count;
if ($paged == 2) {
$offset = $first_page_post_count;
} else {
$offset = $first_page_post_count + ( $empty_pages_post_count * ($paged - 2));
}
} else {
$offset = 0;
$posts_per_page = $first_page_post_count;
}
$query->set('posts_per_page', $posts_per_page);
$query->set('offset', $offset);
}
}
wpcf7_mail_sent,
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$formdata = $submission->get_posted_data();
$email = $formdata['your-email'];
// бла бла бла
}
<?php global $redux_demo;
$logo = $redux_demo['logo-upload']['url'];
?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"
title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<?php if( ! empty($logo) ) {
bloginfo( 'name' ); ?>
</a>
<?php bloginfo( 'description' );
} else { ?>
<img src="<?php echo $logo; ?>"/>
</a>
<?php } ?>