- This topic is empty.
-
AuthorPosts
-
September 8, 2009 at 11:46 am #26034
brent
MemberSo, Chris has the new code snippets section, which is really cool. I have a question about this code though:
Code:have_posts()) : $recent->the_post();?>
Is it possible to do the same thing based on the template used by the page you are trying to embed, rather than by its ID?
September 8, 2009 at 7:47 pm #63610TheDoc
MemberHey Brent,
When you say "page", do you actually mean "post"? That can make a huge difference.
If you actually mean "post", it’s very simple, you just assign each post to a category and loop through that category.
But, since you specifically mentioned "pages", let’s see what we can do with that… Off the top of my head, there’s no way to list pages by the template that they are using.
Another question, what are you actually trying to accomplish here? Are you simply listing the pages, like this:
Page One
Page Two
Page ThreeOr are you trying to display their content as well?
Page One Title
Page One content………….
Page Two Title
Page Two Content………….
September 9, 2009 at 1:17 pm #63654brent
MemberDefinitely ‘pages’ not ‘posts’.
I need to display the content, not just their title.The thought process behind displaying them based on their templates was that I only need the content from pages that use a certain template. However, I sat and looked at it and I think that, with a bit of reorganizing, I would only need pages with a certain parent. So, that would be two different ways of filtering the pages that I need…If that makes sense.
September 9, 2009 at 1:55 pm #63657TheDoc
MemberIf you’re only needing to loop through child pages of a specific parent, things will be much easier for you.
September 9, 2009 at 2:11 pm #63658brent
MemberMy thanks, but I need a bit more…How about getting all the children?
This seems, to me, to require that you specify each child page and I’d like to have it get all of them.This code
Code:130
); // retrieve the child page of a parent
?>Is not showing anything on my page.
September 9, 2009 at 2:55 pm #63661brent
MemberCode:2, ‘post_parent’ => 130, ‘post_type’ => ‘page’)); ?>This seems to be working…Does that seem right?
September 9, 2009 at 3:17 pm #63662TheDoc
MemberMakes sense to me, just remember that the "2" there will make sure that only a maximum of two pages show.
September 9, 2009 at 3:50 pm #63668brent
MemberYeah, I’m still testing and configuring.
Thanks for all your help.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.