Skip to content

Instantly share code, notes, and snippets.

@henshaw
Created May 4, 2025 02:30
Show Gist options
  • Save henshaw/763a950c417e74f7b83eaacbcdbfcb32 to your computer and use it in GitHub Desktop.
Save henshaw/763a950c417e74f7b83eaacbcdbfcb32 to your computer and use it in GitHub Desktop.
WordPress functions for dynamically inserting data into Article schema markup
"@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' ); } ?>"
@henshaw
Copy link
Author

henshaw commented May 4, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment