Converting HTML entities to characters

I was trying to use WordPress post titles as email subject headers in such a way: $subject = get_the_title(); wp_mail( $to, $subject, $message); However this became a problem when the post title included smart quotes, em-dash, ellipsis and the likes of them. My email subject ended up looking like this: Hey – This is my Post’s Title where … Read more

WordPress 3.1 and setup_postdata

After upgrading one of my websites to WordPress to version 3.1, the loops that contained setup_postdata() created a mess. After some testing, I realised that setup_postdata() will only return the correct data if the argument passed is $post, i.e. setup_postdata($post). I had used setup_postdata( $ancestor ) instead and it created a mess after the upgrade. … Read more

Ways to load template files in WordPress

The below methods mostly uses get_template_directory() to retrieve the parent theme directory and get_stylesheet_directory() if you are using a child theme and retrieving the  of  child theme directory. Using include() and require() These are built-in PHP functions and you can use them to load template files like this. Note that they do not check file … Read more

WordPress Theme Features

Theme features are a must-know for wordpress developers. Theme Features are a set of features defined by theme authors that allows a theme to register support of a certain feature. As of WordPress 3.1, theme features are: Post Thumbnails Navigation Menus Widgets Post Formats Custom Backgrounds Custom Headers Editor Style Automatic Feed Links Theme support … Read more

Drop-ins Plugins

WordPress drop-ins are custom php Must-Use files related to some core files such as db.php, advanced-cache.php and object-cache.php that you can place in the wp-content directory to override the core file with new functionality. List of WordPress Drop-Ins File Type of Plugin Loaded Context advanced-cache.php Advanced caching plugin. on WP_CACHE value Single db.php Custom database … Read more

Must Use Plugins

Must-Use plugins are standard wordpress plugins, just that they reside in the mu-plugins directory (wp-content/mu-plugins). Plugins residing in this directory are automatically activated. The only way to deactivate them is to delete the plugin files from the mu-plugins directory. The plugin files do not need to contain plugin headers, so you just need to create … Read more