Custom Menu with dynamic title (1 post)

  1. tituz
    Posted 4 years ago #

    Hi everybody!

    I have a problem with a Custom Menu which should display the title of the current parent link item.

    I have 2 navigations, one on the right side that looks like this:
    - sub1 |
    - sub2 |--- (edited with css to display:none;)
    - sub3 |

    and one navigation which is a custom menu in the primary widged area that looks like this:
    .link1 |--- hidden
    .link2 |--- hidden
    - sub1
    - sub2
    - sub3
    .link3 |--- hidden
    .link4 |--- hidden
    .link5 |--- hidden

    what i´m trying to achive is that if i click on .link2 on the main navigation to the right. the parent item should be in the title of the custom menu, so it looks like this:

    link2 = title

    - sub1
    - sub2
    - sub3

    so basically above the sub pages it says where i came from.
    now the problem is i´m still quite new to PHP and i´m not sure how or where i have to make changes (or what to add to the functions.php)?!

    i was investigating already, but couldn´t get close. all i found was something like this:

    //Function for the functions.php file
    function is_child($pageID) {
        global $post;
        if( is_page() && ($post->post_parent==$pageID) ) {
                   return true;
        } else {
                   return false;
    //Code to check parenthood for template file
    if(is_child(343)) {
         echo " title ";

    am i on the right track with that, or do i have to look for something else?!
    i hope somebody with more experience can give me a tip on that, would be nice.


Topic Closed

This topic has been closed to new replies.

About this Topic