- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’m trying to come up with a solution for a photography site I am working on using WP.
Here’s what I’m up to:
1) I have a Gallery page, with lots of different sub-pages.
2) Each of these sub-pages is a gallery.
3) For example the New York sub-page will show all posts with a category name of New York.
4) I want to use only ONE page template for each of these gallery sub-pages. So I need a way to dynamically show all posts with a category name equal to the name of the sub-page that is showing those posts.
Does that make sense? Maybe there’s a better way of going about this? Custom fields? Bottom line is I don’t want to have to create a new page template every time a new photo gallery is added.
The following piece of code worked for me, displaying all posts from category three, but of course means that I will have to create a new page template each time I want to add a photo gallery. Not ideal.
I tried using wp-title to grab the name of the gallery and find posts that have that same name:
…but it didn’t seem to work for me. It just returned posts from my blog category.
Anyone have any ideas?
Didn’t wo
Dave, thanks very much for the code. It works great and is a huge help to me.
Thanks!