Created
October 24, 2019 14:25
-
-
Save erickacevedor/3804723be3a84a34d0554502d9252b1c to your computer and use it in GitHub Desktop.
Structured data markup ready for WordPress single file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $autorname; ?> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php | |
$authorfname = get_the_author_meta('first_name'); | |
$authorlname = get_the_author_meta('last_name'); | |
$autorname = "{$authorfname} {$authorlname}"; | |
?> | |
<?php endwhile; ?> | |
<script type="application/ld+json"> | |
{ | |
"@context": "http://schema.org", | |
"@type": "Article", | |
"name": "<?php the_title(); ?>", | |
"author": { | |
"@type": "Person", | |
"name": "<?php echo $autorname; ?>" | |
}, | |
"datePublished": "<?php echo get_the_date('Y-m-d'); ?>", | |
"articleSection": "blog", | |
"url": "<?php the_permalink(); ?>", | |
"publisher": { | |
"@type": "Organization", | |
"name": "OrganizationName" | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment