Wordpress 1.5 themes, virtual hosts
Since I upgraded to WordPress 1.5, being a web designer, I had to give themes a try. Kubrick is a beautiful interface, but I desired to build my own interface. I have called this one soothe, since it is aqua inspired.
It took me a little while to figure out what files controlled what behaviour. It also caused me to take a good look at the code behind Wordpress. It is very interesting open source code. I was particularly impressed that the index.php file is a mere 2 lines of code (actually 5, but two are php tags and one a comment). It took me a while to figure out where the functions where being pulled in and how it all got bootstrapped from these two lines of code.
The Themes folder contains two standard themes, the Wordpress 1.2 classic look and feel and the new Kubrick. I used Kubrick to start with and edited it until I got what I wanted. Most of the work is done right in the style.css file, but you can also edit the header, index, sidebar and footer files to achieve the look and feel you want.
I edited a local copy of the file, before I uploaded it. I have created a local.bradrice.com folder inside my /Library/Webserver folder. I have a local version of my website there. I added a virtual host to my Apache config file and made a DNS entry into my NetInfo Manger utility. I can open my local file by typing in http://local.bradrice.com.
Here’s the scoop on doing that. In NetInfo Manager authenticate. Click on Machines. Make a duplicate of localhost. Change it to be local.bradrice.com (your url here). Leave the ip address to 127.0.0.1. Save changes and quit. Use vi or your text editor of choice to open /etc/httpd/httpd.conf. You need to open it using sudo to edit it, since it is owned by root. Find the VirtualHosts area of the file. Mine is around line 1056. Here is what I entered:
<VirtualHost 127.0.0.1:80>
#ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /Library/WebServer/Documents
ServerName localhost
#ErrorLog logs/dummy-host.example.com-error_log
#CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost><VirtualHost 127.0.0.1:80>
#ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /Library/Webserver/Websites/bradrice
ServerName local.bradrice.com
#ErrorLog logs/dummy-host.example.com-error_log
#CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
I left in the logs and ServerAdmin address lines, but commented them out. You don’t even need them if you aren’t planning on using custom logs for you site. ServerName and DocumentRoot are the important directives. Make sure you define your path to your directory. Then you need to “sudo apachectl restart” from the command line. You will notice I left localhost in as an option. You may need to restart your browser if you’ve hit localhost before, it may be cached. Now you can type in http://local.yoursite.com to have a local version of your site.
With Wordpress, I actually installed a test version with a new database to work on the file. Open wp-config and change the table prefix like so:
$table_prefix = ‘test_’; // example: ‘wp_’ or ‘b2′ or ‘mylogin_’
Now you won’t overwrite your wp_ tables in your MySQL file. In the options table you will have your url as local which will allow you to view your site locally. Now you can test away with your WP Themes locally.
I’ve added an additional entry to help with setting up Name Based Virtual Hosts.
http://www.bradrice.com/wposx/?p=64
March 16th, 2005 at 8:55 am
This is a very nice Word Press Theme! I am hacking it up a bit but it’s a good base to start.
Thanks!
March 17th, 2005 at 2:33 am
[…] you don’t start over estimating my graphics design talents, I got this template from Brad Rice. I looked at a bunch of templates, and not only was his design really tasty, but it also requires les […]
March 23rd, 2005 at 3:00 pm
Comprehensive list of 160 WordPress 1.5 Themes / Templates available for download
Constantly growing list
March 29th, 2005 at 11:25 am
Nice write up, though what I generally do (and recommend) is to split out my virtual host configs to separate files in a sub-directory (virtual) - add
Include /private/etc/httpd/virtual/*.conf
to the end of the httpd.conf. Then I split out the local sites to individual files in that virtual directory. This makes it really easy to keep track of what’s what, and to remove them when the project’s complete.
I also prefer to use .dev for all the local development sites - that way I can work with subdomains as needed, (gallery.mydomain.dev, forums.mydomain.dev, etc.). Then when it comes time to publish, it’s a quick find and replace on .dev, and I’m good to go. (I’ve even been known to go so far as to create a config file and use placeholders instead of actual references…that removes the need for the find and replace for sites that are constantly evolving).
November 6th, 2005 at 2:53 pm
I tired the instructions above and I get a blank page
I had this working on OSX panther but now that I’m on OS Tiger it doesn’t seem to work
the insructions are simple, everything is in its place not sure why when I do this, i get a blank page, can’t even access 127.0.0.1 or local host
November 15th, 2005 at 9:26 am
[…] u like. This tip supersedes or augments the previous tip below. You can read that post at http://www.bradrice.com/wposx/?p=58 This entry was posted on Tuesday, […]