Change footer-text in WP Admin
Using the code will change the text in the bottom of the WP admin pages.
1 2 3 4 5 6 7 8 9 10 11 |
<?php function remove_footer_admin () { echo 'My footer text. Thank you <a href="http://wordpress.org">Wordpress</a> for giving me this filter.'; } add_filter('admin_footer_text', 'remove_footer_admin'); ?> |
Include Future Posts in RSS Feed
Adding the snippet to your theme’s functions.php file will let you appear your future posts in your RSS feed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?php /* Include published and future posts in rss feed. */ function FuturePostsFeed($query) { if ($query->is_feed) { $query->set('post_status','publish,future'); } return $query; } add_filter('pre_get_posts','FuturePostsFeed'); ?> |
Remove meta-boxes
Using this snippet, you can remove the meta-boxes you don’t use.
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 |
<?php function remove_meta_boxes() { # Removes meta from Posts # remove_meta_box('postcustom','post','normal'); remove_meta_box('trackbacksdiv','post','normal'); remove_meta_box('commentstatusdiv','post','normal'); remove_meta_box('commentsdiv','post','normal'); # Removes meta from pages # remove_meta_box('postcustom','page','normal'); remove_meta_box('trackbacksdiv','page','normal'); remove_meta_box('commentstatusdiv','page','normal'); remove_meta_box('commentsdiv','page','normal'); } add_action('admin_init','remove_meta_boxes'); ?> |
Remove Gallery Settings
Gallery setting often make you irritated. The following snippet will simply remove all the gallery settings from the media upload section. All you have to do is simple add the code in your functions.php file.
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 |
<?php add_action( 'admin_head_media_upload_gallery_form', 'mfields_remove_gallery_setting_div' ); if( !function_exists( 'mfields_remove_gallery_setting_div' ) ) { function mfields_remove_gallery_setting_div() { print ' <style type="text/css"> #gallery-settings *{ display:none; } </style>'; } } ?> |
Remove Login Shake
The following snippet has to be added to functions.php and it will remove the “wrong password” screen shake.
1 2 3 4 5 6 7 8 9 10 11 |
<?php function my_login_head() { remove_action('login_head', 'wp_shake_js', 12); } add_action('login_head', 'my_login_head'); ?> |
QR Code With Article Link
To have the QR-code rendered for every article, just insert the following snippet inside the WordPress loop.
1 2 3 4 5 6 7 8 9 |
<img src="http://api.qrserver.com/v1/create-qr-code/?size=500x500&data=" <?php the_permalink() ?> " alt="QR Code for <?php the_title_attribute(); ?> "/> |
Detect iPhone Users
The following snippet will helps you detect visitors which are using an iPhone, allowing you to create a better experience for them.
1 2 3 4 5 6 7 8 9 10 11 |
<?php global $is_iphone; if($is_iphone) { // User in on an iPhone. } ?> |
Remove Pages Columns
The code will allow you to remove a column from pages.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?php function remove_pages_columns($defaults) { unset($defaults['comments']); return $defaults; } add_filter('manage_pages_columns', 'remove_pages_columns'); ?> |
Enable debug mode
Add this to your wp-config.php and you will be able to debug your WordPress blog if something went wrong.
1 2 3 4 5 6 7 |
<?php if ( isset($_GET['debug']) && $_GET['debug'] == 'debug') define('WP_DEBUG', true); ?> |
Check PHP Version
Since WordPress 3.2 version made its debut, PHP 5.2.4 is required for it to run. The time ever since development of plugins for this version come into existence you might require to check that whether the PHP version is up to date or not.
1 2 3 4 5 6 7 8 9 |
<?php if ( version_compare(PHP_VERSION, '5.2.4', '<') ) { wp_die('PHP 5.2.4 is required.'); }; ?> |
Hide admin ‘help’ tab
Seeing the ‘help’ tab all the time in the top right corner of the WordPress admin area will be a devastating experience for your clients. In order to let avoid such conditions on not to happen for them, simply add the following snippet in your functions.php template.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?php // Hide admin help tab function hide_help() { echo '<style type="text/css"> #contextual-help-link-wrap { display: none !important; } </style>'; } add_action('admin_head', 'hide_help'); ?> |
Hide ‘Screen Options’ Tab
If you hated the way the Screen Options tab appearing in front of you in your admin area, then adding this snippet to your functions.php template will do the trick for you. Simply add it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php // Hide admin 'Screen Options' tab function remove_screen_options_tab() { return false; } add_filter('screen_options_show_screen', 'remove_screen_options_tab'); ?> |
Change Admin logo
Give your Admin panel a brand look just like whole of your blog; change the logo in the Admin panel with an image of your choice by using this snippet.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php function custom_admin_logo() { echo '<style type="text/css"> #header-logo { background-image: url('.get_bloginfo('template_directory').'/images/admin_logo.png) !important; } </style>'; } add_action('admin_head', 'custom_admin_logo'); ?> |
Get top level categories / taxonomy
The following code will allow you to get the top level categories and taxonomy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?php $args = array( 'type' => 'post', 'orderby' => 'term_group', 'hide_empty' => 0, 'hierarchical' => 0, 'parent' => 0, 'taxonomy' => '..if you are using a taxonomy instead of a category' ); get_categories( $args ); ?> |
Dynamic copyright text
The snippet below allows you to create an amazing copyright text for your footer by automatically updating the date using the the_date() function. Just add the code in to your footer.php file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<b>(c) <?php echo date('Y'); ?> </b> | <a href=" <?php bloginfo('url'); ?> "> <?php bloginfo('name'); ?> </a> | <?php bloginfo('description'); ?> |
Photo Credit: Flickr/Helen Cook