Hot to get the post ID within the loop?
-
I put this code in the loop:
<?php $post_id = $post->ID; echo $post_id; ?>
and it gives me this error:
Parse error: syntax error, unexpected T_VARIABLEIf I don’t echo the variable, it doesn’t display any errors.
Any idea?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Hot to get the post ID within the loop?’ is closed to new replies.