Just to expand on this: have a look at http://www.leedsunitedladies.com/category/news
Notice how the image is above the text; that’s because the excerpt is wrapped by unwanted p tags.
Now look at http://www.leedsunitedladies.com/category/news/page/8 or http://www.leedsunitedladies.com/category/video on the same site – notice how the image and text are in line with each other.
The image appearance is governed by a bit of php. If the relevant custom field has the value ‘yes’, show the image; otherwise, carry on and show just the excerpt.
I’m at a loss as to what has changed, beyond WordPress and my installed plugins (none of which, that I can see, would ever switch wpautop back on).
Gary
Further investigation shows that the errant behaviour is only happening on posts dated later than 18 June 2010.
I commented out the remove_filter and used the following function:
`function my_real_excerpt() {
global $post;
$bill = $post -> post_excerpt;
$my_excerpt = substr($bill,3,-5);
echo $my_excerpt;
}’
That works in removing the p tags before and after the excerpt for posts dated later than 18 June, but posts earlier than that don’t seem to have any p tags associated with them anymore – so I actually truncate valid characters of my excerpt.
Coincidentally, WordPress 3.0 came out on 17 June 2010…
Gary
And yet more investigation – this time of the database itself – shows that all those posts created since the upgrade to 3.0 have paragraph tags inserted into the post_excerpt field in the database. Posts before that time do not.
Tsk. Will raise a ticket, when I work out how to… it’s not wpautop’s fault after all…
Gary
Hey Gary,
just came across the same problem this morning. I was programming a new template and copied/pasted this function from my notes:
<?php remove_filter (‘the_content’, ‘wpautop’); ?>
and it didn’t work, I thought it could be a 3.0 bug at first but then I noticed there was a syntax error with the inverted commas. Just changed for this and now works like a charm:
<?php remove_filter ('the_content', 'wpautop'); ?>
Maybe too obvious, I guess this is not your issue, but hope this helps.
Marc
Hi Marc,
Not obvious at all, but I had tried that, just to be on the safe side.
I’m actually now beginning to wonder if it’s related to TinyMCE Excerpt, though I can’t see how. Basically, anything created or updated since mid-June is affected. Deactivating the plugin doesn’t store the additional paragraph tags, so it’s now prime suspect…
Gary
Just to round this off (and not really ‘resolved’, but I’ve fixed the problem for me): not having heard from the TinyMCE Excerpt developer, I added the following to my functions.php file, and called it every time I wanted to call the_excerpt()
function my_real_excerpt() {
global $post;
$bill = $post -> post_excerpt;
$billA = substr($bill,0,3);
if ($billA == '<p>') {
$my_excerpt = substr($bill,3,-5);
echo $my_excerpt; } else { echo $bill; }
}
In other words: get the_excerpt, look at the first three characters; if it’s a p tag, strip it and the closing tag, otherwise return what you find.
Works for me, your mileage may vary.
Gary