solostream

Category: Code Snippets

How to rename widgetized sidebars in WordPress

Rebecca Markowitz | November 20, 2008 | 1 Comment
You can manage multiple sidebar widgets in WordPress. To do so, you go to the Widgets page in the Admin, and select the Sidebar you want to manage. If you have 1 widgetized sidebar, the name "Sidebar 1" is not a big deal for managing it. But what if you have 5 or ... View Post

Publishing WordPress posts in two columns

| March 20, 2008 | 24 Comments
We're currently building a site on Adii's Premium Gazette WordPress theme (this is an affiliate link). In my opinion, it's an awesome theme particularly because of the design. However, we installed it on the client's server of choice, and the posts on the homepage just wouldn't update. We tested it out on different ... View Post

Faviconize your WordPress admin

| January 6, 2008 | 4 Comments
The WordPress admin doesn't have a favicon. That means that when you're working with a bunch of tabs open, it's hard to identify which one is for your WordPress admin. Well, Simply Basic has the solution - simply add one line to wp-admin/admin-header.php that calls the favicon of ... View Post

Using PHP to alternate background colors for comments or posts in WordPress

| December 26, 2007 | 17 Comments
Some blogs have alternating background colors for their comments and posts, i.e. a green background for every even comment and post, and a grey background for every odd comment and post. How do they do that? Alternating Comments Styles To alternate comments, add the following code to your comments.php template file, under where it says <?php ... View Post

Giving each comment its own link in WordPress

| November 28, 2007 | 4 Comments
Being able to link to specific comments in your WordPress blog could be very handy. Good comments can really add a lot of value to a blog, and you or others may want to refer to specific comments in your posts by linking to them. In general, comments can be linked to, but to ... View Post

Giving each WordPress post a thumbnail, and display the thumbnail on the home page

Miriam Schwab | November 21, 2007 | 169 Comments
// You may encounter situations where you need to automatically display a thumbnail or image of some kind that will link to posts. Here's an example of this kind of situation: ... View Post

Hard-coding an SEO friendly title in the WordPress header file

| November 12, 2007 | 5 Comments
The title I am referring to here is the title that appears in the top bar of your browser, and is in betweeen <title></title> tags in your code. Apparently, to make it more SEO friendly, the title of the post or article should appear before the title of your blog, but generally themes have ... View Post

Display recent posts in WordPress sidebar

| November 11, 2007 | 56 Comments
Here's a bit of code to put in your sidebar to display the most recent posts on your blog: <?php $myposts = get_posts('numberposts=10&offset=1'); foreach($myposts as $post) :?> <li><a href="<?php the_permalink(); ?>"><?php the_title();?></a></li> <?php endforeach; ?> You can set the number of recent posts to appear on the first line of code where it says numberposts=10 - change the 10 ... View Post

Recent Comments code snippet

| November 9, 2007 | 35 Comments
This code is from the Blog Oh Blog theme, and displays recent comments in the sidebar without the need for a plugin: <?php global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,30) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password ... View Post

Display posts from specific categories on a Page

| November 8, 2007 | 72 Comments
You may want to display posts from a specific category on the homepage or other pages of your site. For example, you might want to have a box that displays the latest three posts from your News category, or have links to your latest podcasts.... View Post
Page 2 of 3123