You are now in How To

Output which theme template file a post/page is using in the header of WordPress

This is a tip to help developers when creating or editing a WordPress template. This is a dead simple code and is especially useful for big templates (like a magazine style or e-commerce). It will show which template are being currently used by WordPress. add_action(‘wp_head’, ‘show_template’); function show_template() { global $template; print_r($template); }

Veja Mais

How to Unregister WordPress Default Widgets

Tired of that huge amount of Widgets list cluttering the add/remove widget page? With this piece of code you are going to be able to remove all that unused ones and keep only the ones you might use. // unregister all default WP Widgets function unregister_default_wp_widgets() { unregister_widget(‘WP_Widget_Pages’); unregister_widget(‘WP_Widget_Calendar’); unregister_widget(‘WP_Widget_Archives’); unregister_widget(‘WP_Widget_Links’); unregister_widget(‘WP_Widget_Meta’); unregister_widget(‘WP_Widget_Search’); unregister_widget(‘WP_Widget_Text’); unregister_widget(‘WP_Widget_Categories’); [...]

Veja Mais

How to Remove Plugin Update Notice for Inactive plugins in WordPress

This is a very easy code to implement that will make the Admin life easier in a WordPress blog. With this code we are going to remove the notice to update plugins that shows even for the inactive ones. function update_active_plugins($value = ”) { /* The $value array passed in contains the list of plugins [...]

Veja Mais

How to Customize WordPress Admin Menu Order

This piece of code allows you to change the position of the elements in the admin menu. All you need to do is click on an existing link in the admin menu and copy everything before the /wp-admin/ URL. In the code below we a new order the admin menu will have: // CUSTOMIZE ADMIN [...]

Veja Mais

How To Add Custom WordPress User Profile Fields

Ever wondered how to add that piece of extra information about the users in your WordPress site? Fear no more! Bellow is a very easy code to implement in your functions.php file that will allow you to add any and every type of information you want to save about your users. // CUSTOM USER PROFILE [...]

Veja Mais

How to Remove Default WordPress Meta Boxes

Want to get rid of some specific Meta Box in WordPress Admin pages where you add or edit pages and blog posts? Thats actually quite easy, besides the fact that you can do that through the top options panel (Screen Options), you can also do that permanently by using the code below in the functions.php [...]

Veja Mais

Set a maximum number of post revisions in WordPress and avoid DB bloat.

By default, WordPress will save an infinite amount of versions of each and every post of yours. That means that some posts, heavily edited, can easily reach 10 or more versions. That ends up causing some really unnecessary loading on your blog, to avoid that you can easily limit the number of revisions by adding [...]

Veja Mais

Include custom post types in the WordPress Search Results

Below is a must do code for anyone working with custom post types in wordpress. It includes those custom post types in the search results of WordPress. // MAKE CUSTOM POST TYPES SEARCHABLE function searchAll( $query ) { if ( $query->is_search ) { $query->set( ‘post_type’, array( ‘site’, ‘plugin’, ‘theme’, ‘person’ )); } return $query; } [...]

Veja Mais

Remove Update Notification for all users except ADMIN User

Are you tired of all that notification on your WordPress Admin showing to every user (no mater which level of permission they might have) that log in? The code bellow you make sure that only the Admin permission level will be able to see the available updates. // REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL [...]

Veja Mais

Modify the Login Logo & Image URL on your WordPress Login Form

Ever wondered how to change the logo of your WordPress Login Form in order to make it more customized? This is something especially useful when you’re selling the site to a customer. Here’s how to do it. The code will allow you to easily modify the WordPress Login page Logo as well as the href [...]

Veja Mais

How To Enable Hidden Admin Feature displaying ALL WordPress Settings

Ever wondered how to enable all WordPress Site configuration on your admin interface? This may be useful mostly when you want to avoid have to access the database of your blog just to change some minor configuration. In order to make it work just paste the code bellow in your functions.php file // CUSTOM ADMIN [...]

Veja Mais

How to Create a Plugin for WordPress

There are two ways of creating a wordpress plugin, the correct way and the common way. The common way is to just throw functions in the main PHP file that goes in the plugin folder and hope that everything works just fine in the millions of different types of wordpress installations. The correct way, is [...]

Veja Mais

How to change your WordPress Domain

This is a problem that many users face sometimes, moving wordpress domains is not an easy task because you have many things to consider, if you just move your files and don’t change the correct configurations in the database you will break everything on your site, another common problem is that after you migrate to [...]

Veja Mais

How To Disable Comments on Wordpres

This is a very common question i have been asked lately. Specially because of the Seo Facebook Comments Plugin. Which many people don’t know is that you can easily disable a comment for a specific post or page by changing a configuration on the edit page of this post or page. All you have to [...]

Veja Mais

How to Pass WordPress Database Information to the Front-End for Javascript/Ajax

Thats one of the nicest things I have recently come across while playing around with wordpress, i was currently trying to pass information from the database, dynamically, to the front end to use this information in ajax requests and dynamic validation with javascript. The key, in this case my friends, is to use the wp_localize_script() [...]

Veja Mais

How to Enable the WordPress Menu Built-In

WordPress implemented a feature for some versions now, the register_nav_menu function, with this method you can create as many menus as you want and handle through the admin panel, which, by the way, it’s a great feature and that was needed for quite a long time. To use this function is very simple, open your [...]

Veja Mais

How to Enable Different Sizes of Post Thumbnails on your WordPress Blog

After version 2.9, wordpress have now a built in function that allows to easily embed thumbnail images into blog posts. I think this feature is very well known nowdays, however there are some other features about that function that not many people know about, that you can, for instance, create many different sizes of images [...]

Veja Mais

How To Add States do the WooCommerce plugin?

I started creating a very small and fast eCommerce on WordPress, so i decided to give the WooCommerce Plugin a go. Must say, the interface is pretty neat but lacks some extra support, like adding new states that I’m about to show you how to do. Btw, this is something really easy to acomplish, all [...]

Veja Mais