function custom_shortcode_scripts() {
global $post;
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'custom-shortcode') ) {
wp_enqueue_script( 'custom-script');
}
}
add_action( 'wp_enqueue_scripts', 'custom_shortcode_scripts');
jQuery(function($){
$(document).ready(function(){
function test(){
if( ! $( ".office-accordion" ).length ) return false;
$( ".office-accordion" ).accordion({heightStyle: "content"});
}
test();
});
});
$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;
}