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]

Centering a Div Both Horizontally And Vertically

April 7, 2010

While building web page layouts, you’ve probably been faced with a situation where you need to center a div both horizontally and vertically with pure CSS. There are more than a few ways to achieve this, and in this article we are going to show you our favorite involving CSS and jQuery. But first, the basics: Horizontal centering with CSS .className{ margin:0 auto; width:200px; height:200px; } To center a div only horizontally, you need to specify a width, and an auto value for the left and right margins . This... [Read the full story]

Three ways to define a JavaScript class

April 3, 2010

Introduction JavaScript is a very flexible object-oriented language when it comes to syntax. In this article you can find three ways of defining and instantiating an object. Even if you have already picked your favorite way of doing it, it helps to know some alternatives in order to read other people’s code. It’s important to note that there are no classes in JavaScript. Functions can be used to somewhat simulate classes, but in general JavaScript is a class-less language. Everything is an object. And when it... [Read the full story]

Remove Private prefix from wordpress private pages titles

April 1, 2010

We had the situation come up where we need a password-protected post in WordPress. Of course that is super easy in WordPress, you can set up a password for it right in the “Publish” box before publishing. But by default, WordPress appends “Protected: ” to the front of the post title, before and after the password has been entered. Maybe you didn’t like that, and thought that the password box was clue enough that the material was password protected. To remove theses private prefix, simply open your functions.php... [Read the full story]