Skip to content


Alternating Comment Classes

This idea expands on something originally done by MooKitty: Comment Backgrounds Hack. Kitty was directly inputting a background in wp-comments.php, but I realized that it made more sense to use an if/else statement and create two classes, comment-even and comment-odd, that could then be styled however the user wished. My end result is like so:

    35  <?php if ($comments) { ?>
    36  <ol id="commentlist">
    37  <?php $i=0; foreach ($comments as $comment) { ?>
    38       <li id="comment-<?php comment_ID() ?>" <?php if($i%2) {echo 'class="comment-even"';} else {echo 'class="comment-odd"';} $i++ ?>>
    39          <?php comment_text() ?>
    40          <p><cite><?php comment_type(); ?> <?php _e("by"); ?> <?php comment_author_l
ink() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php c
omment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
    41          </li>

Using i=0 as a starting point for the counter allows the logic of if / 2 to work as one expects; the first comment is <li id=”comment-blahdiblah” class=”comment-even”>, etc.

I personally would suggest this as a code change for 1.3+.

[Thanks to Carthik's WordLog for pointing me to MooKitty's hack in the first place.]

Posted in WordPress.

SourceForged!

ShowInfo is now a hosted project at SourceForge.net: ShowInfo.

Posted in dev-ShowInfo.

GFMorris.org Running WP1.2

I’ve upgraded GFMorris.org to the latest stable version of WordPress, 1.2-mingus.

Per-category feeds are available; click on a category in the sidebar and add “rss/” or “atom/” to the end of the URL in your browser’s location bar to get such feeds.

Posted in General.

Announcing ShowInfo

I’d like to announce ShowInfo, the concert information database that I’m working up to power the [rocksmyfaceoff.net] family of band fan-sites.

I’ve submitted a request for hosting on SourceForge, and I’m working through the database design with the help of Michael J. Hernandez’s Database Design for Mere Mortals™. I should have a mature database design within the next month; as I complete interim steps in Hernandez’s design process, I’ll be posting that data here for any who might be interested.

Posted in dev-ShowInfo.

Making a Permalink to Daily Archives

If you want to create a permalink in WordPress to all entries on a particular day, it’s pretty simple:

<?php echo mysql2date('Y/m/d', $post->post_date); ?>

For me, I put http://ijsm.org/archives/[echo statement] in an anchor I’ve placed this around my instance of the_date to get a permalink that has the date. I suggest adding a title=”Permalink to entries on this date” to the anchor element in an effort to make it clear to your readers what you are doing.

Posted in WordPress.