<?php if ( is_single()) : ?>
<?php
$thumbnail_id = get_post_thumbnail_id($post);
$imageobject = wp_get_attachment_image_src( $thumbnail_id, 'full' );
?>
<?php
$author_id = get_the_author_meta('ID');
$obj_author = get_userdata($author_id);
?><script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"mainEntityOfPage":{
"@type":"WebPage",
"@id":"<?php the_permalink(); ?>"
},
"headline":"<?php the_title(); ?>",
"image": [
"<?php echo $imageobject[0]; ?>"
],
"datePublished": "<?php echo get_date_from_gmt(get_post_time('c', true), 'c');?>",
"dateModified": "<?php echo get_date_from_gmt(get_post_modified_time('c', true), 'c');?>",
"author": {
"@type": "Person",
"name": "<?php the_author(); ?>"
<?php
$author_meta_url = get_the_author_meta( 'user_url', $author_id );
$user_meta_tw = get_user_meta( $author_id, 'keni_twitter', true );
$user_meta_fb = get_user_meta( $author_id, 'keni_facebook', true );
$user_meta_ins = get_user_meta( $author_id, 'keni_instagram', true );
$user_meta_note = get_user_meta( $author_id, 'note', true );
$user_meta_yt = get_user_meta( $author_id, 'YouTube', true );
if ( ! empty( $author_meta_url ) ) : ?>
,"url":[ "<?php echo $author_meta_url; ?>"
<?php endif; ?>
<?php if ( ! empty( $user_meta_tw ) ) : ?>
,"<?php echo $user_meta_tw; ?>"
<?php endif; ?>
<?php if ( ! empty( $user_meta_fb ) ) : ?>
,"<?php echo $user_meta_fb; ?>"
<?php endif; ?>
<?php if ( ! empty( $user_meta_ins ) ) : ?>
,"<?php echo $user_meta_ins; ?>"
<?php endif; ?>
<?php if ( ! empty( $user_meta_note ) ) : ?>
,"<?php echo $user_meta_note; ?>"
<?php endif; ?>
<?php if ( ! empty( $user_meta_yt ) ) : ?>
,"<?php echo $user_meta_yt; ?>"
<?php endif; ?>
<?php if ( ! empty( $author_meta_url ) ) : ?>
]
<?php endif; ?>
},
"publisher": {
"@type": "Organization",
"name": "Market Cat",
"logo": {
"@type": "ImageObject",
"url": "https://market-cat.jp/wp-content/uploads/2021/07/logo02.png"
}
},
"description": "<?php echo get_the_excerpt(); ?>"
}
</script>
<?php endif; ?>