schlobben
Member
Posted 3 years ago #
I have searched over and over, so I finally gave up. Anyone know how to get the post id, using the_ID() without having it printed out?
I need it to make a navigation where the active post is highlighted by comparing the post I am reading with the ID's of the posts in the menu.
The global variable $id should have it.. all the_ID() does is:
global $id;
echo $id
function get_the_id() {
global $id;
return $id;
}
schlobben
Member
Posted 3 years ago #
Thank you for that ultra fast reply, and how easy can it be! This should be mentioned in the template tags next to the_ID(), guess it's more ppl than me that has been looking for it!
$id was exactly what I needed!
Thanks!
$post->ID
$post is an object which contains all data about a post directly from the database. There's also $comment.