5 Easy Customizations for Your WordPress Website

>5 Easy Customizations for Your WordPress Website
  • code

As a website user, either as a web designer or just the owner of a small business, WordPress gives you a lot of power.

Having the ability to build and fully customize your own WordPress website to suit your needs is a strength which makes a real difference, particularly to small businesses.

But what if you want to customize a few things on your WordPress website? Would you need to hire a developer every time? Or install another plugin that adds more bloat to your website?

Not necessarily!

I’ve created this list of 5 customizations which you can perform on your WordPress website without any risk (ok, maybe just a little!).

These are all changes to the functions.php file, which is a very powerful way of customizing your WordPress website, by adding or changing existing hooks.

So, first, I recommend learning how to access and edit your WordPress website’s files.

I recommend backing up your functions.php file or the whole website before implementing these changes. I also recommend using a child theme, so your changes won’t go away after every theme update!

1. How to change the WordPress logo on the admin login page

WordPress login logo

Whether it’s only you accessing the administrator part of your website, or you have a bunch of people actually doing changes, it’s always nice to get a sense of familiarity by adding your own logo, instead of the WordPress logo.

Here’s how to replace the WordPress logo on the login page:

function business_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/default-login-logo.jpg) !important; }
</style>';
}
add_action('login_head', 'business_login_logo');

Make sure you’ve placed the default-login-logo.jpg file in your theme’s images folder, usually found in /wp-content/themes/your-theme/images/.

If your theme doesn’t have an images folder, you’ll have to create one.

  • You might want to read: Avada vs Divi Theme Comparison on CollectiveRay

2. How to change the WordPress logo from the admin bar

wordpress logo admin bar

Now that you’ve changed the WordPress login logo, you might as well go the whole way and also change the logo from the admin bar, don’t you think?

This is also a fairly simple change, which goes a long way towards branding your website as your own!

function business_admin_logo() {
echo '
<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url(' . get_bloginfo('stylesheet_directory') . '/images/default-admin-logo.png) !important;
background-position: 0 0;
color:rgba(0, 0, 0, 0);
}
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
background-position: 0 0;
}
</style>
';
}
add_action('admin_head', 'business_admin_logo');

Once again, make sure that you add the logo in your theme’s images folder like it’s pointed out above. Or change the above code to reference a logo which you are already using.

3. How to change the WordPress “Howdy” text from the admin bar

wordpress howdy text

Perhaps you want to change the WordPress “Howdy” text to something more informative, or anything else that you might prefer.

Maybe as a web designer, you might want to add a support email or phone number. It’s your choice!

For our example, I’m going to change it to “Logged in as”.

Here’s how to change the “Howdy” text using another code for the functions.php file:

function no_more_howdy( $wp_admin_bar ) {
$my_account=$wp_admin_bar->get_node('my-account');
$newtitle = str_replace( 'Howdy,', 'Logged in as', $my_account->title );
$wp_admin_bar->add_node( array(
'id' => 'my-account',
'title' => $newtitle,
) );
}
add_filter( 'admin_bar_menu', 'no_more_howdy',25 );

4. How to make the featured image required

featured image

Having a featured image comes with a lot of benefits. It improves readability, gives your blog a more professional look, can contribute to brand awareness, and so on.

If you can show users a featured image that’s related to what they are looking for, it’s more likely that they’ll proceed to read the post.

So, in the next tweak, we’re going to implement a change that forces your authors to always add a featured image to your posts or pages.

Add this to your functions.php file:

add_action('save_post', 'wpds_check_featured');
add_action('admin_notices', 'wpds_featured_error');
function wpds_check_featured( $post_id ) {
// change to any custom post type
if( get_post_type($post_id) != 'post' )
return;
if ( ! has_post_thumbnail( $post_id ) ) {
// set a transient to show the users an admin message
set_transient( "has_post_thumbnail", "no" );
// unhook this function so it doesn't loop infinitely
remove_action('save_post', 'wpds_check_featured');
// update the post set it to draft
wp_update_post(array('ID' => $post_id, 'post_status' => 'draft'));
add_action('save_post', 'wpds_check_featured');
} else {
delete_transient( "has_post_thumbnail" );
}
}
function wpds_featured_error() {
// check if the transient is set, and display the error message
if ( get_transient( "has_post_thumbnail" ) == "no" ) {
echo "<div id='message' class='error'><p><strong>You must add a Featured Image before publishing this. Don't panic, your post is saved.</strong></p></div>";
delete_transient( "has_post_thumbnail" );
}
}

Now, If you try to save a post or page without a featured image, you will get a notice to add one.

5. How to delay posting to RSS feed

wordpress rss feed

If your site attracts a lot of visitors via RSS feed, then you might want to delay your articles from being posted there, in order to have time and review them once more, after publishing them.

Sure, we all preview a post before publishing it (at least most of us), but mistakes can still slip through. Or perhaps you forget to add something important to the post, which you don’t want anyone to miss. Happens to me all the time.

So, adding some time before the post gets under everyone’s eyes via RSS, might be a good idea.

For this example, the delay is set to 30 minutes.

Just like the other customization codes, this goes into the functions.php file as well.

function Delay_Feed_After_Publish($where) {
global $wpdb;
if (is_feed()) {
$now = gmdate('Y-m-d H:i:s');
$wait = '30';
$device = 'MINUTE';
$where.=" AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
}
return $where;
}
add_filter('posts_where', 'Delay_Feed_After_Publish');

You can change the wait time from 30 to any value you want.

You might also want to read:

That’s a wrap

Hope you liked the post and found it useful!

Feel free to follow us on Twitter and subscribe to our YouTube channel.

If you want to start your own WordPress blog, or need a website for your business, our WordPress installation service is at your disposal!

You can also purchase a ready-made WordPress website with hosting and support included!

By |2018-08-03T17:06:16+00:00May 1st, 2018|Customization, Tips|0 Comments

Leave A Comment

WP ENGINE OFFER!

20% OFF + 4 months FREE on WordPress hosting
Offer expires on 11/30/2018
To celebrate the release of the Gutenberg editor, WP Engine is offering:
  • 20% OFF the first payment on their shared WordPress hosting plans;
  • 4 months FREE on any annual subscription.

And there's more! Since WP Engine bought StudioPress, all their customers get FREE access to the StudioPress themes, including the Genesis Framework!
 
Disclosure: If you make a purchase using this affiliate link, I might receive a commission from WP Engine, at no additional cost to you! Thank you!
close-link