Extremely Useful Tricks for the WordPress Functions File

WordPress websites have turned out to be real swank. It is most widely used platform for blogging and creating websites. WordPress offers some of the preset themes and design that are awesome and saves much time in creating a website. Even there are certain plugins which prevent you from writing bulky codes just to manipulate a line or two in the whole site. You can control everything on a WordPress website by manipulating the Function File of the WordPress theme. The function file is saved as function.php in the theme folder. It contains all sort of functions which control the functioning of the website. You can add any function you desire to get the particular result reflected on the site. Here we have collected some Extremely Useful Tricks for the WordPress Functions File –

  • How to remove WordPress Version Number?

WordPress by default shows its version number in the header of your website. It may be a security concern because if hackers came to know about the version of WordPress you are using, then they may break down into your website. So, To prevent this, you can hide the version number by following these steps-

  1. Open functions.php file of the WordPress theme.
  2. Next, you need to add this code to it
    function wpb_remove_version() {
    
    return '';
    
    }
    
    add_filter('the_generator', 'wpb_remove_version');
  3. Then you can save the file and upload it through FTP.
  • How to Add a Custom Dashboard LOGO?

Adding a custom Dashboard LOGO can be real fun. It not only personalises your website but also gives it a professional look like an institution or company. Also, it would be the first step for adding your site to the white label. Well, adding a custom logo to the dashboard is quite easy, and you can easily do it by modifying the functions.php file-

  1. Open the functions.php file in a text editor.
  2. Next, you need to add these lines of code to it.
    function wpb_custom_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/custom-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>
    
    ';
    
    }
    
    //hook into the administrative header output
    
    add_action('wp_before_admin_bar_render', 'wpb_custom_logo');
  3. Now you can save the file and upload it to the server via FTP.
  • How to Change the footer in WordPress Admin Panel?

If you love customising everything, then we have got you a way to customise the footer in WordPress Admin Panel. By default, WordPress shows thank you for creating with WordPress. You can change the text with whatever you like. It is just a cup of tea as you need to add certain code to the functions.php file of the WordPress theme.

  1. Open the functions.php file
  2. Now you have to add the following code to it.
    function remove_footer_admin () {
    
    echo 'Fueled by <a href="http://www.wordpress.org" target="_blank">WordPress</a> | WordPress Tutorials: <a href="http://www.example.com" target="_blank">Example</a></p>';
    
    }
    
    add_filter('admin_footer_text', 'remove_footer_admin');
  3. You can replace the text with whatever link or text you want. Just make sure that you don’t mess up with the other sections of the code.
  4. After adding the code, you can save the file and upload it to the server.
  • How to add custom Dashboard Widgets in WordPress?

 

Leave a Reply