seems I cannot get the ID of a post in my header.php <head> section?
<meta property="og:image" content="<?php swapthumbURL(); get_the_ID(); ?>
in the header returns empty.
doing it after the body tag returns expected result.
(note: the function swapthumbURL() is placed in my functions.php file, and returns the url to a post’s thumbnail at the 50×50 size, thus it “swaps” the post thumbnail out for it’s smaller brother.
so, how can I use a function in the head section which calls to the ID of the post?
some small bit of magic appreciated.
- The topic ‘get ID of post/page in header, cannot do, is there a trick?’ is closed to new replies.