WordPress.org

Ready to get started?Download WordPress

Forums

Parent title on child child page (1 post)

  1. chocula
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic