Asides

I don’t care for them myself, but I just got this working for Danithew, so I figured I’d post the method:

In index.php, find this line:
<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
Comment it out like this:
<?php // if ($posts) : foreach ($posts as $post) : start_wp(); ?>

Right under that, paste this:
<?php
if ($posts) {
function stupid_hack($str) {
return preg_replace('|</ul>s*<ul class="linklog">|', '', $str);
}
ob_start('stupid_hack');
foreach($posts as $post) { start_wp();
?>

The next line should be your date call, and straight under that, paste this:
<?php if (in_category(14) && !$single) { ?>
<ul class="linklog">
<li><?php echo wptexturize($post->post_content); echo ' '; comments_popup_link('(0)', '(1)', '(%)' ) ?></li>
</ul>
<?php } else { ?>

Now scroll down, until you see this:
<?php endforeach; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

Comment those lines out too – like this:
<?php // endforeach; else: ?>
<p><?php //_e('Sorry, no posts matched your criteria.'); ?></p>
<?php // endif; ?>

And instead, paste these lines:
<?php } // end if in category ?>
<?php } } else {
echo '<p>Sorry no posts found.</p>';
}
?>

That should install the ‘Asides’ hack.
NOTE !
1 – BACKUP YOUR INDEX.PHP FIRST
2 – Change the ‘category(14)’ number to the one you have set for your asides.
3 – You will need to style ‘ul linklog’ in your css.

=========

Edit: This has been posted to my ISP space, and is mirrored here as well. Links in the menu.

10 thoughts on “Asides

  1. Good post.

    I like using ‘asides’ because sometimes I just want to post something and add a couple of words as comment. I like to think of it as not needing a full blown post…but needing a little more than just a link.

    I remember it was a pain to put in…but can’t remember exactly why. At least now I know where to point people if they ask how to do it :)

  2. This definitely fits the definition of a ‘hack’ ;).

    If it were me, I’d prefer to implement some basic logic in index.php rather than using text processing on an output buffer to achieve this. Should be faster and harder to break. But you’ll run into some slightly hairy problems if you still want to use an unordered list rather than just a seperate class of divs…

  3. Pingback: heybate.com »

Comments are closed.