If possible I want to insert the ID of a post(from a custom post type) into the html of the post itself when its loaded in the viewport.
The scenario is that the content of the custom post type is surrounded by a
<div>. I want to append an 'id' to the
<div> that includes the ID of the post. For example if the custom post type is glossary and the post ID is 351 then the resulting html would be:
I looked at the conditional statements and googled on the subject but found that
- A lot of applications of finding the Post ID were to do with showing the ID on the page, as opposed to inserting it into the html.
- My almost non existent PHP skills were not up to fathoming out how to use the conditionals to get the result I need.
I'd appreciate any pointers regarding:
- Is this possible
- Any examples of how to approach the problem