Tag Archive
2.7 8.10 9.04 9.10 100th acquisition advertising amd aol apache apple assp ati beta black hole blog browser bug building business caching callback CAN-SPAM can spam act centos chrome clamwin code collider comments compression computer css datacenter delayed development digg documentation earth Edward W. Felten email encryption encyclopedia of life enery eu exploit family fatherhood fedora firefox first plugin folding@home free freeware game Gaming gaming_rig gimp google guides hardware header history home house HPN-SSH icann IE image improvement Infoworld intel Internet ipv6 IT jail kubuntu ldap Leap Day lhc Linux locked files mac mail_server malware me memory microsoft misc money mouse moved Mozilla msdn mysql network solutions nvidia oem open-source os paint_shop_pro patch pc pentium phising php plugin post post-revision protocol ram RC record release review rollover safari samba scammers science SCP screenshots script script kiddies security SEO Series server service pack society software son Sony SP3 spam species squirellmail SSH storage stupidity styling sun tape tech Techozoic theme threaded tip tips ubuntu Unix update utility video card virtualization vista vlite vmware vsphere web weird WHS windows windows 7 wordpress work worm wsus XP xray
WordPress Theme Developers Tip – Call Dynamic CSS the Right Way
While developing my Techozoic theme, I’ve progressed from adding custom CSS into the head section, to having an external file and using $_GET variables to pull options from the database, to now I believe is the right way to do it, using add_filter and a custom query in WordPress. By using this new method I’ve done away with unsafe $_GET variables and can now use any builtin WP functions in the external file.
First you’ll need to edit your functions.php file and add this block of code.
add_filter('query_vars', 'add_new_var_to_wp');
function add_new_var_to_wp($public_query_vars) {
$public_query_vars[] = 'my_theme_custom_var';
//my_theme_custom_var is the name of the custom query variable that is created and how you reference it in the call to the file
return $public_query_vars;
}
This sets up WP to now accept a new variable in a query called my_theme_custom_var the format of the query would be http://www.yourblog.com/index.php?my_theme_custom_var=css . The ? mark tells WP that this is a query and the = sign tells what the query variable should be set to.
Now to actually setup the function that will call the external file. I found this gem when looking at how popular WP theme called Atahualpa handled it’s external CSS.
add_action('template_redirect', 'my_theme_css_display');
function my_theme_css_display(){
$css = get_query_var('my_theme_custom_var');
if ($css == 'css'){
include_once (TEMPLATEPATH . '/style.php');
exit; //This stops WP from loading any further
}
}
This code now will check if a query is passed to WP with the value my_theme_custom_var and if it is and has the value of css then it includes the style.php file which is our dynamic CSS file. Then the code exits which stops any other functions from happening other wise the whole home page is outputted along with the style.php file, which isn’t what is needed only the file.
Now you can use any WP functions on the style.php file as it is included from the functions.php file which is a standard WP file.
Source : Will Norris
Multi-Process Firefox
How many time have you been browsing in Firefox and something hang or crash, not many probably but when it does it takes down the whole browser. Now it seems Mozilla is taking a hint from Google’s Chrome, by splitting tabs into multiple processes that are independent of each other. So if one tabs crashes oh well close it and continue. The development of this project is in the beginning stages and could be up to a year to see a workable release but, it should be worth the wait.
Source: Mozilla Links
