WordPress.org

Ready to get started?Download WordPress

Forums

how to display Pages but not subpages (20 posts)

  1. lordshandor
    Member
    Posted 7 years ago #

    How can I get my sidebar to show my pages but not the subpages of those pages?

  2. tsguitar
    Member
    Posted 7 years ago #

    Did you do a search for this? The answer came up right away, unless I'm missing something about what you want to do:
    http://wordpress.org/support/topic/81528?replies=2

  3. Michael Bishop

    Posted 7 years ago #

    Probably not, and they also double posted, which is highly frowned upon...

  4. tsguitar
    Member
    Posted 7 years ago #

    Well, I'd bet the issue is resolved here. Can someone mark it?

  5. lordshandor
    Member
    Posted 7 years ago #

    where in the sidebar code do Insert this?

    display all pages, depth=-1

  6. tsguitar
    Member
    Posted 7 years ago #

    You currently have list_pages somewhere in your sidebar. All you'd do is all that depth parameter to the existing list_pages line.

  7. lordshandor
    Member
    Posted 7 years ago #

    So it would look like this?

    <?php wp_list_pages display all pages, depth=-1('title_li=<h2>Site Pages</h2>' ); ?>

    • vkaryl
      Member
      Posted 7 years ago #

      You probably need to go to the codex page pertaining to the list pages tag, and read the info regarding parameters. What you posted there won't work.

    • lordshandor
      Member
      Posted 7 years ago #

      Here is the original line

      <?php wp_list_pages('title_li=<h2>Site Pages</h2>' ); ?>

      I am just not sure where to insert it. first time working with php.

    • tsguitar
      Member
      Posted 7 years ago #

      That's not quite how it works. A quick check back to the codex will show you some examples of how to write it. I'll give it a shot, too:
      wp_list_pages('depth=-1&title_li=<h2>' . __('Site Pages') . '</h2>')

      That should do it.

    • lordshandor
      Member
      Posted 7 years ago #

      Tried that but doesn't work. Is it a matter of the ordering?

    • lordshandor
      Member
      Posted 7 years ago #

      The documentation is pretty confusing when you haven't worked with this type of thing before.

      I do appreciate the help though.

    • Michael Bishop

      Posted 7 years ago #

      <?php wp_list_pages('depth=-1&title_li=<h2>Site Pages</h2>' ); ?>

      Should be the exact code.

    • lordshandor
      Member
      Posted 7 years ago #

      I appreciate the reply but didn't work either fi you look on my site on the right bar you see quotes and then under it quotes of buddha and this is after inserting the code you suggested. http://infinite-aspirations.com/

    • tsguitar
      Member
      Posted 7 years ago #

      Can you post the code for your entire sidebar somewhere? A pastebin is a good place.

    • lordshandor
      Member
      Posted 7 years ago #

    • tsguitar
      Member
      Posted 7 years ago #

      I see this:
      <?php wp_list_pages('title_li=<h2>Site Pages</h2>' ); ?>

      But I don't see the code that's been suggested twice. What's the deal?

    • Michael Bishop

      Posted 7 years ago #

      You need to change the code to match what's been suggested.
      http://pastebin.ca/133075

      now reflects the correct code.

    • lordshandor
      Member
      Posted 7 years ago #

      I posted the original code because I didn't want the change to cause problems. I pasted what you have but it didn't work. So I changed it back.

    • lordshandor
      Member
      Posted 7 years ago #

      I posted the original code because I didn't want the change to cause problems. I pasted what you suggested but it didn't work. So I changed it back. I tried what you posted again and it still doesnt work.

    Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.