WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Parent/Child/Grandchild Page HTML displaying incorrectly (2 posts)

  1. sunkast
    Member
    Posted 2 years ago #

    I am having an issue with parent and child pages not adding the page HTML in the correct div. I have multiple parent/child levels. Here is an example

    Packages
    - Clowns
    -- Clowns In Long Island

    For the moment, I am simply using the same HTML for both Clowns and Clowns in Long Island. But when I make Clowns in Long Island a parent of Clowns, using the same template and HTML, the HTML is outside of the correct div.

    IE for Clowns, a parent of Packages, using the Package template it's:

    <div id="contents">
    ---<div id="contents-backpage">
    ------<div id="breadcrumbs">
    ------<div id="sidebar">
    ------<div id="main-content-packages">
    ------<div class="addon">
    ---</div>
    </div>

    But for Clowns In Long Island, a child of Clowns, which is a child of Packages, using the same Packages template it becomes:

    <div id="contents">
    ---<div id="contents-backpage">
    ------<div id="breadcrumbs">
    ------<div id="sidebar">
    ---</div>
    ---<div id="main-content-packages">
    ---<div class="addon">
    ---</div>
    </div>

    The main-content-packages div and addon div are outside of contents-backpage rather than inside it like the first child.

    Does anyone know why a child of a child page does this?

  2. sunkast
    Member
    Posted 2 years ago #

    Figured out my issue. The theme was using a custom function called is_child to add certain HTML. But since the new pages were grandchildren, the necessary HTML wasn't be added because is_child only looks at direct children, not grandchildren.

    I found this post: http://wordpress.org/support/topic/check-if-current-page-is-child-or-grandchild-of-a-page?replies=7#post-1787093

    It solved my issue.

Topic Closed

This topic has been closed to new replies.

About this Topic