[Resolved] Post ID from Slug
Hi guys! Hope you can help.
I’m doing some funky template stuff and I need to pull the ID of a post based on the slug. I’m doing this in a category template – is there a way I can pull the Post ID if I know its slug?
the simplified version of the background story is, I have a post corresponding to each category and I want to be able to display the post at the top of the category template – but it needs to be nice and dynamic so I can’t go hard-coding IDs around the place – the category slug will match the post slug, so I need to pull the post ID based on the slug, so I can use get_post to display it.
Cheers for your help fellas!
- The topic ‘[Resolved] Post ID from Slug’ is closed to new replies.