/**
* Code chen Google Analytics vao trang AMP
*/
function my_amp_scripts( $data ) {
$data['amp_component_scripts'] = array(
'amp-analytics' => 'https://cdn.ampproject.org/v0/amp-analytics-0.1.js'
);
return $data;
}
add_filter( 'amp_post_template_data', 'my_amp_scripts' );
function my_amp_analytics( $amp_template ) {
?>
ID, $tax, array( 'fields' => 'ids' ) );
}
// if no tags, then by cat or custom tax
if ( empty( $tax_term_ids ) ) {
// remove post_tag to leave only the category or custom tax
if ( $tag_key !== false ) {
unset( $taxs[ $tag_key ] );
$taxs = array_values($taxs);
}
$tax = $taxs[0];
$tax_term_ids = wp_get_object_terms( $post->ID, $tax, array('fields' => 'ids') );
}
if ( $tax_term_ids ) {
$args = array(
'post_type' => $post->post_type,
'posts_per_page' => $count,
'orderby' => 'rand',
'tax_query' => array(
array(
'taxonomy' => $tax,
'field' => 'id',
'terms' => $tax_term_ids
)
),
'post__not_in' => array ($post->ID),
);
$related = new WP_Query( $args );
if ($related->have_posts()) : ?>
tag; our sanitizer will take care of it later.
$image = sprintf( '%s
', get_the_post_thumbnail() );
$content = $image . $content;
}
return $content;
}
/**
* Het code chen anh Featured Image
*/