Reputation: 866
I did some research over the web and I couldn’t find a way to get post / page id in a php file that serves as a dynamic stylesheet.
The current config of the file (style.php) looks like:
<?php
header( 'Content-type: text/css; charset: UTF-8' );
[...]
define('WP_EXTERNAL', true);
require_once( $base .'wp-load.php' );
global $post;
$meta_info = get_post_meta( $post->ID, '_my_metakey', true );
?>
h1.tut {
background-color: <?php echo $meta_info['bg-url']; ?>;
}
[...]
Upvotes: 0
Views: 490
Reputation: 460
you need to include the files wp--blog-header.php, if you include this file you can access all the functions available on wordpress, this is an example:
define('WP_USE_THEMES', false);
require('./wp-blog-header.php');
Upvotes: 2