Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1331360

    Hi, I am using the default “Page Sidebar navigation” in the Enfold/Sidebars settings. It looks good, but there is no Parent Title displaying. Is there a way to also show it?

    Like this:

    Parent
    – Child 1
    – Child 2
    – Child 3

    Thank you!
    Regards

    #1331423

    Hey ananda,

    Thank you for the inquiry.

    This is possible but you have to modify the avia_sidebar_menu function in the functions-enfold.php file to add the parent page in the list.

    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 .= "<a href='". get_the_permalink($parent) ."'>".get_the_title($parent)."</a>";
    			$sidebar_menu .= "<nav class='widget widget_nav_menu $display_child_pages'>
    <ul class='nested_nav'>";
    			$sidebar_menu .= $children;
    			$sidebar_menu .= "</ul>
    </nav>";
    		}
    	}
    
    	$sidebar_menu = apply_filters('avf_sidebar_menu_filter', $sidebar_menu, $args, $post);
    
    	if($echo == true) { echo $sidebar_menu; } else { return $sidebar_menu; }
    
    }
    

    This is the line that creates the parent page.

    $sidebar_menu .= "<a href='". get_the_permalink($parent) ."'>".get_the_title($parent)."</a>";
    

    Best regards,
    Ismael

    #1331430

    Great Thx Ismael – would be great to have this in the ENFOLD settings as an option, maybe a small feature to add in the future updates…

    Best Regards
    Marko

    #1331567

    Hi,
    Glad Ismael could help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Add Parent Title to Page Sidebar navigation’ is closed to new replies.