Created
May 4, 2025 02:30
-
-
Save henshaw/763a950c417e74f7b83eaacbcdbfcb32 to your computer and use it in GitHub Desktop.
WordPress functions for dynamically inserting data into Article schema markup
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
"@id": "<?php the_permalink(); ?>" | |
"headline": "<?php the_title(); ?>" | |
"description": "<?php echo get_the_excerpt(); ?>" | |
"datePublished": "<?php the_time('c'); ?>" | |
"dateModified": "<?php the_modified_time('c'); ?>" | |
// For author type | |
"name": "<?php the_author(); ?>" | |
"url":"<?php echo get_the_author_meta('user_url'); ?>" | |
// For image type | |
"url": "<?php if ( has_post_thumbnail() ) { the_post_thumbnail_url( 'full' ); } ?>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Referenced in WordPress Performance and Speed Optimization Guide