Home › Forums › Add-ons › Options Page › ACF With PHP Based Style Sheet › Reply To: ACF With PHP Based Style Sheet
That won’t work. You need to set the id in the post that is requesting the style sheet, not in the file that is generating the style sheet.
Here is a simple example
In the post:
<?php
$queried_object = get_queried_object();
$post_id = $queried_object->ID;
?>
<link rel="stylesheet" href="url/of/file.php?post_id=<?php echo $post_id; ?>" />
In the file generating the stylesheet:
$post_id = $_GET['post_id'];
include("../../../../wp-load.php");
header('Content-Type:text/css');
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.