WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_pages indent (6 posts)

  1. WWDay3
    Member
    Posted 6 years ago #

    I tried adding wp_list_pages to my theme. Sub-pages are not getting indented. I realize this is a CSS issue, but I really don't want to mess with the CSS and take the chance of messing something else up. I'm wondering, is there a trick I can use to "force" sub-pages to indent?

  2. hotkee
    Member
    Posted 6 years ago #

    Nope

  3. WWDay3
    Member
    Posted 6 years ago #

    OK, after I wrote my post I realized I did not provide nearly enough info. So, here it is -

    I have a "special" page that has sub-pages. I wanted to display them in the sidebar - separate from other pages - like this:

    Parent
    Child
    Child
    Child

    I first used

    wp_list_pages('include=19&title_li=')

    but the only page I got was the top page. I then tried

    wp_list_pages('include=19&title_li=')
    wp_list_pages('child_of=19&title_li=')

    which listed the page and sub-pages, but did not indent them.

    So, how can I get to my goal?

  4. WWDay3
    Member
    Posted 6 years ago #

    Ah crap, the formatting got messed up. The goal is

    Parent page
    - Child
    - Child
    - Child

    without the '-' in there.

  5. hotkee
    Member
    Posted 6 years ago #

    <?php
    if($post->post_parent)
    $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
    $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    if ($children) { ?>
    <ul>
    <?php echo $children; ?>
    </ul>
    <?php } ?>

    might achieve something

  6. WWDay3
    Member
    Posted 6 years ago #

    Thanks, I'll try that

Topic Closed

This topic has been closed to new replies.

About this Topic