So, everyone knows that you can easily turn on and off comments on WordPress pages and posts. Unfortunately for most (depending on theme) when you do this, it leaves a little unsightly blank area or “Comments are Closed” text behind using the default “built-in” method.

This gets annoying as it leaves behind traces of itself and doesn’t look very professional.
Example 1: Leftover junk from using the built-in “comments off” feature:

What we’re going to do now is conditionally ALLOW comments to exist only on certain PAGES (not posts) by ID number. This way, not only is the comment table gone, but any traces it usually leaves of itself will also disappear due to this method. Where you find the code may depend on your theme. I am using the TwentyTen theme for this example.


In the TwentyTen theme, the PHP code snippet is located in the following location:
/wp-content/themes/twentyten/loop_page.php

Depending on theme, you may need to just open: /wp-content/themes/themename/page.php

Either way, you’re looking for this line of code:

< ?php comments_template( '', true ); ?>

This is the page that calls to the “comments-template” which is the entire structure of the comments table and all of it’s contents.

Now, once you have located this snippet, the rest is very easy. Lets say that you want to ALLOW comments on only a few PAGES and have them completely stripped from others. Here’s how:

Replace snippet with this line of code:

< ?php if ( is_page( array( ID#, ID#, ID# ) ) ) comments_template( '', true ); ?>

Utilizing the PHP “if” statement and “is_page” (WordPress) and then adding the array of pages allowed you can make good use of this tutorial. Just replace the “ID#” with the page ID that you would like to ALLOW comments on. You can easily locate your page ID# by hovering over the link. You can even use perma-link structure in lieu of ID#’s. For example replace ID# with “my-home-page” or whatever title your page shows in the URL bar of your browser.

Example 2: How it looks after code has been applied:

See… no more unsightly blank area where the comments should be.

Hope this tutorial helps you in further customizing your WordPress themes. Please let me know if you have any questions or if this worked for you.

THIS ACTUALLY WORKS!!!

First of all, big thanks to the people over at www.egopoly.com for finding this gem. I had been searching for countless time for a way to completely remove MYSQL from my apple computer that is running snow leopard or OSX 10.6X.

I found multiple solutions that do most of the work, but missing one crucial step that www.egopoly.com was able to grasp. So, I figured I would quickly combine the two for a short, easy reference.

To completely remove MYSQL from your mac running osx 10.6 (snow leopard) perform the following tasks in TERMINAL:


sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
(Edit /etc/hostconfig) sudo vi /etc/hostconfig (Remove line MYSQLCOM=-YES)
sudo rm -rf /Library/Reciepts/mysql*
sudo rm -rf /Library/Reciepts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.mysql*

*the very last line is the egopoly.com hack

After executing these commands in terminal (which you can just copy and paste, hit return and go…), I would suggest restarting your mac. After reboot, MYSQL will be completely removed from your mac.

Hope you found this helpful and thanks to forums.mysql.com and www.egopoly.com for the inspiration. I tried to thank them on their blog but the entry was closed to posts. So, this is my thank you!

So, here is my boring story behind it. I was re-installing MYSQL on my mac and just kept running into problem after problem. It would install but fail to execute. I navigate to the MYSQL preference pane and click Start MYSQL and nothing would happen. So, I was probably downloading the wrong versions of it from the dev.mysql.com website. I finally found an older version that I wanted to install, but the installer kept failing. Saying that there was a newer version of MYSQL on the computer and that it couldn’t continue.

I then enabled hidden files to show in finder, went into /usr/local/mysql and deleted everything there. Rebooted and got the same error on install. And I would keep getting a pop up at startup telling me that the MYSQL engine failed to start because I didn’t have sufficient permissions. This was getting real frustrating at this point. I had tried the first lines of code mentioned above that were what my search results were returning, but to no avail.

Somehow I managed upon www.egopoly.com, I forgot what my exact search query was. And there it was… the answer to it all. I added the egopoly line on to the end of the one I got off of forums.mysql.com, ran it in terminal as mentioned above. I went to install the earlier version of MYSQL again and SUCCESS! I really couldn’t believe it. So, hopefully this will help you and you will spend less time searching.

Please visit their site and feel free to comment here if you like.