Archive for August, 2009

Setting Up Your Mac For Local Development Using Coda, WordPress & MAMP

Monday, August 10th, 2009

WordPress is not just for blogs. WordPress is a highly sophisticated content management system that you can use to develop and manage your client’s professional websites. Best of all, it’s entirely free. To get started it helps to experiment without the hassle of publishing files to the Internet. With a Mac, you already have the basics for an excellent local development environment.

In this tutorial, I will describe setting up a folder on your Mac that you can use to practice building websites with PHP and a MySQL database. Before we begin you will need

  1. a Mac
  2. a text editor
  3. a web browser

Let’s get started.

1) Download WordPress from WordPress.org. Unzip it to find a folder called “wordpress”. Rename it YOUR_PROJECT_NAME (Mine will be called “jay”). Drag it to the Sites folder in your Home directory. For easy access, I’ve added the Sites folder to my Finder window sidebar.

Add the Sites folder to your Finder window sidebar

2) Download the free MAMP software from Mamp.info and install. MAMP stands for Mac, Apache, MySQL and PHP. This app helps manage our MySQL databases in a straight forward way.

Open the app and click “Preferences…”, then select the “Apache” tab to select our Document Root. We want to select the Sites folder located in your Home folder. The path should read /Users/YOUR_MAC_OS_X_USER_SHORTNAME/Sites.

Set up MAMP to use ~/Sites as the Document Root

Once you activate MAMP and get the green lights, test if it is working by opening your browser and going to http://localhost:8888/ You should see the contents of your ~/Sites directory. Remember, we’re preparing a local development environment. “Localhost” means your computer, so no one else in the world will be able to see these files in their web browser.

Okay, MAMP is working, and the MySQL is just waiting for us to give it some database tables. Go to http://localhost:8888/MAMP (must be all uppercase) and click “phpMyAdmin”. Once there, “Create new database” with YOUR_PROJECT_NAME. My database name will be “jay” to match my project.

3) Now we just have to match WordPress with the database. Access the YOUR_PROJECT_NAME folder in ~/Sites and rename the wp-config-sample.php to wp-config.php. Open the file to edit the content. DB_NAME means database name, so enter YOUR_PROJECT_NAME. The DB_USER and DB_PASSWORD are both “root”. Leave “localhost” as the server, as the server is our local computer.

Remember to change the name of this file from wp-config-sample.php to wp-config.php

4) Visit http://localhost:8888/YOUR_PROJECT_NAME and you will see the famous five minute WordPress install. Set up the blog name and email, and you will be given a password. (I copy and paste this generated password to get into WordPress, then change it to something easy to remember right away. I use the same simple password for all my WordPress development sites, since they are not live on the Internet.)

The famous five minute WordPress installation process begins

WordPress is now configured to work on your computer, but will only be accessible locally. The final step is to set up Coda to access the directory.

5) Go to Coda, enter Sites view (Command 1) and “Add Site…”

Nickname
YOUR_PROJECT_NAME
Root URL & Local URL
When developing locally, this will simply be used to generate a thumbnail for you to see your project in Coda. These can be the same URL, e.g. http://localhost:8888/YOUR_PROJECT_NAME
Remote Root
None
Local Root
You may use the “Set…” file browser to find your project folder in the Sites folder, or copy and paste this template: /Users/YOUR_MAC_OS_X_USER_SHORTNAME/Sites/YOUR_PROJECT_NAME/
Connecting, Terminal and Source Control
Do not worry about these. You do not have to configure them for local development.

Setting up your new WordPress site in Coda

Short URL: http://jwr.cc/x/1e

My Favorite WordPress Plugins

Monday, August 3rd, 2009

The abundance of “Top Ten” Lists of WordPress Plugins helps reinforce those plugins that are extremely necessary; like the All In One SEO plugin, or the Google XML Sitemaps plugin. However, my most essential plugins are never listed. So, while some of the following may not be as sexy as the Increase Your Traffic By 2000% plugin, they do come in extremely handy.

Broken Links Checker plugin by Janis Elsts. Aptly named; once installed, an administrative panel in the WordPress Dashboard displays broken links found within your content.

Nice Search by Mark Jaquith. Takes your ugly search URI (/?s=search-term) and makes it pretty (/search/search-term). I am a big fan of human-readable, hackable URLs.

Nice Search WordPress plugin

Improved Include by Vito Tardia. My buddy, Paul, taught me this trick first day on the job: Let’s say you have a complex homepage with three columns of separate content. Laying out this page in HTML/CSS is easy… unless you need the client to be able to change the content. Just make separate pages to hold the specific content and use Improved Include to pull that content in:

improved-include

Of course there are a lot more uses for this, but I’ll leave that for you to discover. I hope you’ve enjoyed this article on WordPress plugins, and maybe even learned a thing or two. What are your favorite, unknown WordPress plugins?