post_title; } ?>
ID ) ): ?> ID ), 'single-post-thumbnail' ); ?>
query_string, '', home_url( $wp->request ) );
$parse = parse_url( $current_url );
$current_url = $parse['scheme'] . '://' . $parse['host'] . $parse['path'];
$current_url = str_replace( 'amp', '', $current_url );
$amps = get_option( 'amps' );
$siteurl = get_site_url();
$type = null;
$structuredData = array(
'mainEntityOfPage' => $current_url,
'headline' => 'NewsArticle',
'imgUrl' => AMP_URL . 'assets/img/logo.png',
'imgWidth' => 100,
'imgHeight' => 140,
'personName' => 'Admin',
'datePublished' => '01-01-2016 00:00:00',
'dateModified' => '01-01-2016 00:00:00',
'description' => 'Description Goes Here',
'publisherName' => 'Admin',
'logoUrl' => AMP_URL . 'assets/img/user.png',
'logoWidth' => 16,
'logoHeight' => 16
);
if ( is_single() || is_page() ) {
$type = POST;
$author = get_user_meta( $post->post_author, 'first_name', true );
$author_avatar = str_replace('post_author, 16 ));
$author_avatar = str_replace('/>', '>', $author_avatar);
$RAWcategories = get_the_category( $post->ID );
$categories = array();
$shortcut_icon = AMP_URL . 'assets/img/logo.png';
foreach ( $RAWcategories as $c ) {
$categories[] = '' . $c->cat_name . '';
}
$RAWtags = wp_get_post_tags( $post->ID );
$tags = array();
foreach ( $RAWtags as $t ) {
$tags[] = '' . $t->name . '';
}
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); $ldImage = !empty($image[0]) ? $image[0] : $shortcut_icon;
$dimensions = MAMP_Render::getImageDimensions($ldImage);
$structuredData['headline'] = $post->post_title;
$structuredData['imgUrl'] = $ldImage;
$structuredData['imgHeight'] = $dimensions['height'];
$structuredData['imgWidth'] = $dimensions['width'];
$structuredData['personName'] = $author;
$structuredData['datePublished'] = date( 'd-m-Y H:i:s', strtotime( $post->post_date ) );
$structuredData['dateModified'] = date( 'd-m-Y H:i:s', strtotime( $post->post_modified ) );
$structuredData['description'] = do_shortcode( MAMP_Render::replaceForAMP(strip_tags($post->post_content))) ;
$structuredData['publisherName'] = $author;
} else {
$ampType = MAMP_Render::getAMPtype( $data );
if ( $ampType == CATE ) {
$type = CATE;
$args = array(
'posts_per_page' => 5,
'offset' => 0,
'category' => '',
'category_name' => $data,
'orderby' => 'date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'author' => '',
'post_status' => 'publish',
'suppress_filters' => true
);
$posts_array = get_posts( $args ); $structuredData['headline'] = 'Category: '.$data;
} elseif ( $ampType == TAG ) {
$type = TAG;
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'post_tag',
'field' => 'slug',
'terms' => $data
)
)
);
$posts_array = get_posts( $args );
$structuredData['headline'] = 'Tag: '.$data;
} $structuredData['description'] = $data;
}
?>
post_content) ); ?>