Forums

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

Home Forums Back End How can I display all of my pages on a single page in WordPress?

  • This topic is empty.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #33036
    noahgelman
    Participant

    I’m experimenting with a one page design. I want each page in the back end to display as a different section. Is there a way to loop through my pages and display them all?

    #73919
    TheDoc
    Member

    Oooo I like answering the easy WP questions!






    #73826
    noahgelman
    Participant

    I”m not in a place I can test, but I trust you. Thanks a lot Doc.

    #73668
    noahgelman
    Participant

    When they display, they art sorted by their “Order” number, which is fine, But it’s putting the lowest at the bottom. How can I reverse the order they’re displayed?

    #73652
    noahgelman
    Participant

    And also, how could I exclude sub-pages?

    #73734
    TheDoc
    Member

    As far as I know, you can’t exclude subpages when doing a query unless you manually specify the pages.

    You can do that with the ‘depth’ parameter in wp_list_pages though.

    #73696
    noahgelman
    Participant

    Thanks a lot for the help Doc :)

    #73276
    noahgelman
    Participant

    How do I use the depth parameter? I can’t figure it out :(

    #73237
    TheDoc
    Member

    You can only use the depth parameter with wp_list_pages. So something like this:

    This cannot be used with the regular Loop.

    #73166
    noahgelman
    Participant

    Ah, I see.

    So if I wanted to add mark up to the generated pages, but I’m not using a loop, how would I do that?

    #73167
    TheDoc
    Member

    The wp_list_pages function only lists the titles. If you want to have the content show you’ll have to use the loop.

    If you know the IDs of the pages then you can just run a loop of those specific pages. The only thing you can do, really.

    #73152
    noahgelman
    Participant

    Shucks.

    Thanks for all the help Doc

    #72929
    noahgelman
    Participant

    Okay, here is an update. I found a working solution and shows only the top level pages. that I can even add mark up to. But another issue came up. Here is the code:

    
    $pages = get_pages('parent=0');
    foreach ($pages as $pagg) {
    $option .= $pagg->
    ;
    $option .= $pagg->post_title;
    $option .= $pagg->post_content;
    $option .= $pagg->
    ;
    echo $option;
    }
    ?>

    The problem is the content from the pages has been stripped of all it’s html. There’s no formatting in it. Any way I can keep it?

    #120220
    mcneela86
    Participant

    I have a similar question, I want to add all pages (where the user has checked the option while publishing) to add the page to the single page?

Viewing 14 posts - 1 through 14 (of 14 total)
  • The forum ‘Back End’ is closed to new topics and replies.