Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:Matt/Matt's Asides for 1.3

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>';
    }
    ?>

That should install the 'Asides' hack in 1.3pre-alpha2. 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: »