Category: PHP

Remove the ‘screen options’ and ‘Help’ from the WordPress admin section

Removing the 'Screen options' tab You can remove the 'screen options' tab completely from your WordPress admin area by adding this to your theme's function.php file // Hide 'Screen Options' tab function remove_screen_options_tab() { return false; } add_filter('screen_options_show_screen', 'remove_screen_options_tab'); Removing the 'Help' tab You can also remove the 'Help' tab from the admin area in … Continue reading Remove the ‘screen options’ and ‘Help’ from the WordPress admin section

Override the from email address and from name in WordPress

This is useful when dealing with contact forms within WordPress. Just add these lines to your theme's functions.php file and replace the variables $from_email and $from_name with your credentials. // OVERRIDE THE FROM EMAIL ADDRESS add_filter('wp_mail_from', 'new_mail_from'); add_filter('wp_mail_from_name', 'new_mail_from_name'); $from_email = "myemail@domain.com"; $from_name = "myname"; function new_mail_from($old) { return $from_email; } function new_mail_from_name($old) { return … Continue reading Override the from email address and from name in WordPress

Customize the wordpress admin and login page

Customizing the login section If you want to remove the standard WordPress logo from the admin login section you'll need to load a new CSS file and override the standard login CSS styles. // Custom WordPress Login function login_css() { wp_enqueue_style( 'login_css', get_template_directory_uri() . '/login.css' ); } add_action('login_head', 'login_css');  This will load the file login.css … Continue reading Customize the wordpress admin and login page

Disable the “please update now” message on the WordPress dashboard for non-administrators

Sometimes when other people like clients need to use the admin section of your wordpress you don't always want them to be able to update to a newer version of wordpress because this can lead to problems with plugins. I you only want administrators to see the update message, add this code to your theme's … Continue reading Disable the “please update now” message on the WordPress dashboard for non-administrators

Template to redirect to child page within the menu for WordPress

I create a file named template-redirect-page.php in my theme’s folder and add this code: /* Template Name: Redirect subpage */ if (have_posts()) { while (have_posts()) { the_post(); $pagekids = get_pages("child_of=".$post--->ID."&sort_column=menu_order"); $firstchild = $pagekids[0]; wp_redirect(get_permalink($firstchild->ID)); } } If I want my parent page to redirect immediately to the subpage I select this template in the admin … Continue reading Template to redirect to child page within the menu for WordPress