New SmugMug Widget For WordPress

I have been searching for an easy way to display my latest SmugMug photos in this website’s sidebar. I came across a couple of relevant plugins in the WordPress repository, but neither fit the bill completely for what I wanted to do. I was hoping to find something that (A) was easy to use; (B) displayed all images with a single user-specified fixed width; and (C) did not require formal authorization to work with my SmugMug account.

I decided to use this opportunity to learn something new and develop my own plugin for WordPress. The result was my new SmugMug Widget plugin, available through the official WordPress.org repository and also here on this website. The widget is simple to configure, and makes use of the public RSS feed on SmugMug to obtain its content.

Feel free to try it out and let me know what you think! (By the way, if you are looking for a more comprehensive SmugMug solution, the other plugins I came across were WP-SmugMug and SmugMug for WordPress, both of which are worth a look.)

Sync XAMPP Data With Dropbox

I use XAMPP for my local website development environment. It’s a wonderful free tool to use for this purpose, since I need access to a local WordPress distribution and the associated MySQL database to experiment with with themes and plugins.

One challenge I faced had to do with the fact that I use three different computers for development activities. Keeping data in sync across these platforms is important to me. The natural solution is to install Dropbox (referral link) on my various machines. (If you’re not familiar with Dropbox, be sure to read about maximizing free space before installing it.)

To be clear about what I set out to accomplish, I wanted to sync (A) my local web pages; and (B) the MySQL database across multiple machines. I did not want to sync the entire XAMPP distribution with all of its binaries. It is not difficult to make this work correctly, but it does require modifying a couple of configuration files.

Before we begin, I will assume you have XAMPP successfully installed and running on multiple machines independently (successfully running the HTTP server and MySQL database components). Our goal, then, is to make all of your installations access a single directory structure within Dropbox. A word of caution with all projects of this sort is that you should backup all of your data before making changes to your configuration files.

For my setup, the directory in which XAMPP is installed happens to be the same on all of my machines. Similarly, the directory in which my Dropbox folder is located is the same across all machines. This is not a requirement to make this work, but you may need to keep this in mind if your setup is different. My folder locations are:

XAMPP Installation =   C:\xampp

Dropbox Location   =   C:\Users\Patrick\Dropbox

Step 1 – Create web page directory in Dropbox folder. The first thing you need to do is set up a directory in your Dropbox folder to hold your web pages (HTML, PHP, etc.). For this example, I will create a folder named “C:\Users\Patrick\Dropbox\web-content”.

Step 2 – Change XAMPP configuration to point at this folder. There are two variables that need to be modified in the XAMPP configuration file. Edit “C:\xampp\apache\conf\httpd.conf” and modify DocumentRoot and Directory so they point to the new folder inside of Dropbox. For my setup, it looked like this:

OLD ENTRIES (search for them in "httpd.conf"):

    DocumentRoot "C:/xampp/htdocs"

    <Directory "C:/xampp/htdocs">

NEW ENTRIES (change lines above to this):

    DocumentRoot "C:/Users/Patrick/Dropbox/web-content"

    <Directory "C:/Users/Patrick/Dropbox/web-content">

Step 3 – Restart Apache and test. From the XAMPP control panel, stop and restart the Apache server. Create a file named “test.html” inside of your new Dropbox/web-content folder. Open “http://localhost/test.html” in your favorite browser, and you should see the contents of your test.html file.

Step 4 – Sync Dropbox across machines, and modify other configuration files. At this point, it should be easy to make your other computers access the same Dropbox folder. Go to your other machines and edit the “httpd.conf” file in the same was as you did on the first machine. If your Dropbox folder or XAMPP installations are located in different places than they were on your first computer, adjust directory names accordingly.

If you don’t need MySQL support for your development efforts, you can stop here. If you want to use something like WordPress, or another package that requires MySQL, continue with the rest of this process.

Step 5 – Turn off the MySQL server. Before moving things around, make sure the MySQL server is turned off from the XAMPP control panel.

Step 6 – Copy MySQL database into Dropbox. From your first machine, locate the directory containing the actual MySQL database. Copy that directory in its entirety to Dropbox. In my case, I simply had to copy the folder “C:\xampp\mysql\data” to “C:\Users\Patrick\Dropbox\web-database”.

