Category: WordPress Tutorials

10+ WordPress Performance Optimization You Can Do Without Plugin

Website speed is one of the major criteria Google uses to rank your site. If you have a slow site it not only hurts your search engine ranking but is also bad for your users. A performance optimized site not only helps you get higher ranking but also helps you generate more revenue from your site. The question is how can you increase your site’s load time. There are many […]

How to Fetch and Show Posts from a RSS Feed in WordPress

RSS (Rich Site Summary) is a format for delivering regularly changing web content. Many news-related sites, weblogs and other online publishers syndicate their content as an RSS Feed to whoever wants it. If you would like to use RSS feed of some other site to show their latest posts into your site/blog then WordPress has a handy function which you can use to pull the posts from another site. Following code helps you […]

How to Add Unique Image Class in WordPress

If you want to dynamically add your own class to every image added from WordPress Editor then use following code. Add the code into your theme’s functions.php file and change the class according to your requirement. [php] function wphe_image_class_filter($classes) { return $classes . ‘ your_class_name_here’; //make sure to add a space in front of the class name } add_filter(‘get_image_tag_class’, ‘wphe_image_class_filter’); [/php]

How to Bulk Remove Featured Images in WordPress

In WordPress, you can only remove post featured image one by one by editing each post and clicking on the “Remove Featured Image” link, which  is easier to do if you have only few posts but if you have hundreds of posts then removing them one by one can be a daunting task.  But fear not, there is a simpler and easier way to bulk remove  featured image in WordPress. […]

How to Show Default Image if Featured Image is not Added

The “the_post_thumbnail()” function for featured image in WordPress does not shows anything if a featured image is not attached to the post. In case you want to show a default image in your theme if a user has not attached any featured image then use following script: [php] <a href="<?php the_permalink(); ?>"> // adds a hyperlink to the image <?php if ( has_post_thumbnail() ) { //check if featured image is […]

How to Hide Admin Bar for Logged in Users

If you have a WordPress site where end users have to login and you do not want to show the Admin bar to those users then you can disable the Admin bar globally for all users by adding following line of code into your theme’s functions.php file. [php] //Disable WordPress Admin Bar for all users. */ show_admin_bar(false); [/php] If you want to disable the Admin Bar for end user but […]

Change WordPress Login Page Logo

Ever wanted to change the default WordPress logo from the wp-login.php page? Well you can do that easily. Copy following snippet and paste it in your theme’s functions.php file and edit the URL of the image. [php] // login page logo function wphelp_login_logo() { ?> <style type="text/css"> h1 a { background-image: url(<?php echo get_template_directory_uri(); ?>/img/text-logo.png) !important; width:300px !important; height:100px !important; background-size: 300px!important; } </style> <?php } add_action(‘login_head’, ‘wphelp_login_logo’); [/php]

How to add DNS Prefetch in a WordPress Theme without using Plugin

Go to Google, search for any keyword, hold two seconds and then click the first link, that site will open instantly on your browser without showing you any loading progress.  That is called DNS Preftech. Google defines it as: DNS prefetching is an attempt to resolve domain names before a user tries to follow a link. This is done using the computer’s normal DNS resolution mechanism; no connection to Google […]

How to Remove WordPress Dashboard Widgets

Working on a recent project, a client asked me to clean up all the widgets that shown on default WordPress Dashboard as soon as you login. They were not using any of those widgets so wanted to see a clean dashboard upon logging in. Removing default Dashboard Widgets is easy by adding few lines of codes into your theme’s functions.php file. Copy the following code and paste it in your […]