We decided to implement a blog on our web site using the popular package WordPress, but we didn’t really want to use their hosting services. In the process of integrating with our existing site we learned a few lessons.
- We wanted to use WordPress as a light Content Management System for News and Events. The tags that can be applied to posts helped us retrieve only news or events, for example get_posts(‘tag=News’,'numberposts=3′). We didn’t want to use Categories because we wanted to save them for our technical content.
- On the main blog page we wanted to exclude News and Events, so we used query_posts(array(‘tag__not_in’ => array(DB_NEWS_TAG_ID, DB_EVENTS_TAG_ID))). We defined the TAG_IDs and wrote our own SQL to eliminate some joins and only retrieve the few fields that we needed.
- For Events on our home page we wanted future events to appear in chronological order descending down the page followed by past events in reverse chronological order. We created a metakey, ‘event_date’, to give us something to sort on and used query_posts(‘meta_key=event_date&tag=HomePage&numberposts=5&orderby=metavalue&order=ASC’), though we later wrote our own SQL.
- We wanted to eliminate the News and Events from the Recent Posts section of the Sidebar, so we modified default-widgets.php with the same tag__not_in syntax.
- Our site uses a lot of css styling and we wanted the look and feel of the blog to be the same, so we created our own theme by copying the default and cutting it back to the bare minimum and then adding back in just the styles we needed. One of our instructors who teaches Dreamweaver CS4: Website Development, one of the Adobe Training courses that we offer, and knows a lot about CSS gave us some advice on how to do this.
- In the end we found that our raw sql for reading content did not fix up the html sufficiently and we went back to using the WordPress rendering functions.
- We had to define our smtp server in wp-config, a step we missed in the WordPress install instructions.
- We also had to give write permissions to the wp-content/uploads directory.
All in all we have found implementing WordPress to have been an interesting learning experience, especially since the php it uses is a long way from the Adobe Flex and Coldfusion that we use and teach and know inside out.