To fix the Recent Comments widget so that it stops messing about with trackbacks/pingbacks where they don't belong (aka in your sidebar), you'll need just a tiny change to wp-includes/widgets.php so that it becomes a bit more discerning when selecting stuff from the comments table 1, quoth the .vpatch:
- $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
+ $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' and comment_type = '' ORDER BY comment_date_gmt DESC LIMIT $number");
And to make this .vpatch worth at least two lines instead of just one, I also fixed the "default" theme so that it orders the comments at the bottom of an article: trackbacks and pingbacks should be shown there but *only* at the bottom, not messing up people's conversation. The change is made in wp-content/themes/default/comments.php as the .vpatch says:
< ol class="commentlist" >
- < ?php wp_list_comments(); ? >
+ < ?php wp_list_comments('type=comment'); ? >
+ < ?php wp_list_comments('type=pings'); ?>
< /ol >
While I looked into applying the same approach to fix the "classic" theme too, the sadness is that the classic theme takes a different approach to comments and so the required change wasn't that obvious to me right now. I'm no expert in php or mp-wp and I'm not all that keen at becoming one either so I left it for now at this and I have no claim that the solution is anything other than something that works on my blog.
The .vpatch sits on top of billymg's current v-tree head and hopefully doesn't break anything but I'm sure he'll let me know if it does 2 :
- line 1392 in my file[↩]
- According to the "no news is good news" principle, if he doesn't complain, then I'll consider it's all absolutely perfect.[↩]
Comments feed: RSS 2.0
Adding for future reference & readers:
This looks good to me!
lol at the inconsistency between "" and "comment" meaning the same thing. If I had to guess I'd say the pingback type comments were added in a later version, and rather than have users migrate their existing comments to become type: 'comment' they just added the new types and decided a blank type would represent the "original" type of comment.
Thanks for the confirmation that it's all fine.
Re '' and 'comment', I think there is what you say there + the idea of "we'll make a wrapper php function to hide the pesky internals and so we get to call stuff something else (because why not)". And then of course, one gets direct select in some places and wrapper function in others.
I went to test locally and noticed the signature link in your article has some extra cruft in the path that causes it to 404. I was able to grab it from http://ossasepia.com/vpatches/mp-wp_comments_filtering.vpatch.diana_coman.sig just fine though!
Fixed it now, thanks for letting me know! (I had forgotten the http at front, so it considered it relative path and prefixed it with the site's address, hence the mess.)
Funnily given the filtering in the title, this article attracted the first next generation spam, so carefully crafted that it might just about seem genuine even when manually looked at - if it wasn't for the context here which is quite so very specific and one of a kind as to escape indeed even such careful attempt to generic-match. For future reference, here's the attempt, with the [redacted squiggles] being exactly that, some squiggles I don't include here even though they weren't links of any sort, I guess one is supposed to be so curious about it (or flattered perhaps?) as to even search for them:
So yeah, it would work, perhaps: if mp was interchangeable with mp-wp, if the article was making points not giving quite concrete code for a very concrete use case, if the content was meant for saving (and forgetting, of course) rather than directly using if at all interested...
Quite a lot of ifs above but possibly even more on point, it shows both the usual advantage of not just doing "what everyone does" and otherwise the increased need for even less directly descriptive titles.
[...] two weeks ago, I took one hour to produce and publish a tiny vpatch on the mp-wp V-tree, with the whole experience triggering for me a need to look at V1 again, as noted in the logs: [...]
[...] mp-wp_comments_filtering.vpatch (diana_coman) (sauce) [...]
[...] yet non-obvious changes you can make to a new installation of MP's WordPress, right up there with separating pingbacks from direct comments and chapter-and-verse [...]