//Добавляем Open Graph в Language Attributes
function add_opengraph_doctype( $output ) {
return $output . ' xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://ogp.me/ns#" ';
}
add_filter('language_attributes', 'add_opengraph_doctype');
//Разрешаем добавить Open Graph Meta Info в head
function insert_og_in_head() {
global $post;
setup_postdata( $post );
if ( !is_singular()) //if it is not a post or a page
return;
echo '<meta name="twitter:card" content="summary">'."n";
echo '<meta name="twitter:site" content="@mySite">'."n";
echo '<meta name="twitter:creator" content="@mySite">'."n";
echo '<meta name="twitter:title" content="' . get_the_title() . '"/>'."n";
echo '<meta name="twitter:url" content="' . get_permalink() . '"/>'."n";
echo '<meta name="twitter:description" content="'. strip_tags( get_the_excerpt($post->ID) ).'"/>'."n";
echo '<meta name="twitter:widgets:csp" content="on">'."n";
echo '<meta property="fb:admins" content="1000045454545"/>'."n";
echo '<meta property="og:title" content="' . get_the_title() . '"/>'."n";
echo '<meta property="og:type" content="article"/>'."n";
echo '<meta property="og:url" content="' . get_permalink() . '"/>'."n";
echo '<meta property="og:site_name" content="'. get_bloginfo('name') .'"/>'."n";
echo '<meta property="og:description" content="'. strip_tags( get_the_excerpt($post->ID) ).'"/>'."n";
if(!has_post_thumbnail( $post->ID )) { //у записи нет миниатюры - используем изображение по-умолчанию
$default_image="/img/logo.png";
echo '<meta property="og:image" content="' . $default_image . '"/>'."n";
echo '<meta name="twitter:image:src" content="' . $default_image . '"/>'."n";
}
else{
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>'."n";
echo '<meta name="twitter:image:src" content="' . esc_attr( $thumbnail_src[0] ) . '"/>'."n";
}
}
add_action( 'wp_head', 'insert_og_in_head', 5 );
function cs_addto_usermeta_carosel() {
$user_data = get_userdata( get_current_user_id() );
if( 'subscriber' === $user_data->roles[0] )
wp_die();
/** Остальной код **/
}
add_action("wp_ajax_nopriv_cs_addto_usermeta_carosel", "cs_addto_usermeta_carosel");
<body class="<?=isset($class) ? $class : ''?>">
...
</body>
.btn {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}