Skip to content

Instantly share code, notes, and snippets.

@jeherve
Created October 12, 2011 07:10
Show Gist options
  • Save jeherve/1280510 to your computer and use it in GitHub Desktop.
Save jeherve/1280510 to your computer and use it in GitHub Desktop.
Add Google +snippets to TwentyTen page template
function werewp_image_plus($html, $id , $class){
$html = str_replace('class="'.$class.'"','itemprop="image" class="'.$class.'"',$html);
return $html;
}
add_filter('get_image_tag','werewp_image_plus',10,4);
<?php
/**
* The loop that displays a page.
*
* The loop displays the posts and the post content. See
* http://codex.wordpress.org/The_Loop to understand it and
* http://codex.wordpress.org/Template_Tags to understand
* the tags used in it.
*
* This can be overridden in child themes with loop-page.php.
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.2
*/
?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div itemscope itemtype="http://schema.org/Article" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( is_front_page() ) { ?>
<h2 class="entry-title"><?php the_title(); ?></h2>
<?php } else { ?>
<h1 itemprop="name" class="entry-title"><?php the_title(); ?></h1>
<?php } ?>
<div itemprop="description" class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-content -->
</div><!-- #post-## -->
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment