Building a coffeehouse from WordPress
Note: This post is over 2 years old. You may want to check later in this blog to see if there is new information.
The following links are auto-generated but may help you locate newer content:
I’ve recently discovered that it’s relatively simple to turn WordPress into a CMS using basic Template Tags and page templates. This isn’t new information by any means, and is something WordPress was meant to be able to do. But I’m planning to strip down and package my source files when I’m finished with the site so that people can work from them and hopefully get some ideas.
Some of the features that I’ve included are a moo.fx accordian effect for the about information on the main page, an integrated ZenPhoto gallery with Lightbox, an easily edited daily menu and a news page. The news page and daily menu display simultaneously, but are editable separately in the back end. The code to do this is pretty simple, you just have to make two separate queries. Fist I made a news template called page-news.php. At the top of the page you place the code:
PHP:
-
<?php /*
-
Template Name: News
-
*/ ?>
Then you create the template for the news page. Mine has two columns, the left for news, the right for today’s menu and a DB query for each. The fist query calls for all the posts in the category “News”:
PHP:
-
<?php query_posts(‘category_name=News’);?>
Then an if (have_posts()) loop takes over from there, formatting the posts for the column. Once that loop has finished I end the div and begin the second column with a page query:
PHP:
-
<?php query_posts(‘pagename=todaysmenu’) ?>
Then you can run a simplified loop that doesn’t display titles, authors, dates or links. Just the content of the page within the div for the menu. Then create a new WordPress page using the news template, give it a slug of news, make a link to “news” from your main menu, and presto, a dynamic news board with a static menu page, both editable separately on the back end! I know, it’s not that difficult, but I thought I’d share.
Source code for the news page template: page-news.php.zip

CMS» Geekery» template» web design» webdev» wordpress» zenphoto»
Comments are closed
Comments are currently closed on this entry.