coding

Differentiate comments and replies with php

In a theme I’m working on I wanted the text on comment replies to change from “comment author says” to “comment author replies” and by adding this piece of code in “…theme-folder/functions.php” I achieved it:

if ($depth == 1):

 //if it's a primary comment, do this
 _e('says', 'blank'); 

else:

 //if it's a comment reply, do this instead
 _e('replies', 'blank'); 

endif;

Quick, easy and neat, just the way we like our code! :D

I’m still a raging noob when it comes to php, but I’m getting better. I’m quite proud that I figured this on out on my own…! *lol*)

Add a sideblog in WP without a plugin

A really easy way to create a sideblog-feature; add this code in sidebar.php or in a text widget (if you have exec php or similar installed):

<?php query_posts('category=7&showposts=10'); ?>

<?php while (have_posts()) : the_post(); ?>

<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>

<?php endwhile; ?>

This specific code would display 10 post from a category with ID=7.

Learn more here.