Created
August 25, 2011 09:48
-
-
Save jeherve/1170344 to your computer and use it in GitHub Desktop.
Add schema information to WordPress loop
This file contains 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
<div itemscope itemtype="http://schema.org/Article" class="content"> | |
<h1 itemprop="name"><?php the_title(); ?></h1> | |
<div class="entry-content"> | |
<?php | |
if ( has_post_thumbnail() ) | |
the_post_thumbnail( 'single-post-thumbnail', array( 'itemprop' => 'image' ) ); | |
else | |
echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/default_thumb1.jpg" class="attachment wp-post-image" />'; | |
?> | |
<?php if( strpos(get_the_content(), '<span id="more-') ) : ?> | |
<div class="postintro" itemprop="description"> | |
<?php global $more; $more=0; the_content(''); $more=1; ?> | |
</div> | |
<?php endif; ?> | |
<?php the_content('', true); ?> | |
</div><!-- .entry-content --> | |
</div><!-- .content --> |
This is from 11 years ago, so I wouldn't really worry about it :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not filter the post class