Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
princeehirim
tagDiv Member

Thanks, fixed it!

princeehirim
tagDiv Member

My Javascript and Css is already minified and that was done through my hosting service but it doesn’t minify my HTML.

Chris can you tell me how to manually compress the main theme template.

princeehirim
tagDiv Member

I found some where online, that adding this code to the function.php theme file would minimise HTML for my website.

if ( !is_user_logged_in() ) {
function sanitize_output($buffer) {
$search = array(
‘/\>[^\S ]+/s’, // strip whitespaces after tags, except space
‘/[^\S ]+\</s’, // strip whitespaces before tags, except space
‘/(\s)+/s’ // shorten multiple whitespace sequences
);
$replace = array(
‘>’,
‘<‘,
‘\\1’
);
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
ob_start(“sanitize_output”);
}

I haven’t tried it yet because every time I try to edit my function.php file something goes wrong with my site.

Viewing 3 posts - 1 through 3 (of 3 total)