How To Remove Widgets From WordPress Dashboard
Adding the following snippet in your theme’s functions.php file and you will be able to accomplish the task.
1 2 3 4 5 6 7 |
//Remove unwanted widgets from Dashboard function remove_dashboard_widgets() { global$wp_meta_boxes; unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); } add_action('wp_dashboard_setup', 'remove_dashboard_widgets'); |
Snippet Source/Credit: WP Guru
How To Disable WordPress Post Revision
Simply add the following snippet to your theme’s wp-config.php file and you will be able to disable WordPress post revision.
1 |
define('WP_POST_REVISIONS', false); |
Snippet source/Credit: lesterchan.net
How To Remove Default Author Profile Fields
With the help of following snippet, you will be able to remove default author profile fields in WordPress.
1 2 3 4 5 6 7 |
add_filter('user_contactmethods','hide_profile_fields',10,1); function hide_profile_fields( $contactmethods ) { unset($contactmethods['aim']); unset($contactmethods['jabber']); unset($contactmethods['yim']); return $contactmethods; } |
Snippet Source/Credit: Snipplr
How To Execute Shortcode From Custom Field
The snippet will let you add shortcode to a WordPress custom field while by default; the option is not available by WordPress.
1 |
<?php echo apply_filters('the_content', get_post_meta($post->ID, 'your_custom_field_here', true)); ?> |
Snippet Source/Credit: Leeboyce.co.uk
How To Have Login Form For Your Themes
The following snippet will let you have login form for your themes in WordPress.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
/** * Usage: add user_login_form(); to your theme somewhere. * * */ function user_login_form(){ ?> <form id="loginform" action="<? echo site_url('wp-login.php', 'login_post') ?>" method="post"> <ul id="login_list"> <li> <label for="user_login">Username / Email Address <input type="text" name="log" id="user_login" class="input round" value="<?php echo esc_attr($user_login); ?>" /> </label> </li> <li> <label for="user_pass">Password <input type="password" name="pwd" id="user_pass" class="input round" value="" /> </label> </li> <? do_action('login_form'); ?> <li class="rememberme-check-box"> <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> Remember you? <input type="hidden" name="redirect_to" value="<?php echo esc_attr(get_option('home')); ?>/?action=user" /> </li> <li class="submit"> <a href="<? echo get_option('home'); ?>/?action=user" title="Lost your password? Reset it here..." class="button" id="password-reset"> Forgot Your Password? </a> <input class="button" type="submit" id="signin" value="Sign In" /> </li> </ul> </form> <? } |
How To Create Database For WordPress
Using the following snippet, you will be able to create database for WordPress.
1 2 |
CREATE SCHEMA `your_db_name` ; GRANT ALL PRIVILEGES ON your_db_name.* TO 'your_user_name'@'localhost' IDENTIFIED BY 'your_password'; |
Snippet Source/Credit: Snipplr