Get post ID for use in PHP
-
Hi All!
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:<?php
$posts = get_posts('numberposts=1&offset=X')
foreach($posts as $post) :
setup_postdata($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!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Get post ID for use in PHP’ is closed to new replies.