WordPress.org

Support

Support » How-To and Troubleshooting » Parent title on child child page

Parent title on child child page

  • In my menu i have a structure like this:

    Work
     - item name
        - item detail
        - item detail 2

    What i want is to have the item name title on the item detail pages (with a link) but not the work title on the item name pages – there are a few instances where i need to do this.

    If i add this code to the page.php

    <?php
    $parent_title = get_the_title($post->post_parent);
    echo $parent_title;
    ?>

    Then it shows the parent title on all child pages – i just need to exclude the parent title from the first child.

  • The topic ‘Parent title on child child page’ is closed to new replies.
Skip to toolbar