I was trying to optimize the speed of my wordpress blog, and after some searchs (and firebug speed reports), I find this thread...
I have tried to statically generate atahualpa.css & atahualpa.js whenever the theme options are modified (if these files are to be external, of course). I've also modified the header.php file to include static files instead of dynamic ones.
This way the css & js file are not reloaded when their content doesn't change (HTTP header 304). I win about one second with this operation!
By the way, I'm not a PHP expert neither a Atahualpa guru... so if someone can review my code and explain me the good and the bad things, I would enjoy!
Atahualpa theme version 3.4.2
In file /functions/bfa_ata_add_admin.php, line 44 before
PHP Code:
header("Location: themes.php?page=functions.php&saved=true");
I've add :
PHP Code:
global $bfa_ata;
if ( $bfa_ata['css_external'] == "External" ) {
$fp = fopen(TEMPLATEPATH . '/atahualpa.css', 'w');
ob_start();
include (TEMPLATEPATH . '/css.php');
fwrite($fp, ob_get_contents());
ob_end_clean();
fclose($fp);
}
if ( $bfa_ata['javascript_external'] == "External" ) {
$fp = fopen(TEMPLATEPATH . '/atahualpa.js', 'w');
ob_start();
include (TEMPLATEPATH . '/js.php');
fwrite($fp, ob_get_contents());
ob_end_clean();
fclose($fp);
}
and in file header.php, line 10,
I've replaced
PHP Code:
<?php echo $bfa_ata['get_option_home']; ?>/?bfa_ata_file=css
with
PHP Code:
<?php echo $bfa_ata['template_directory']; ?>/atahualpa.css
and line 24, same replacement with js instead of css extension.
Any comments?