Show Wordpress Posts With a Specific Custom Field and Value

May 14, 2009

Ever wanted to be able to only get the list of wordpress posts which have a specific custom field key as well as a specific value? Sometimes you only want to show wordpress posts that you’ve added a specific custom field to. For instance, lets say you write wordpress host and wordpress template reviews and for each you give them a custom field “review_type” with the value set to either “url” or “template”. So how would you show posts that are only wordpress template reviews? Simply... [Read the full story]

Display the latest author who modified a post

April 22, 2009

WordPress 2.8 will feature a new template tag, the_modified_author(), which allows you to display the latest author who modified the post. Here is how to recreate this function in WordPress 2.7. To create the function, just paste the code below in your functions.php file: if (!function_exists('get_the_modified_author')) { function get_the_modified_author() { global $post; if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) { $last_user = get_userdata($last_id); return apply_filters('the_modified_author',... [Read the full story]

Insert text in wordpress post editor

April 18, 2009

Do you always insert the same text on all your posts, for exemple to tell people to subscribe to your rss feed? If yes, you should definitely set up wordpress to have it automatically inserted in the editor. 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/page editor. This technique will work with both the visual and HTML editor. We’ve established that you shouldn’t edit core files. Then what... [Read the full story]

Display wordpress posts in columns

April 15, 2009

For those of you who want a simple but limited approach (not using a plug-in), here’s the code for your theme for multiple columns within a page. It is set up to use 3 columns but is easy to modify to N columns. To split your post content in columns, the first thing to do is to format your posts that way: potential content goes here that appears before the columns. [--column--] Content for column 1 here. [--column--] Content for column 2 here. [--column--] Content for column 3 here Once done, open your single.php file... [Read the full story]

Get latest sticky posts of wordpress

April 11, 2009

Stciky posts are an awesome new functionality of wordpress, but sadly, retrieving and sorting them isn’t easy as you can expect. 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 five latest sticky posts. Place the following code just before the loop: <?php $sticky = get_option('sticky_posts'); rsort( $sticky ); $sticky = array_slice( $sticky, 0, 5);        ... [Read the full story]

Page 3 of 14«12345»...Last »