<script type='text/javascript'>
/* <![CDATA[ */
var object_name = {"some_string":"Some string to translate","a_value":"10"};
/* ]]> *//code>
В соседней ветке рекомендуют так выводить на странице
<code lang="php">
echo sprintf("<script>var json_data = '%s';</script>", json_encode($arr));
</code>
function wph_set_pic_tumbail() {
$args = array(
'numberposts' => -1,
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'post',
);
// все посты из рубрик
$posts = get_posts( $args );
foreach($posts as $post){ setup_postdata($post);
$youtubeurl = get_post_meta($post->ID, 'tie_video_url', true);
if (!empty($youtubeurl)) {
update_post_meta($post->ID, '_format_video_embed', $youtubeurl);
set_post_format( $post->ID, 'video' );
}
}
wp_reset_postdata();
}
function wph_set_default_avatar() {
$users = get_users('meta_key=profilepicture');
foreach ($users as $user) {
$userid = $user->ID;
$avatar_url = get_user_meta($userid, 'profilepicture', true);
if (!empty($avatar_url)) {
if (!has_gravatar($avatar_url)) {
delete_user_meta($userid,'profilepicture');
}
}
}
}
function has_gravatar( $url ){
$Headers = get_headers($url);
if ('HTTP/1.1 200 OK' == $Headers[0]) {
return true;
} else {
return false;
}
}
WP_Query Object ( [query_vars] => Array ( [cat] => 1 [error] => [m] => [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [name] => [static] => [pagename] => [page_id] => 0 [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [tag_id] => [author] => [author_name] => [feed] => [tb] => [paged] => 0 [comments_popup] => [meta_key] => cp-term-id-1 [meta_value] => [preview] => [s] => [sentence] => [fields] => [menu_order] => [category__in] => Array ( ) [category__not_in] => Array ( ) [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( ) [post_parent__in] => Array ( ) [post_parent__not_in] => Array ( ) [author__in] => Array ( ) [author__not_in] => Array ( ) [orderby] => meta_value_num [order] => ASC [posts_per_page] => -1 ) [tax_query] => WP_Tax_Query Object ( [queries] => Array ( [0] => Array ( [taxonomy] => category [terms] => Array ( [0] => 1 ) [include_children] => 1 [field] => term_id [operator] => IN ) ) [relation] => AND ) [meta_query] => [date_query] => [post_count] => 0 [current_post] => -1 [in_the_loop] => [comment_count] => 0 [current_comment] => -1 [found_posts] => 0 [max_num_pages] => 0 [max_num_comment_pages] => 0 [is_single] => [is_preview] => [is_page] => [is_archive] => 1 [is_date] => [is_year] => [is_month] => [is_day] => [is_time] => [is_author] => [is_category] => 1 [is_tag] => [is_tax] => [is_search] => [is_feed] => [is_comment_feed] => [is_trackback] => [is_home] => [is_404] => [is_comments_popup] => [is_paged] => [is_admin] => [is_attachment] => [is_singular] => [is_robots] => [is_posts_page] => [is_post_type_archive] => [query_vars_hash] => bdb05ea4d6d92b44dd19c966f50adf82 [query_vars_changed] => [thumbnails_cached] => [stopwords:private] => [query] => Array ( [cat] => 1 ) [queried_object] => stdClass Object ( [term_id] => 1 [name] => Рубрика по умолчанию [slug] => %d0%b1%d0%b5%d0%b7-%d1%80%d1%83%d0%b1%d1%80%d0%b8%d0%ba%d0%b8 [term_group] => 0 [term_taxonomy_id] => 1 [taxonomy] => category [description] => [parent] => 0 [count] => 6 [filter] => raw [cat_ID] => 1 [category_count] => 6 [category_description] => [cat_name] => Рубрика по умолчанию [category_nicename] => %d0%b1%d0%b5%d0%b7-%d1%80%d1%83%d0%b1%d1%80%d0%b8%d0%ba%d0%b8 [category_parent] => 0 ) [queried_object_id] => 1 )