Create a directory within the wordpress uploads folder

November 19, 2013

When we developing a plugin or theme, it can be useful to be able to programmatically create a directory within the wordpress uploads folder. Simply paste this code snippet on your functions.php file (or plugin file if you’re creating a plugin) function my_upload_dir() { $upload = wp_upload_dir(); $upload_dir = $upload['basedir']; $upload_dir = $upload_dir . '/mypluginfiles'; if (! is_dir($upload_dir)) { mkdir( $upload_dir, 0700 ); } } register_activation_hook( __FILE__, 'my_upload_dir' );  Read More →

Remove the Admin Bar from WordPress

September 17, 2011

There is a new admin bar add to WordPress 3.x that shows up when you are logged in as a subscriber or above. But if you don’t like it and want to remove it, just paste the following code into your functions.php file, save it and goodbye admin bar. add_filter('show_admin_bar', '__return_false');  Read More →

Common set of custom functions for wordpress

May 27, 2010

When designing WordPress themes, we always add a common set of custom functions to the wordpress theme’s functions.php file. This speeds up development time and optimizing many key aspects of WordPress, because we don’t have to hunt for and individually copy the same slew of functions for every theme. In this article, we deliver prime collection of custom functions to enhance your WordPress site. These new functions will help you optimize your development process while enhancing WordPress with essential functionality.... [Read the full story]

Replace wordpress Content in PRE Tags with HTML Entities

May 26, 2010

If you have a website that often display some code on your wordpress, you know the important of converting PRE tag content to their HTML entities. Doing so prevents worlds of possible rendering issues. Just paste the following in your functions.php file. Once saved, it will automatically replace all content within <pre> and </pre> tags by html entities. //replaces pre content with html entities function pre_entities($matches) { return str_replace($matches[1],htmlentities($matches[1]),$matches[0]); } //to... [Read the full story]

Automatically empty wordpress Trash

May 25, 2010

Trash is a new functionality from WordPress 2.9. When an item (post, comment, etc) is deleted, it goes in Trash instead of being permanently removed. Here is a tip to tell your WordPress blog to autmatically empty trash every X days. Simply open your wp-config.php file (located at the root of your WOrdPress install) and paste the following code: define('EMPTY_TRASH_DAYS', 10 ); The second parameter is when to empty trash, in days.  Read More →