Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #744818

    Hello.

    I’m trying to add the parent page name as a title to the sidebar navigation for subpages, but I can’t seem to get it to work. Based on other support tickets, I’ve modified the functions-enfold.php file in two different methods and added a function to my child theme’s functions.php file, but this doesn’t seem to be working. Below, I’ve pasted what I’ve tried so far.

    Thanks in advance for your help!

    FOR THE FUNCTIONS-ENFOLD.PHP FILE, I’VE TRIED:

    First trial
    Found:
    $default_sidebar = false;

    Added beneath line above:
    $sidebar_menu .= get_the_title($parent);

    Second trial
    Found:
    $default_sidebar = false;
    $sidebar_menu .= “<nav class=’widget widget_nav_menu $display_child_pages’><ul class=’nested_nav’>”;
    $sidebar_menu .= $children;
    $sidebar_menu .= “</nav>”;

    Replaced with:

    $default_sidebar = false;
    $parent = get_the_title($post->post_parent);
    $parentlink = get_the_permalink($post->post_parent);
    $sidebar_menu .= “<nav class=’widget widget_nav_menu $display_child_pages’><ul class=’nested_nav’>”;
    $sidebar_menu .= “$parent“;
    $sidebar_menu .= $children;
    $sidebar_menu .= “</nav>”;

    FOR THE CHILD THEME’S FUNCTIONS.PHP FILE I ADDED:
    function avia_sidebar_menu($echo = true)
    {
    $sidebar_menu = “”;

    $subNav = avia_get_option(‘page_nesting_nav’);

    $the_id = @get_the_ID();
    $args = array();
    global $post;

    if($subNav && $subNav != ‘disabled’ && !empty($the_id) && is_page())
    {
    $subNav = false;
    $parent = $post->ID;
    $sidebar_menu = “”;

    if (!empty($post->post_parent))
    {
    if(isset($post->ancestors)) $ancestors = $post->ancestors;
    if(!isset($ancestors)) $ancestors = get_post_ancestors($post->ID);
    $root = count($ancestors)-1;
    $parent = $ancestors[$root];
    }

    $args = array(‘title_li’=>”, ‘child_of’=>$parent, ‘echo’=>0, ‘sort_column’=>’menu_order, post_title’);

    //enables user to change query args
    $args = apply_filters(‘avia_sidebar_menu_args’, $args, $post);

    //hide or show child pages in menu – if the class is set to ‘widget_nav_hide_child’ the child pages will be hidden
    $display_child_pages = apply_filters(‘avia_sidebar_menu_display_child’, ‘widget_nav_hide_child’, $args, $post);

    $children = wp_list_pages($args);

    if ($children)
    {
    $default_sidebar = false;
    $sidebar_menu .= “<nav class=’widget widget_nav_menu $display_child_pages’><ul class=’nested_nav’>”;
    $sidebar_menu .= $children;
    $sidebar_menu .= “</nav>”;
    }
    }

    $sidebar_menu = apply_filters(‘avf_sidebar_menu_filter’, $sidebar_menu, $args, $post);

    if($echo == true) { echo $sidebar_menu; } else { return $sidebar_menu; }
    }

    • This topic was modified 7 years, 9 months ago by neuropetvet.
    #746815

    Hey neuropetvet,

    Can you give us a link to thread you have mentioned? also a link to a page in your site where you want the title to put in a sidebar so we can atleast see what layout you are using.

    Best regards,
    Nikko

    #746886

    The link to my page was in the private data section of the support ticket, but here it is again:

    My site is restricted to subscribers so I’ve created a temporary admin user/password for you – see private content

    I think these are the links to support tickets that I’ve tried:
    1. https://kriesi.at/support/topic/show-parent-page-above-nested-subpages-in-sidebar-navigation/
    2. https://kriesi.at/support/topic/add-titles-to-sidebar-navigation/

    #748205

    Bump

    #748676

    Hi,

    Logins did not work for me.

    Can you please refer to my post here – https://kriesi.at/support/topic/add-parent-page-title-to-automatic-sidebar-menu/?

    Best regards,
    Yigit

    #759363

    Thanks! That worked. Sorry for delay getting back to you…was on holiday and then sick.

    You can close the ticket now.

    #759557

    Hi,

    Great, glad you got it working and thanks for the feedback. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Adding parent as title for page sidebar navigation’ is closed to new replies.