How to: determine current or selected post ID
-
Greetings, is there a way to retrive the specific ID of the current or selected post? I am trying to setup a system that will generate a unique banner for each post (don’t worry, there will only be about 30 posts total). Instead of using is_single() and specify each ID by hand, I would rather set a variable. Something like:
$banner_name = "insert function to retrieve post ID"
…and then later use the variable to create the filename for the image, like so:
<img src=".../images/filename_<?php echo $banner_name; ?>
The trick is, I don’t know the function. Plus I need this to work OUTside the Loop.
I have looked at:
<?php $wpdb->query('query'); ?>
andquery_posts()
and quite figure them out, or if they are even relevant.Thanks in advance.
- The topic ‘How to: determine current or selected post ID’ is closed to new replies.