Using Schema with `the_excerpt`

I’m currently developing a WordPress site and want to use Schema, I have been some what successful so far but have now hit a stone wall. I want to use: itemprop="description" to the <p>the_exerpt</p>.

Since I was able to the itemprop easily to the_post_thumbnail using:

Read More

<?php the_post_thumbnail('post-thumbnail',array('itemprop'=>'image')); ?>

I assumed this would be a easy task, but turns out its slightly more complex for the exerpt tag.

I have tried the following with no success:

  1. <?php the_excerpt('excerpt',array('itemprop'=>'description')); ?>
  2. <?php the_excerpt('the_excerpt',array('itemprop'=>'description')); ?>

Currently my excerpt in functions.php looks like:

function new_excerpt_more($more) {
    global $post;
    return '...<a class="small button secondary" href="'. get_permalink($post->ID) . '" itemprop="url">Continue Reading</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');

Related posts

Leave a Reply

1 comment