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
);
$homePage = FALSE;
$shortcut_icon = AMP_URL . 'assets/img/logo.png';
if (is_single() || is_page()) {
if ((is_single() && empty($amps['on_posts'])) or ( is_page() && empty($amps['on_pages']))) {
header('location:' . $current_url);
}
$type = POST;
$first_name_author = get_user_meta($post->post_author, 'first_name', true);
$last_name_author = get_user_meta($post->post_author, 'last_name', true);
$author = $first_name_author . ' ' . $last_name_author;
$author_avatar = get_avatar_url($post->post_author, 16);
$RAWcategories = get_the_category($post->ID);
$categories = array();
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'] = !empty($author) ? $author : 'Admin';
$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));
$postContent = $post->post_content;
if(empty($post->post_content) && $thrive_editor){
$postContent = get_post_meta( $post->ID, 'tve_content_before_more');
}
$structuredData['description'] = do_shortcode(MAMP_Render::replaceForAMP($postContent, true));
$structuredData['publisherName'] = !empty($author) ? $author : 'Admin';
} else {
$ampType = MAMP_Render::getAMPtype($data);
if($ampType == -1){
$term = MAMP_Render::isSlug();
if($term != -1){
$ampType = $term['type'];
$data = $term['term'];
}
}
if ($ampType == CATE) {
if (empty($amps['on_categories'])) {
header('location:' . $current_url);
}
$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;
$structuredData['description'] = $data;
} elseif ($ampType == TAG) {
if (empty($amps['on_tags'])) {
header('location:' . $current_url);
}
$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;
} elseif ($ampType == -1) {
$homePage = TRUE;
if (is_front_page()) {
$type = CATE;
$args = array('posts_per_page' => 5, 'offset' => 0, 'category' => '', 'category_name' => '', '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'] = 'Home Page';
$structuredData['description'] = 'Home Page Posts';
} else {
$postId_on_home_page = get_option('page_on_front');
$post_on_home_page = get_post($postId_on_home_page);
$post = $post_on_home_page;
setup_postdata($post);
$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);
$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'] = !empty($author) ? $author : 'Admin';
$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));
$postContent = $post->post_content;
if(empty($post->post_content) && $thrive_editor){
$postContent = get_post_meta( $post->ID, 'tve_content_before_more');
}
$structuredData['description'] = do_shortcode(MAMP_Render::replaceForAMP($postContent, true));
$structuredData['publisherName'] = !empty($author) ? $author : 'Admin';
}
}
}
?>
ID)): ?> ID), 'single-post-thumbnail'); ?>