I’m trying to code a theme where I’ll have a universal gallery page. Basically like:
http://www.engadget.com/galleries/
However I’m at a loss for what I’d use to call all the galleries. I need the galleries to be custom post types (so I have domain.com/gallery/title-of-gallery/), but the galleries also have to be able to be inserted into posts via (or something like that). Also, the galleries have to have some sort of category assigned to them (like Reviews or Previews).
I also need to be able to insert multiple galleries into one post for reviews (where multiple galleries may be needed).
Does anyone have any way I’d be able to achieve this?
The underlying question here is How do I query all posts with image galleries? (since, once you have such a query, creating a custom template page to loop through them is fairly trivial).
One method would be:
attachment
posts with amime_type
ofimage
$post->post_parent
to an arraypost__in
Perhaps like so:
Note that this pulls all posts with even a single image attachment. You could maybe get fancy when looping through image attachments, and do something like: