Rusty has written a plugin which gives the same effect, but means you don't need to mess with the code.

http://russ.innereyes.com/2005/01/the-rustasides-wp-15-plugin/

This will work in any template and any version to date.


This code will enable you to add Matt's Asides to a 1.5 install.


This has been tested and works with 1.5 (Build date 17/01/05) but it works ONLY with the Classic template.
If you are using the Kubrick template, head over to blog @ randomlog where you can get full details.

NOTE: BACKUP YOUR INDEX.PHP FIRST!


Change the 'category(14)' number to the one you have set for your asides.

You will need to style 'ul linklog' in your css. (See below)

  1. In index.php, find this line:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    Comment it out like this:
    <?php //if (have_posts()) : while (have_posts()) : the_post(); ?>
  2. 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();
    ?>
  3. The next line should be your date call, and straight under that, paste this:
    <?php if ( in_category(14) && !is_single() ) : ?>
    <ul class="linklog">
    <li id="p<?php the_ID(); ?>"><?php echo wptexturize($post->post_content); ?>
    <span><?php comments_popup_link('(0)', '(1)',
    '(%)')?> <a href="<?php the_permalink(); ?>"
    title="Permalink: <?php echo wptexturize(strip_tags(stripslashes($post->post_title), '')); ?>"
    rel="bookmark">¶</a> <?php edit_post_link('(e)'); ?></span></li>
    </ul>
    <?php else: // If it's a regular post or a permalink page ?>
  4. At the bottom of the index, you have this:
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    Delete those lines

    And instead, paste these lines:
    <?php endif; // end if in category ?>
    <?php
    }
    }
    else
    {
    echo '<p>Sorry no posts found.</p>';
    }
    ?>
Once working, you can delete the commented-out lines.

Styling.
This is one format for your css, and I only include as much formatting just to illustrate that you have as much control over this as any other element. Change it to suit your page - what I've written here will almost certainly not !
ul.linklog li {
border:1px solid #ff0000;
font:Verdana;
font-size:14pt;
background-color:#ffff00;
}

to change the link behaviour:
ul.linklog li a {
text-decoration:none;
}

This is also a list, and as it is, will have those lovely bullets next to each item. If you are one of that rare breed with a dislike of those black discs, you have four ways of dealing with it.
  1. Add 'list-style:none;' to the ul.linklog li above.
  2. Add 'list-style:lower greek;' to the same part of the css. Other list-style-types can be found at http://www.w3.org/TR/REC-CSS2/generate.html#lists.
  3. Create a small image of your own, and use that. The syntax is 'list-style-image: url('bug.gif');'
  4. Add something to the code above. An example - in the code above is this line:
    ?php echo wptexturize(
    change that part to read:
    ?php echo '&raquo;&nbsp;'; echo wptexturize(
    That will give you the chevrons like this: »

 

These pages are independent of http://wordpress.org
All design, content & images © Mark 2004-2008. All rights reserved.