Make WordPress K2 Themes Refresh Faster

The pages with wordpress K2 theme loads fast when you click them, but if you try to refresh the page it will be very slow to load, while other themes don’t have this problem. To fix this follow this guide taken from K2’s forum:

find the folder js inside the K2 folder, then for each .js.php file comment out the ‘require(….. wp-blog-header.php)’ line and replace ‘!get_settings(‘gzipcompression’)’ with ‘( ob_get_length() === FALSE)’. After that the first few lines should look like this:

// check to see if the user has enabled gzip compression in the WordPress admin panel
if ( (ob_get_length() === FALSE) and !ini_get('zlib.output_compression') and ini_get('output_handler') != 'ob_gzhandler' and ini_get('output_handler') != 'mb_output_handler' ) {

Then add the following lines on the top of the files livesearch.js.php and rollingarchives.js.php after the php tag:

// Echo a translated string.
function _e($text, $domain = 'default') {
global $l10n;

if (isset($l10n[$domain]))
echo apply_filters(‘gettext’, $l10n[$domain]->translate($text), $text);
echo $text;

For livesearch.js.php, comments.js.php:
replace all
echo str_replace($_SERVER['DOCUMENT_ROOT'],'',realpath(dirname(__FILE__) . '/../'))
There are two instances of these in comments.js.php, and one in livesearch.js.php.

After all these the pages will refresh very fast.

Original post in which this guide is taken from…

One thought on “Make WordPress K2 Themes Refresh Faster”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>