Inline asides, whatever you want to call them, prompted by Kristin enabling them on her site, this is how you do it with Habari.
There are a couple of things to look at before we get into the actual code:
- Habari doesn’t use categories like WP or MT, we use tags.
- We need to choose a tag that will identify our inline asides.
- The Habari loop is much simpler than what you are used to from something like WP.
Okay, with that out of the way, let talk through what we are going to do to achieve the quickie/inline asides that you see on this site.
We start out with a posts object that contains all of our posts, and all the content therein. This includes the title, link, content, tags and comments. So we first call the Habari loop:
<?php include 'header.php'; ?><div class="content"><div id="primary"><div id="primarycontent" class="hfeed"><?php foreach ( $posts as $post ) { ?>
Now we should have a post object to work with that holds just the data for each post. Next we need to check for the tag we selected to identify our inline asides, in my case this is “quickie”:
<?php if( in_array('quickie', $post->tags ) ) { ?><div id="post-<?php echo $post->id; ?>"><p class="quickie"><a href="<?php echo $post->permalink; ?>" rel="bookmark" title='<?php echo $post->title; ?>'><?php echo $post->title_out; ?></a> ยป <?php echo $post->content; ?> <a href="<?php echo $post->permalink; ?>#comments" title="Comments on this post">(<?php echo $post->comments->approved->count; ?>)</a></p></div><?php } else { ?>// continue with your normal HTML and CSS
And that is it, any entries you write that are tagged with “quickie” will be styled as such, and all other entries will be styled as normal.

Leave a Reply