I am using wordpress 2.2+
I want to get the post id with PHP technical. However, when trying to get that via get_the_ID or $id, it works fine in sidebar.php and footer.php but NOT working in header.php
I think that’s due to a invoking of “the_post”. I tested and found that if I put the the_post() in header.php it could really get the id. However, if I do so, something will be wrong and the post will be not shown.
So is there anyway to get the id before invoking “the_post” in a header.php file?
- The topic ‘How to get the post id BEFORE the_post() is invoked?’ is closed to new replies.