1

  I want to use next PHP script to serve combined, pre-gzipped and minified JS and CSS files. source code is available here: https://code.google.com/p/compress/
There is a WAMP localhost with wordpress installed.
And what I have done:

  • added three files (jsmin.php, cssmin.php, compress.php) in child-theme's folder;

  • added directory 'min' in child-theme folder;

  • created file 'compress_timestamp.php'

  • added code below into header.php (tried functions.php then tried first line of header.php)

    require_once('compress_timestamp.php'); //load timestamp created by compress.php module sets field $compress_stamp=unix_timestamp
    if (stripos($_SERVER['HTTP_ACCEPT_ENCODING'],'GZIP')!==false)
    $gz='gz'; else $gz=null; echo '<link rel="stylesheet" type="text/css" href="min/css_schedule_'.$compress_stamp.'.css'.$gz.'" />',PHP_EOL; // the following scripts were combined into css_schedule // echo '<link rel="stylesheet" type="text/css" href="CSS/menu.css" />',PHP_EOL; // echo '<link rel="stylesheet" type="text/css" href="CSS/ThreeColumnFixed.css" />',PHP_EOL; // echo '<link rel="stylesheet" type="text/css" href="CSS/sprite.css" />',PHP_EOL; // echo '<link rel="stylesheet" type="text/css" href="CSS/iCal.css" />',PHP_EOL;


  • changed lines accordingly to child-theme and parent folders:

      echo '<link rel="stylesheet" type="text/css" href="style.css" />',PHP_EOL;
      echo '<link rel="stylesheet" type="text/css" href="../twentyfourteen/style.css" 
    

What was missed and what is the right way to make it work?
And finally when all is done how to launch that script remotely on XAMP (VPS)?

1
  • Ok for now I did not succeed with that PHP compression method. Instead using Pagespped_mod for Apache. Commented Aug 14, 2014 at 6:06

1 Answer 1

1

There is a really good WordPress plugin, called JCH Optimize, that minify css and javascript. Its very easy to install. It has both a free and paid version that comes with a ton more features that can be used to speed up your wordpress site. They also support Joomla.

The support for it is really good too.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.