I’m trying to strip the surrounding tags that are put out by default for the_excerpt();
I’ve tried the following…
<?php remove_filter('the_excerpt', 'wpautop'); ?>
<p class='test'><?php the_excerpt(); ?></p>
and I’ve tried…
<?php $formatted = remove_all_filters('the_excerpt', the_excerpt()); ?>
<p class='test'><?php echo $formatted ?></p>
I’m looking to produce this…
<p class='test'>the excerpt text <a href='http://continuereadinglink'>etc.</a></p>
But instead WordPress outputs this…
<p class='test'></p>
<p class='default-align'>the excerpt text <a href='http://continuereadinglink'>etc.</a></p>
I have actually found a workaround here http://aaronrussell.co.uk/legacy/improving-wordpress-the_excerpt/, but it basically involves replacing the excerpt function, and I would rather avoid this since I just want to strip the filters out.
HTML paragraph tags don’t support nested structure. Try to surround the excerpt with block elements such as DIV
You may try this option: