I’m not sure if that’s possible. However, I think you could get the same result by using a div instead.
<div class="intro"><?php the_excerpt(); ?></div>
Then in your CSS, use:
.intro p{...}
Hope that helps.
I thought about doing that, but I want to keep my code as clean as possible. I guess it’s the only solution for now.
<?php category_description(); ?>
has the same problem: <p>
& </p>
are added by default
Try this….
<?php remove_filter('the_excerpt', 'wpautop'); ?>
Just removes the filter…
<?php remove_filter(‘the_excerpt’, ‘wpautop’); ?>
Mega man send his many thanks to you t31os. This really helped us.
Alternatively, yiu could just add the line
remove_filter(‘the_excerpt’, ‘wpautop’);
into your themes functions.php
That would make it a global for any page/post/category within the theme…
I’ve tried adding:
remove_filter(‘the_excerpt’, ‘wpautop’);
to the template and in my functions.php and neither has any effect. Am I missing something?
I love the WordPress community!
@arranp hmm… that’s strange, have you got it working now? This is how I have mine set up, and it case there is no excerpt, I call the_content_rss to print out a truncated version of the content, so it’s super clean.
<?php #Display the excerpt if specified, otherwise use the content rss feed to display only the first 8 words (clever)
if (!empty($post->post_excerpt)) :
remove_filter('the_excerpt', 'wpautop');
the_excerpt();
else :
the_content_rss('', FALSE, '', 8);
endif;
?>
Thanks Rogerr!
That’s excatly what I wanted, thank you very much!