Step 7 – Modify the MySQL configuration file. Edit the file “C:\xampp\mysql\bin\my.ini” and modify three variables to point at the new database folder inside of Dropbox.

OLD ENTRIES (search for them in "my.ini"):


    innodb_data_home_dir = "C:/xampp/mysql/data"

    innodb_log_group_home_dir = "C:/xampp/mysql/data"

NEW ENTRIES (change lines above to this):


    innodb_data_home_dir = "C:/Users/Patrick/Dropbox/web-database"

    innodb_log_group_home_dir = "C:/Users/Patrick/Dropbox/web-database" 

Step 8 – Restart the MySQL server and test. Restart the MySQL server and make sure everything is working as it was before.

Step 9 – Modify MYSQL configuration on other machines. Finally, make the same changes to the “my.ini” file on your other machines.

That should be it! A word of caution, though, is that these files should never be modified on more than one machine at a time. And more importantly, the MySQL server should only be running on one machine at a time. Conflicts from multiple active MySQL servers would likely wreak havoc.

Good luck!

WordPress “Most Shared Posts” Plugin

For quite some time, I have wanted a method for pulling share-counts from facebook and Google+, and using them to identify the most “highly rated” posts on my site. Unfortunately, I was not savvy enough to figure it out on my own.

Imagine my pleasure upon finding the Most Shared Posts plugin for WordPress by Tom Anthony. It does exactly what I was looking for, and the setup couldn’t be any easier. Simply install the plugin, display the “Most Shared Posts” widget on your website, and you’re done! You should be able to see it in action on the right-hand side of this page.

Writing this post was more complicated than setting up the new plugin. 🙂 Many thanks to Tom for making this available!

WordPress / Suffusion

I am wholeheartedly sold on WordPress. It’s free, intuitive, and easy to install. I experimented with Joomla for an hour or two, and although I am willing to believe it is more versatile, I ended up frustrated with the experience. My personal installation did not work on my hosted server, and the installation tech support provided for me had all of the “example” files intact. I found it overwhelming. I couldn’t even figure out how to change the front page title/logo. So I deleted it all, jumped head-first into the WordPress framework, and have never looked back.

I also spent quite a bit of time experimenting with the vast array of free themes available for WordPress. I finally settled on “Suffusion”. I like the look and feel of it right out of the box, and it has an extensive set of powerful customizations available. I am impressed that Suffusion’s author — Sayontan Sinha — has created such a wonderful creation in his free time. Not to mention all of the effort he puts into providing support over on his website. He deserves a lot of credit.

WordPress-to-Facebook Automated Selective Posting

When I first started using WordPress, I was eager to find a reasonable method to automatically cross-post blog entries to my facebook profile. It turns out that the facebook “Notes” application will automatically import blog entries if you provide an RSS feed. Unfortunately, this duplicates content rather than directing traffic back to your blog site, and most facebook users will leave comments under the facebook note rather than the actual blog entry. Furthermore, blog owners may want to selectively post entries to facebook, rather than automatically posting every single blog entry from the website.

The solution I found was to make use of two different tools to alleviate the problems mentioned above. The first of these tools is the Feed Facebook, Leave Facebook plugin. This extension for WordPress generates a feed with modified content, where the resulting entries (A) contain only excerpts rather than entire blog entries; and (B) contain a link back to the actual entry on the blog website. Once the plugin is activated, standard feed URLs can be modified to generate the new facebook-friendly feed. The simple modification looks something like this:

    BEFORE     http://www.your-site.com/feed/

    AFTER      http://www.your-site.com/feed/?feedfacebook

Once all of this was in place, I needed a way to direct only selected postings to facebook. I decided to make use of the standard WordPress tag management system to do this. I defined a new tag called facebook-autopost, and assigned this to posts I wanted to have imported to facebook. Since WordPress automatically defines individual feeds for each tag, you simply need to use that feed URL as the basis for the final URL that you enter into the facebook “Notes” application. In the scenario presented above, it will look something like this:

    FINAL      http://www.your-site.com/tag/facebook-autopost/feed/?feedfacebook

That’s pretty much all that is needed to make this work. The facebook “Notes” application will periodically check the feed to see if new entries are available, and update your facebook profile with excerpts from all blog entries tagged with facebook-autopost.

NOTE: this method will not work if you are using other plugins that modify your RSS feeds (for example, plugins that automatically direct all feeds through FeedBurner).