The new Nitefive Wordpress Theme (Part III)
Well, I’ve poured through some of the Wordpress.org documentation, and I think I’m starting to get a hang of how to put this platform to work for the new nitefive.com project. Right now, I’m focusing most of my efforts on the homepage - I have a distinct style and flow in mind, so I want to get that dialed in, and I’ll allow the derivative pages to blend from the main style.
Simple Wordpress tweaking requires a little comfort with the PHP syntax. The online documentation leaves a little something to be desired, for instance not all the calls are defined perfectly nor are there clear lists of the syntax to use on specific variables (specifically, I’m trying to crunch the “query_posts” function efficiently. However, I’ve come up with a pretty short & sweet first hack that gets me closer towards my goal.
<?php get_header(); ?>
<?php
// Homepage specifications …
if (is_home()){
// GET CATEGORIES
$categories = get_categories();
foreach ($categories as $cat){
$catname = $cat->cat_name;
$query = ‘category_name=’ . $catname . ‘&orderby=date&order=DESC’;
query_posts($query);
echo “<h1>” . $catname . “</h1>”;
while (have_posts()) : the_post();
?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile;
}
} ?><?php get_footer(); ?>
That’s actually it… That’s all it took to get Wordpress to actually display posts based on article category. Next step is to start working on the stylesheet to display this information in a useful way. The main idea is that the homepage will feature category-by-category “buckets” to drop content in, and as that content gets older and older it’ll become a smaller part of the homepage. Odds are anything that’s 4 or 5 articles off the latest will get dumped to the category page, and even then older-still articles will dump off to an archives page. We’ll see how things develop. Please note, the code above returns a completely unusable blog - it’s just on display to show the simplest way to get to the category-by-category article release process.
About this entry
Title: The new Nitefive Wordpress Theme (Part III)
- Published:
- 03.04.08
- Category:
- Web Development Projects
No comments
Jump to comment form | comments rss [?] | trackback uri [?]