Get post ID for use in PHP
I’ve got most coding for my little hack done, but I am unable to retrieve the post ID for use in PHP. For a hack I am macking I really need to be able to parse the post ID as a variable.
I am using the following to get the post:
$posts = get_posts('numberposts=1&offset=X')
foreach($posts as $post) :
Is there some way I can get the post ID? The_ID echoes the ID number, but I need to use it as a variable. I am unable to find anything in the support forum or the codex. Any help would really be appreaciated!
Thanks in advance!
- The topic ‘Get post ID for use in PHP’ is closed to new replies.