Display recent posts as thumbnails in sidebar in WordPress 2.9

April 28, 2010

Starting with WordPress 2.9 is no longer need to use custom fields and hacks to have thumbnails in your wordpress articles or even on widgets area, sidebars, footers etc.   For instance, to make a thumbnails area for random latest 10 recent posts, use the following code:   <?php $my_query = new WP_Query('showposts=10&orderby=rand'); if( $my_query->have_posts() ) { echo '<h1>Random Articles</h1>'; while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php $attachments... [Read the full story]

Choose which wordpress sidebar to use

September 26, 2009

WordPress always have to display the same boring sidebar on each page? What can we do? Don’t worry, just create a few sidebar files, upload it to your wordpress theme directory. Then the code follow will do the rest. open single.php and find the call to the get_sidebar() function: <?php get_sidebar(); ?> Replace it by: <?php $sidebar = get_post_meta($post->ID, "sidebar", true); get_sidebar($sidebar); ?> Now when you’ll write a post, create a custom field name sidebar. As a value, give it the name... [Read the full story]

Disable wordpress sidebars without editing template

May 19, 2009

What we’ll be showing you is two quick and easy ways to disable widget areas using your theme’s functions.php file. Technically, what we’ll be doing is disabling the widgets, which is basically the same thing when you get right down to it. This article assumes that your theme sets no default code if no widgets are shown. Otherwise, it is outside the scope of this tutorial. Removing all widget areas What we’ll be doing in this first function is disabling all widgets on the home page. First, open your... [Read the full story]

Display most popular content in wordpress sidebar

March 26, 2009

Highlighting the most popular posts on your site is a great way to send new visitors to your very best content and win them over. What about giving them a quick access to your most commented posts? There are a few different ways you can do this, and quite a few plugins out there to help. What we’re going to do is quite simple, we will set up a query to get an ordered list of your most commented posts from your database, and then display those any way we like. Setting this up as a sidebar widget is very easy. Just copy... [Read the full story]

Add a line break between wordpress sidebar widgets

February 28, 2009

Widgets are great, that is a sure thing. But sometimes, they can be annoying, for exemple when they don’t look the way you want or need. The most common problem seems to be adding a line break between widgets. To add a line break between sidebar widgets, simply open your style.css file and append the following code: .widget{ margin-bottom:25px; } Note that it is possible to add a line break to a specific widget only. You’ll need its css id for that.  Read More →