This post will arm you with a list of tips and tricks you can use to optimize WordPress themes. No matter free, premium or your own hand-crafted theme you have. All of them have something to optimize, because this process can be literary endless. But with this list you get some basic tips for optimization.
According to stats at WordPress.com there are over 68 million WordPress sites in the world. It is even hard to imagine a number of people using WordPress for sites and blogs. The most common action for new WordPress users is to find and install a WordPress theme which they can use to make their sites look different from the standard theme. Themes, no matter free, premium, or crafted with your own hands, can be usually improved in many ways. The following list is a sort of a crib for your WordPress theme optimization process.
Use Child Themes
It is doubtless a great trouble to make WordPress themes from an empty folder. The most common way is to modify some existing theme. But the problem is that when you update the basic theme, all the changes you have already made will be lost. A child theme is the easiest and safest way for this. All of your changes can be saved as a separate stand-alone theme or child theme while the original theme keeps its uniformity. A child theme is really the best way to get started.
Use Custom Favicon
Often WordPress themes do not provide a custom favicon for a website. It is a small icon that is displayed in browser tabs and in web address bar. A kind of visual identifier of your website. When a website doesn’t have a favicon, it can look unprofessional. Make sure that your WordPress provides it.
Widgets and Shortcodes Rule!
Shortcodes are probably the easiest and most effective way for adding any kind of content to your page. That is why shortcodes are so important for your theme. It is a simple text tag that you put into a post and then it is replaced by different content. It is a perfect way to add galleries, social buttons, comments, quotes, and many more at ease.
The same thing with widgets. It is essential to let users add widgets to your theme. You have to provide areas where a user will add widgets by drag and drop them into the desired places. The main thing is that there is no need for users to edit PHP themselves, they can use widgets instead.
Don’t Forget to Change Permalink Structure
Use Post Name option or Custom Structure for permalinks. With WordPress “Default” option for permalinks they will look something like this http://www.sample.com/?p=123. Much better representation for users as well as for search engines will be “Post name” option. Http://www.sample.com/sample-post is more informative and looks better. As an option you can make your own custom structure for permalinks.
Use built in WordPress functions wherever possible
Before you add a custom feature to a theme, check if WordPress already has its core function responsible for this. Such approach will not only reduce the size of your theme and simplify it, but will save you from a lot of excessive work.
People expect that every feature and function advertised to work in WordPress in general will work with any theme they choose. This way any updates and bug fixes, released for the WordPress, core will automatically be brought to your theme.
Replace the Theme’s WordPress Core Search Facility
Usually pretty much all WordPress themes, that you may find, use default WordPress core search function. And WordPress search is really not that good. Primarily, because in search results you see most recent items on top of a list, not the most relevant. Besides it does not search through comments or post author names.
A possible solution is to use third-party search services like Google Custom Search, Yahoo! Search BOSS, or the Bing API. Besides using web services by Google, Yahoo and Microsoft’s Bing will not only grant you advanced search experience, but also reduce your server load due to searches.
Optimize Your Images
It is all clear that images are very important part of WordPress theme. But not necessarily all themes are developed considering image optimization. Images are used for CSS background images, logos, icons, default theme images and more. Image optimization will really help to speed up the average web page. That is not only important for users, but to search engines also. If you don’t optimize your images, it may result in much slower performance due to page loading times.
You can optimize image quality in, for example, Photoshop Save for Web feature or in Save As menu by choosing the needed quality. Another recommendation is to use image optimization tool like Smush.it, which will compress the file size without loss in image quality. Besides there is a number of WordPress plugins specifically for this matter like, for example, EWWW Image Optimizer, Lazy Load or Hammy.
To find out what graphics causes speed reduction you can use Google PageSpeed Insights tool to check which theme graphics are causing problems. This free tool will not only highlight you the images that need optimization, but also point on other issues that affect your page speed.
Make Your Best to Limit the Plugins Installed!
Frankly speaking, it should be a user to decide whether to install some plugin or not. Some themes are accompanied by tons of plugins they won’t work without. Though plugins add exceptional opportunities to WordPress, they are often a main reason of slowing it down.
Besides there is always a matter of plugin compatibility with WordPress version and with other plugins installed. Incompatibilities can result in crashes, permanent, or occasional. So try to at least limit a number of required plugins for your theme.
Disable and uninstall plugins that are obviously not used.
Remove Unnecessary Database Calls
Themes are generally designed for mass consumption. That is why they are made flexible. There are lots of dynamic function calls and hooks that let the theme work in lots of ways and situations. However, loading content dynamically from a database can cause lower page speeds and performance in general.
The problem here is that every time a page is being generated, it makes multiple function calls to render a page. You should search for the things that don’t have to be function calls and are not meant to change. And you should replace these excessive calls by static values.
For example, you can put website’s name and tagline in header.php. In this case there will be no need of calling database for this information and it will be displayed immediately.
Instead of dealing with PHP and HTML or preferably in addition to it you can choose another simpler solution: caching. Here again Google PageSpeed Insights will come in handy. It will show you alerts and notes about the status of your website cache. Cache is a place to store copies of your webpage on the server or the user’s device. With caching there is no need to constantly access the WordPress database on each page load. This, of course, increases your website’s speed.
Browser caching on user’s device is most effective. There are lots of handy WordPress plugins for this purpose.
Use the Acknowledged Tools for Testing
The theme check plugin is an easy way to test your theme against the most recent theme review standards which is really a matter of extreme importance. If your theme is missing some necessary features or includes deprecated functions, you will know about it with this plugin. It will also suggest you some possible solutions.
Theme Unit Test is an XML file allowing you to see how your theme works with different types of content. Like posts without title, properly resized images, comments, embeds and more. Importing this file will let you to test your theme in various scenarios.
Your theme must be secure as well. Don’t leave dangerous places through which users can find themselves at threat. The theme must follow the Guidelines: Theme Security and Privacy by the WordPress Theme Review team.
One of the simple tips to protect your theme is to remove the WordPress version number from the theme code. You can do this by extracting the generic WordPress generator code from theme’s
<head> tags. The reason for it is that different WordPress versions have their own vulnerabilities. And knowing the version number of WordPress makes it easier for malefactor to attack.
Another way to protect your WordPress theme is to hide login errors. The matter is that the message one gets when entering a wrong login informs him that such login does not exist. Knowing whether a tried login is correct or not can possibly make it easier to hack a password.
Keep It up to Date
It is also very important to maintain your themes and plugins. Always keep an eye on the news in the WordPress community and plugin releases. This way you can make timely updates to your themes. Test the compatibility of new plugins with the ones installed and with WordPress version itself to be absolutely sure they work just fine. Keep yourself and your themes up to date.
Disagree on any item? Do you have your own tips and tricks for WordPress theme optimization that you want to share? Maybe you even want to express gratitude? Do not hesitate to do all this in the comments section below.