Gallery Image comments in a wordpress sidebar widget

tshannon

Joined: 2012-04-20
Posts: 7
Posted: Tue, 2012-05-29 22:11

I couldn't find an existing widget that allowed me to see my gallery comments in my wordpress sidebar, so I hacked up a quick and dirty implementation that seems to work for me.

This code comes with one big caveat. I don't know any PHP. I stumbled through this implementation by using an existing widget and modifying it for my purposes. The original author's information is in the PHP file.

To Use:
Create a folder in your wp-content/plugins folder called gallery3-comments
Download this file: http://dl.dropbox.com/u/738789/gallery3_comments.php and put it in the gallery3-comments folder.
Edit the gallery3_comments.php file and change this line:
$gallery3 = new wpdb('db_username', 'db_password', 'gallery3', 'localhost');
Change the db_username, db_password, and localhost to the username password and host of your gallery3 database (must be accessible by the user running wordpress).
Then you should just need to add the widget to your sidebar, and it should work. No promises though. As I said I really don't know any PHP, so if someone sees that I'm doing something absolutely wrong, feel free to fix it, or explain to me how to.

It was built to scratch my own itch, but I hope it may be at least a useful starting point for others.

** edit **
Just noticed that you can attach files, so if you use the attached file, you'll need to rename it to remove the _.txt.

AttachmentSize
gallery3_comments.php_.txt5.73 KB