post_title);
$commentCount = intval($post->comment_count);
$articleBody = esc_html($post->post_content);
$url = esc_url(get_permalink( $post->ID ));
$datePublished = get_the_time('Y-m-d', $post->ID);
$dateModified = get_post_field('post_modified', $post->ID );
$description = esc_html(get_the_excerpt( $post->ID ));
$author = esc_html(get_the_author_meta( 'display_name', $post->ID));
$image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "thumbnail" );
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$organization_logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
}
// is_single()
// BlogPosting
if ( is_single() ){
$BlogPosting = array(
'@context' => "http://schema.org",
'@type' => "BlogPosting",
'headline' => $title,
'datePublished' => $datePublished,
'dateModified' => $dateModified,
'description' => $description,
'articleBody' => $articleBody,
'inLanguage' => $inLanguage,
'commentCount' => $commentCount,
'mainEntityOfPage' => array(
'@type' => "WebPage",
'@id' => $url
),
'image' => array(
'@type' => "ImageObject",
'url' => $image_data[0],
'width' => array(
'@type' => "Intangible",
'name' => $image_data[1],
),
'height' => array(
'@type' => "Intangible",
'name' => $image_data[2],
),
),
'author' => array(
'@type' => "Person",
'name' => $author
),
'publisher' => array(
'@type' => "Organization",
'name' => $site_name,
'logo' => array(
'@type' => "ImageObject",
'url' => $organization_logo[0],
'width' => array(
'@type' => "Intangible",
'name' => $organization_logo[1],
),
'height' => array(
'@type' => "Intangible",
'name' => $organization_logo[2],
),
)
)
);
echo '';
}
if( is_page() ){
$WebsiteSchema = array(
'@context' => "http://schema.org",
'@type' => "WebSite",
'url' => $site_url,
'name' => $site_name,
'description' => $site_description,
);
echo '';
}
if( is_page() ){
$WebpageSchema = array(
'@context' => "http://schema.org",
'@type' => "WebPage",
'url' => $url,
'name' => $title,
);
echo '';
}
}
endif;