WordPress is an open source CMS (Content Managment System) lakhs of people use them daily. So we have to increase the WordPress loading speed in order to open the website within fewer seconds which makes visitors happy and hence visitors won’t be get irritated.We had already covered a successful post on WordPress loading speed and optimization and tested. Here is the link to the previous post
In the previous post we have covered
- Setting up CDN (content Delivery Network) with a WordPress
- Tweaked the .httaccess file like removing hotlinking( protect your images from bandwidth theft)
- optimized images with the wp-minify and wp smush
- Using cache plugin using the Wp-total cache
- Enabling Gzip in the.httaccess
So Now we are moving ahead with adding the Ajax pagination effect in the WordPress blog.
- Log on to your WordPress
- Go to Editor in your WordPress dashboard
- Now you can see source files of your WordPress
- Find the header file (header.php) and click on it.
- Now you can see the header.php code, nowhere you have to add the following code before wp_head() function. You can find the wp_head() function by typing “CTRL +F” then type “wp_head()” and paste the following code before the header function.
// ajax pagination
// if not using wp_pagination, change this to correct ID
link = jQuery(this).attr(
// #main is the ID of the outer div wrapping your posts
// #entries is the ID of the inner div wrapping your posts
// end ready function
- So after adding the code in your header.php and click save button.
- Finally, you have optimized the website faster with Ajax pagination which makes your site even faster.
Making your site faster makes your visitors happy, they will return back soon. Another Advantage of making website faster is you can free of CPU usage problem since most of the web host offers 25% of CPU usages only and you cannot use PHP request beyond 90 seconds. So if you have more CPU Usage, then you’re in trouble, you have to upgrade your shared hosting to VPS, Dedicated Server. I suggest making your website faster with the above techniques and make use of your resources efficiently.