Skip to content

Instantly share code, notes, and snippets.

@CodeNegar
Created September 23, 2012 13:43
Show Gist options
  • Select an option

  • Save CodeNegar/3771059 to your computer and use it in GitHub Desktop.

Select an option

Save CodeNegar/3771059 to your computer and use it in GitHub Desktop.
php: wordpress generate dynamic style sheet file
<?php
require_once('../../../../wp-load.php');
header("Content-type: text/css");
$days_to_cache = 10;
header('Expires: '.gmdate('D, d M Y H:i:s',time() + (60 * 60 * 24 * $days_to_cache)).' GMT');
$plugin_path = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)); // plugin folder ex: http://localhost/wordpress/wp-content/plugins/dynamic-style/
$some_option = get_option('blogname');
$some_data = 450;
?>
.my_half_width_class { width: <?php echo $some_data; ?>px; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment