1

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:

<?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');
1

Not the best solution but this works fine:

<?php remove_filter('the_excerpt', 'wpautop'); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.