Display list of wordpress categories in two columns

May 21, 2009

Usually in WordPress, the following code is used to call the categories list (you can find it in one of the sidebar files): <?php wp_list_categories(); ?> Normally when the list of categories is displayed in the sidebar or on any part of the theme, it displays in a single column. Through the following hack, you can split your categories list evenly into two or more columns which can save space and not make your pages longer. Now, we will try and split the categories into two columns. Simply paste the following code... [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]

Get the latest x number of wordpress sticky posts

May 16, 2009

Some of you may be wanted to know how to query a specific number of sticky posts for the front page. we’ll assume you already have the loop set up in one of your template files (i.e., home.php, custom-page.php). What we need to do is call up a specific number of stickies. For this example, we’ll load the two latest sticky posts. Just place following php code before your loop: <?php /* Get all sticky posts */ $sticky = get_option( 'sticky_posts' ); /* Sort the stickies with the newest ones at the top */ rsort(... [Read the full story]

preset text in the WordPress post editor

May 16, 2009

There are built-in action and filter hooks that allow us to change things. We’ll be showing you how to use a simple filter to preset text in the WordPress post or page editor. This technique will work with both the visual and HTML editor. We shouldn’t edit core files. Then what should we edit? Only our theme’s functions.php file. or, we could go through the process of making a plugin, but this is pretty simple stuff. Open your functions.php in your favorite text editor and input following PHP code: <?php add_filter(... [Read the full story]

Add private notes to WordPress posts

May 15, 2009

Sometimes, you may need to leave a private note (e.g. only visible to admin) to a post, but there’s no built-in solution in WordPress to do it. Here’s the code you need to add to your functions.php file: add_shortcode( 'note', 'live_note' ); function live_note( $atts, $content = null ) { if ( current_user_can( 'publish_posts' ) ) return '<div class="note">'.$content.'</div>'; return ''; } Once done, simply add the following shortcode in your posts: [note] This is a note that only someone can... [Read the full story]