Installing WordPress is straightforward. Since we wanted an embedded blog for news on our front page, along with a standard blog in a subdirectory, we had to go through a few extra steps.
Here’s how to reproduce our setup:
Note: The following assumes Apache, PHP, and MySQL are already installed and configured (correctly), which means, amongst other things, Apache is configured to load the PHP module, there’s a database for the WordPress tables to be installed into, and there’s a MySQL user that can access those tables.
- Download WordPress 2.0.3 from http://wordpress.org/download/
- Decompress the downloaded file into the top-level HTML directory; this will create a new directory named wordpress
- Rename the wordpress directory to blog (not strictly necessary, but looks better)
- In the blog directory, copy wp-config-sample.php to wp-config.php
- Open wp-config.php in a text editor and follow the directions in the file (this just involves a few settings for MySQL)
- Navigate to http://byCycle.org/blog/wp-admin/install.php and follow the directions
- Assuming Apache, PHP, and MySQL are installed and configured and wp-config.php is correct, the blog is now installed and ready to use at http://byCycle.org/blog/ (Styling the blog to match the rest of the site is left as an exercise)
- To embed WordPress in the home page, first rename the home page to index.php (index.html => index.php)
- Add the following PHP to the top of index.php (before anything else):
<?php
$cat = 2;
$show_how_many_posts = 2;
require('./blog/wp-blog-header.php');
?>
- Determine where the news section will be, probably in something like <div id=”news”><!– News will go here –></div>
- Inside the news div, copy The WordPress Loop; The Loop can be copied from blog/wp-content/themes/default/index.php; it consists of all the stuff inside
<div class=”narrowcolumn” id=”content”></div> (but not the div tags) - Modify The Loop; this isn’t strictly necessary, but to use the $cat and $show_how_many_posts variables from above, a few changes need to be made; (instead of pasting our version of the loop here,
here is the source; look for the section that starts with <!– Begin Embedded WordPress –>) - And I think that’s all; let us know if it looks like we left anything out
I should mention that even though PHP is not my favorite language, I think WordPress is pretty cool, and hacking on it is fairly easy.
Actually, it’s not too far a hop, skip, and a jump to just creating a new template (theme?) which requires/imports the (dynamic) header and footer from the rest of your site. There’s a lot of cleaning up that _could_ be done to make styles and linkrels go in the header all proper-like, but that’s not even necessary. Just got it working last night for a site under development–first time setting up wordpress.