Wordpress comments: new built-in feature X Wordpress Threaded Comments, which one is best?
Well, Wordpress built-in support for threaded comments is not that new anymore, it was realeased in version 2.7.
But some stuff changed with it, and all old themes didn't have support. They had to be updated and a lot of work had to be done, inclusing keep support for pre-2.7 environments.
I've started testing its features to see what it offers to us, and this post is inteded to share my thoughts with anybody interested to port his theme. Is it worth the trouble?
- My current situation
- What's the difference between them?
- Wordpress Thread Comment disadvantages
- Wordpress built-in threaded comments disadvantages
- Wordpress built-in threaded comments Advantages
- Conclusion
- Related Posts
- Comments (0)
My current situation
I use Khaki Traveler Theme (http://wordpress NULL.org/extend/themes/khaki-traveler) by Jeremy Clark (http://clark-technet NULL.com/).
I've done A LOT of tweaks on it during the last year, and as long as I know he never worked on the theme anymore, including no threaded comments support added.
I tweaked it so much that it would be hard to add any Jeremy's update to it, I'd have to compare old original version with newer one, and add each update one by one to my theme. Since I've worked so much on it and got used to like 60% of it, I decided to see by myself if I was able to add threads support on it.
Hikari WebSite already has threaded comments support, it is done by the very know Wordpress Thread Comment (http://blog NULL.2i2j NULL.com/plugins/wordpress-thread-comment) plugin.
I've been researching a way to give me more control over comments layout. I already use raw-html and Exec-PHP plugins, together with disabled unfiltered_html and TinyMCE, to give me full control over my posts. I develop my posts in Dreamweaver and post its HTML directly to Wordpress, and I wanted to do the same with my comments.
During these tweaks I started getting annoyed by some WPTC's characteristics. That was when I decided to try to remove it and use Wordpress built-in feature.
What's the difference between them?
First of all, the most important: they are both compatible! it means that if you are currently using WPTC and decides to port your theme, all your threaded/nested comments will remain on the same place!
That being said, is there any difference in their implementations? What may happen when we drop Wordpress Threaded Comments plugin and use Wordpress built-in? Do we gain anything new? Do we lose anything?!
Well I made that question in Wordpress support forum, but got no responses. But now they are all here, I've tested it myself.
Another quick answer: none of them is the best. Some people may prefere remaining with WPTC, others may choose to go forward. I've chosen to stay. And here's why:
Wordpress Thread Comment disadvantages
My main concern with WPTC is that it wraps nested comments inside their parent, with no way of separating them. I wanted to wrap each comment text inside a div with a class, to make some styling to them, including margin/padding. That required that the text, and only the text, to be around that div.
But that's not possible, because to add child comments inside their parents, WPTC uses a Wordpress hook, adding whole comments inside other comments's text. I tried to do the following:
<div class="commenttext"><?php comment_text(); ?></div>
but it didn't work. Nested comments get inside commenttext's div from their parent. WPTC's threaded comments are added inside Wordpress's comment_text() function, all together.
Another serious issue about Wordpress Thread Comment is that, while main comments (those with no parents) are printed by our theme's comment.php, all nested ones are generated directly by the plugin, which totally ignores our theme. Of course we can go to its config page and add our theme code there, but it generates a duplicate. Every time we change anything in our theme we end up forgetting to update the plugin, and only when we see "something wrong" in our frontend that we remember to go there.
Well, maybe Wordpress brings something new to help us, right?
I decided to give it a try, and using its tutorial (http://codex NULL.wordpress NULL.org/Migrating_Plugins_and_Themes_to_2 NULL.7/Enhanced_Comment_Display) I tried to do the trick.
Wordpress built-in threaded comments disadvantages
I followed their tutorial, and what I previewed happened. Wordpress built-in feature uses different styles from those in my theme. If I was sad to have to duplicate my theme's code inside WPTC config page, with Wordpress it wasn't even an option.
It doesn't work and that's it, comments are now generated all by Wordpress core, we just call that wp_list_comments()
function and that's it. It prints all comments at once without we even having a chance to see what's happening.
Our only option is to forget comment.php and go to style.css, see in our frontend source what it had done and try to adapt our stylings to its.
It is true that Wordpress generates some good classes and id. All comments have their own ID and good old standard # links keep working. That's even good for those theme developers and don't add comment links and force those dumb blog owners that use them to keep saying things like "post link <post-link> comment number 10!!!". That's finally gone and comments now have their links by default with no easy way to take them out.
Classes are also well coded, letting us style even and odd comments, parents and childs, different thread depths, and also comments made by authors, with different styles for each author! But still we have to port and adapt our styles to it, which is not a trivial task.
But after the bad first view, there were a few improvement...
Wordpress built-in threaded comments Advantages
As I wanted, each comment has its own area. Nested comments come after their parent, nested inside their own ul (WPTC uses divs inside main lis, with divs inside divs for deeper dephs, a much worse approach).
There is also a more complex way of listing comments. Instead of simply calling wp_list_comments() (http://codex NULL.wordpress NULL.org/Template_Tags/wp_list_comments), we can pass an array as parameter with arguments, and one of these arguments is the name of a funcion that will format each comment block.
This function is called "custom comment callback function", it is called by Wordpress for each comment that will be printed. In wp_list_comments's tutorial they suggest to add this function to our theme's function.php, but I'd rather use it in comments.php, just after wp_list_comments(). This way we call it to to list all comments and then add the comment block formatting. That's a much more complex approach, but also gives the most flexibility! We can do pratically anything with comments (including wrap comment text in a div, separated from the next list of nested comments).
I may use it in the future, when I port my comments.php to the new feature. But I decided to not do it now, because besides restyling/reformatting everything, I also missed WPTC's feature that moves comment form below the comment that is being replied.
Wordpress also has this feature, but implementing it requires changes in comment form, which I couldn't test. I don't think it was worth trying without a custom wp_list_comments() callback implementation.
Conclusion
Well that's it. Wordpress "new" threaded comments built-in feature is a bit more flexible than Wordpress Threaded Comments plugin, but to use all that flexibility it is much more complex to implement.
We can just let it go and let Wordpress deal with formatting, using the simplest approach, but doing so takes the flexibility away and keeps all the restyling work. I don't think it's worthy.
My opinion, at least for now, is that Wordpress built-in is only worthy using if we are willing to have all the work of reformatting and restyling our comments area. It will take some work, but I believe theme development adepts are already used to it.
But, on the other hand, using the simple approach of just calling wp_list_comments() without any arguments doesn't seem good enough, being better to just leave legacy comment system on its place and implementing threaded comments with Wordpress Threaded Comments plugin. It is MUCH simpler to use and config, and does its job requiring less work from us.
Popularity: 8%
It has accumulated a total of 21,971 views. You can follow any comments to this article through the Comments RSS 2.0 Feed. You can leave a comment, or trackback from your own site.
Comentando vc contribui e participa na criação do conteúdo do site.
Contribua. Commente. :)
(Os comentários abaixo representam a opinião dos visitantes, o autor do site não se responsabiliza por quaisquer consequências e/ou danos que eles venham a provocar.)