WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Nest page ancestors in 3.4 R3 (5 posts)

  1. neilscott
    Member
    Posted 1 year ago #

    I have a list of pages with nesting and active states. This does not work at all in 3.4. The only difference is that I have upgraded to the latest release candidate.

    <!-- TOP LEVEL IF STATEMENT-->
    <?php  if (is_page(16) || in_array(16, $post->ancestors))  { ?>
    <h2>ABOUT</h2>
    <ul>
    <!-- SECOND LEVEL PAGE -->
    <?php if (is_page(18) || in_array(18, $post->ancestors))  { ?>
     <li class="openParent current"><a href="/corporate/about/what-we-do/">What we do</a>
    <ul>
    <!-- THIRD LEVEL PAGE ACTIVE STATE IF -->
    <li <?php if (is_page(2398)) {?>class="current" <?php } ?>><a href="/corporate/about/what-we-do/ticketing/">Ticketing</a></li>
    </ul>
    </li>
    <?php } else { ?>
    <li><a href="/corporate/about/what-we-do/">What we do</a></li>
    <?php } ?>
    </ul><?php } ?>
  2. Andrew Nacin
    Lead Developer
    Posted 1 year ago #

    Can you supply more code? Is this in a theme file? Which?

    Does it still not work if you deactivate all plugins?

  3. Ryan Boren
    WordPress Dev
    Posted 1 year ago #

  4. neilscott
    Member
    Posted 1 year ago #

    I have done a bit more diagnostic work.

    I disabled all plugins and added the code to Twenty Eleven and the issue still occurs.

    The bug appears to be that child pages don't recognise their ancestors.

    <?php  if (is_page(16) || in_array(16, $post->ancestors))  { ?>
        IF ONE
        <?php if (is_page(18) || in_array(18, $post->ancestors))  { ?>
            IF TWO
        <?php } ?>
    <?php } ?>

    More info:
    IIS7
    PHP 5.2.17

  5. neilscott
    Member
    Posted 1 year ago #

    I have just applied duck_'s hotfix and that solved the issue for me.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags