Skip to content

Instantly share code, notes, and snippets.

@jwdsign
Created September 10, 2014 10:22
Show Gist options
  • Save jwdsign/2dd5e5c4704b018ee8b3 to your computer and use it in GitHub Desktop.
Save jwdsign/2dd5e5c4704b018ee8b3 to your computer and use it in GitHub Desktop.
Wordpress Single Article Module with Schema.org Microdata
<article class="_module-article article--full" itemscope itemtype='http://schema.org/Article'>
<?php setPostViews(get_the_ID()); //track post views ?>
<header class="article-header">
<meta itemprop='keywords' content='<?php tag_list(); ?>'/>
<meta itemprop='inLanguage' content='<?php language_attributes(); ?>'/>
<meta itemprop='interactionCount' content='UserPageVisits:<?php echo getPostViews(get_the_ID()); //log post-views as user-interactions ?>'/>
<meta itemprop='description' content='<?php the_excerpt(); ?>'/>
<meta itemprop='about' content='<?php category_name(); ?>'/>
<meta itemprop='isFamilyFriendly' content='True'/>
<h1 class="article-headline" itemprop='name headline'><?php the_title(); ?></h1>
<time datetime='<?php the_time(__('j. F Y, H:i', 'euw')); ?>' itemprop='datePublished'><?php the_time(__('j. F Y, H:i', 'euw')); ?></time>
<figure class="article-figure" itemprop='associatedMedia'>
<div itemscope itemtype='http://schema.org/ImageObject'>
<img class="article-figure-image" itemprop='contentURL' src='<?php the_post_thumbnail_url(); ?>'/>
<figcaption class="article-figure-caption">
<span class="article-figure-caption-author" itemscope itemprop='author' itemtype='http://schema.org/Person'><?php _e('Foto:', 'euw'); ?><span itemprop='name'><?php the_post_thumbnail_description(); ?></span></span>
<div class="article-figure-caption-content" itemprop='caption'><?php the_post_thumbnail_caption(); ?></div>
</figcaption>
</div>
</figure>
</header>
<div class="article-body" itemprop='articleBody'>
<?php the_content(); ?>
</div>
<footer class="article-footer">
<div class="article-author" itemscope itemprop='author' itemtype='http://schema.org/Person'>
<span itemscope itemprop='author' itemtype='http://schema.org/Person'><span itemprop='name'><a itemprop='url' href='<?php the_author_link(); ?>'><?php the_author_name(); ?></a></span>
</div>
</footer>
</article>
@sanakhan123
Copy link

hi
can u tell me how to use this format in wordpress??? Is there a file or theme file you provide for this?

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