Display the total number of users of WordPress

April 29, 2009

If your wordpress allow user registration, what about displaying the total number of registered users? This simple code will allow you to do it easily. Simply paste the following code anywhere in your wordpress theme files: $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); echo $users." registered users."; Once you saved the file and refreshed your wordpress, the total number of users will be displayed.  Read More →

Display the total number of your Twitter followers on WordPress

April 22, 2009

If you’re on Twitter, you probably display the number of your followers on your wordpress blog, using the chicklet from TwitterCounter.com. we’ll show you how to display your followers in full text mode. The first thing to do is to paste the following php functions on the functions.php file from your WordPress theme:   function string_getInsertedString($long_string,$short_string,$is_html=false){ if($short_string>=strlen($long_string))return false; $insertion_length=strlen($long_string)-strlen($short_string); ... [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... [Read the full story]