As more and more people switch over to WordPress, they are wanting some of the features they enjoyed when using Movable Type. Rest assured, there are people working overtime writing plugins. I’ve just now installed a “Subscribe to Comments” plugin by Jenn from ScriptyGoddess (which is in beta right now… keep your shirt on), and I just wrote up an article over there about how to do Show/Hide Comments.
The whole thing is quite lengthy, as I went into detail as to what code you should change, but for people who have a stronger understanding of PHP, I can give you the short version.
Basically, we’re going to harness a variable, $withcomments, that is used as a switch for RSS feeds. It really isn’t used in your main templates, but it suits our purposes here. Since your entire wp-comments.php file is wrapped in an if($single || $withcomments){
conditional, all you have to do is go in and separate code chunks into the stuff that should be shown on an $single page, and the stuff that should be shown on a $withcomments page (dropdown comments, that is.) Any code chunks that should be in both, leave alone.
What you need to do in your index.php template (besides making the links to expand the comments), is set up code near the top that will designate certain types of pages as $withcomments. The simplest form would be this:
if(!$single){ $withcomments = TRUE; }
So every page that isn’t $single will be $withcomments. As you can imagine, you can get much more complex if you like. This was merely an overview of the basic approach. Maybe you’d better just go read the whole thing.
Daynah says
Thank you for your help with the WordPress Plugins! 🙂 Wow, this comment preview thing is nifty as well… hehe
Jen says
Hmm, well I was able to install Jennifer’s (ScriptyGoddess’) show/hide extended entry with no problem, but I can’t get the comments to display correctly.
Basically, after making all the recommended changes, the page doesn’t display correctly.
It shows the link to “Show comments here” but then also automatically displays the comments right below (before having clicked on the link)…clicking on that link takes you to the permalinked page and clicking on Hide Comments does nothing but create an Error on page note that says an “object is required”
Any ideas?? My WP test page is here:
http://www.icyshard.com/wp
Mark says
Not sure what your exact problem is, but I’d be happy to take a look at it for you. Check your e-mail.
Jennifer says
I just created a version of wp comments so people could just use that – at least as a starting point. I know your original idea was to keep all the comments stuff on the same wp-comments.php page, but that got to be kind of confusing for me 🙂
Anyway, just thought I’d pass the link along 🙂
Mark says
Yeah, I just like having consolidated code, in case I change something about the way comments look, but it is certainly easier to understand the code if it is separate.
Scrappy says
Comment Me