Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End [Solved]WordPress embed a page in a page

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #26034
    brent
    Member

    So, 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?

    #63610
    TheDoc
    Member

    Hey 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 Three

    Or are you trying to display their content as well?

    Page One Title

    Page One content………….

    Page Two Title

    Page Two Content………….

    #63654
    brent
    Member

    Definitely ‘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.

    #63657
    TheDoc
    Member

    If you’re only needing to loop through child pages of a specific parent, things will be much easier for you.

    http://codex.wordpress.org/Template_Tags/query_posts

    #63658
    brent
    Member

    My 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.

    #63661
    brent
    Member
    Code:
    2, ‘post_parent’ => 130, ‘post_type’ => ‘page’)); ?>

    This seems to be working…Does that seem right?

    #63662
    TheDoc
    Member

    Makes sense to me, just remember that the "2" there will make sure that only a maximum of two pages show.

    #63668
    brent
    Member

    Yeah, I’m still testing and configuring.

    Thanks for all your help.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.