I may need to work on the titling of this.
I have a function:
function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;
}
And I'm calling it with <?php echo excerpt(25);?>
. This is what my HTML looks like:
<div class="recent-meta-excerpt">
<?php echo excerpt(25);?>
<a class="read-more" href="<?php the_permalink(); ?>">Read More <i class="fa fa-long-arrow-right"></i></a>
</div>
It's outputting like this:
<div class="recent-meta-excerpt">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.... <a class="read-more" href="http://www.stepyouraimup.com/blog/no-featured-image/">Read More <i class="fa fa-long-arrow-right"></i></a>
</p>
</div>
But I don't want the <a>
inside. When I'm calling the excerpt the <a>
isn't even inside so I'm not sure how it's being wrapped in a <p>
.