Forums
(@ondraa)
13 years, 9 months ago
there is no post/page information available at this point.
well, good to know:)
i found solution based on function url_to_postid()
$url = explode('?', 'https://'.$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); $ID = url_to_postid($url[0]);
with this i can get post/page ID on the start of functions.php file
i am not calling function, on start of functions.php file i want to get ID of post/page and with this ID works inside functions.php file
global $post; $postid = $post->ID;
doesn’t work, $post is empty
you need to create a loop using $wp_query
i dont understand, i want get ID of current post/page (in functions.php file), so i dont know what query i need create…
14 years, 7 months ago
sorry for mistake:
“but a i dont know, how to use a php file in enqueued script”