Last active
March 19, 2021 11:40
-
-
Save barking-horse/2bc3f36a1e13761851a0a15b9a00e4bf to your computer and use it in GitHub Desktop.
Add Schema.org Markup to WordPress post for a Better SEO
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
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>" itemscope itemtype="https://schema.org/Article"> | |
<header> | |
<?php the_title( '<h1 class="title entry-title" itemprop="headline">', '</h1>' ); ?> | |
<?php echo get_the_post_thumbnail( $post->ID, 'hero', array('class' => 'img-fluid mx-auto', 'itemprop' => 'image') ); ?> | |
<div class="entry-meta"> | |
<time pubdate itemprop="datePublished" datetime="<?php the_time( 'c' ); ?>" content="<?php the_time( 'c' ); ?>"> | |
<?php the_time( get_option( 'date_format' ) ); ?> | |
</time> | |
<div>Catégories: <span itemprop="about"><?php the_category(', '); ?></span></div> | |
<div>Tags: <span itemprop="keywords"><?php the_tags(''); ?></span></div> | |
<div itemprop="author" itemscope itemtype="https://schema.org/Person"> | |
<span itemprop="name"><?php the_author();?></span> | |
</div> | |
</div> | |
</header> | |
<div class="entry-content"> | |
<div itemprop="articleBody"> | |
<?php the_content(); ?> | |
</div> | |
<div class="entry-footer"> | |
<?php | |
wp_link_pages( | |
array( | |
'before' => '<div class="page-links">' . __( 'Pages:', 'understrap' ), | |
'after' => '</div>', | |
) | |
); | |
?> | |
</div> | |
</div> | |
</article> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment