WordPress hack: Get rid of HTML in comments

Just paste the code below into your functions.php file. If you prefer to use a plugin with the same functionality, you can grab one here . // This will occur when the comment is posted function plc_comment_post( $incoming_comment ) { // convert everything in a comment to display literally $incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']); // the one exception is single quotes, which cannot be #039; because WordPress marks it as spam $incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] ); return( $incoming_comment ); } // This will occur before a comment is displayed function plc_comment_display( $comment_to_display ) { // Put the single quotes back in $comment_to_display = str_replace( ''', "'", $comment_to_display ); return $comment_to_display; } add_filter( 'preprocess_comment', 'plc_comment_post', '', 1); add_filter( 'comment_text', 'plc_comment_display', '', 1); add_filter( 'comment_text_rss', 'plc_comment_display', '', 1); add_filter( 'comment_excerpt', 'plc_comment_display', '', 1); Thanks to Peter’s useful crap for this nice code! Looking for WordPress hosting?

Direct Link

Read the rest of this entry »

How to easily enable/disable debug mode in WordPress

The first thing to do is to add the following code to your wp-config.php file. This file is located at the root of your WordPress install. if ( isset($_GET['debug']) && $_GET['debug'] == ‘debug’) define(‘WP_DEBUG’, true); Once done, simply add a GET parameter to the url of the page you’d like to debug, as shown below: http://www.wprecipes.com/contact?debug=debug Thanks to Joost de Valk for this great tip! Looking for WordPress hosting?

Direct Link

Read the rest of this entry »

WordPress function: Get category ID using category name

As usual, let’s start by pasting the function in your functions.php file: function get_category_id($cat_name){ $term = get_term_by(‘name’, $cat_name, ‘category’); return $term-> term_id; } Once you saved the file, just call the function with your category name as a parameter. Example: $category_ID = get_category_id(‘WordPress Tutorials’); Looking for WordPress hosting? Try WP Web Host .

Direct Link

Read the rest of this entry »

Display dates as “time ago”, the easy way

To display human readable dates on your blog, you have to use the human_time_diff() function. The following piece of code will show a post date like “Posted 6 days ago”. Paste it anywhere within the loop, save the file, and you’re done.

Direct Link

Read the rest of this entry »

How to programatically remove WordPress dashboard widgets

Simply paste the following into your functions.php file. The code will remove all dashboard widgets, so you should comment lines related to wigets you’d like to keep. function remove_dashboard_widgets() { global $wp_meta_boxes; unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); } if (!current_user_can('manage_options')) { add_action('wp_dashboard_setup', 'remove_dashboard_widgets' ); } Thanks to NoScope for this code! By the way, did you had a look to my latest post on CatsWhoCode about WP 3.0 custom post types?

Direct Link

Read the rest of this entry »

WordPress 3.0 Moving Fast

Actually this should not be a big surprise for those of us who frequent sites like this to see that the latest version of WordPress is moving out the door at this kind of pace. If you want to watch the parade of downloads then you should check out this site: http://wordpress.org/download/counter/ Personally I do not remember a similar download counter on past versions but that does not mean it did not exist.  Maybe someone from WordPress can comment on how this versions download pace compares to past updates. I think that would be interesting to know and compare.

Direct Link

Read the rest of this entry »

What Did You Like In WordPress 3.0?

WordPress 3.0 came out couple of days ago and there might have been people who have upgraded to the latest version of WordPress. Though I am really not impressed with WordPress 3.0 yet and am exploring it throughout (a full review is coming soon ) to be able to explain what it has and what it does not. I found that the latest and greatest update to the best blogging platform does not pack in much features which the end user will find useful.

Direct Link

Read the rest of this entry »

WordPress hack: Display post thumbnail in your RSS feed

Simply paste the following code in your functions.php file. The post thumbnail should be visible once you saved the file. function diw_post_thumbnail_feeds($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '<div>' .

Direct Link

Read the rest of this entry »

WordPress Theme Releases for 05/29

Good morning everyone and welcome to the latest installment of WordPress Theme Releases. Let’s get right to it. Voidy Voidy comes to us from Niyaz of Diovo.com and sports a crisp and clean minimalistic design.

Direct Link

Read the rest of this entry »