简体   繁体   中英

Dynamic CSS File in Wordpress

I've created a theme options panel which works fine. My issue is that I can't use get_option() within in a css file.

I'm loading this into the head

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'template_url' ); ?>/lib/display/dynamic-css.php" />

i've set header('Content-type: text/css'); to the dynamic-css.php file but there is know what to use the options set.

Anyone have a solution.

Thanks

Add this line to your dynamic CSS file:

require_once('../../../../wp-load.php');

The path might need to be changed, the file is in the main WP directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM