Skip to content

Instantly share code, notes, and snippets.

@henshaw
Created May 4, 2025 02:30

Revisions

  1. henshaw created this gist May 4, 2025.
    10 changes: 10 additions & 0 deletions article-schema.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    "@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' ); } ?>"