get queried posts ID from loop
So I am writing a plugin that does some stuff and I have a widget that I place in my category template sidebar.
I need that widget to get the ID of every queried posts from the main loop, but I am not sure how to go about that. I would assume I need to hook into the loop and for each loop collect the ID?
The widget will then basically arrange the IDs in an array and create a button that links back to my plugin that takes these post ids and does some cool stuff. But I haven’t figured out how to collect the id’s from the current loop.
so basically: How do I collect the Id’s from the loop without editing the template? I need this to work on all loops that show more than one post, category, search result, homepage, everywhere.
I have it working for single posts and regular categories, but for custom loops. For example querying multiple categories and terms, i have no idea how to do it.
- The topic ‘get queried posts ID from loop’ is closed to new replies.