Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #355399

    Hi!
    I created a sidebar navigation for all nested subpages. Above these nested pages I would like to show the parent page (‘I am an employer’/’I am an expat’) under which the pages are nested. I don’t see an option for this. How can I do this?

    Thanks in advance!
    Charlotte

    #355679

    Hi Boulanger!

    Open up /enfold/functions-enfold.php and around line 991 you should see this.

    $default_sidebar = false;
    

    Add this beneath it.

    $sidebar_menu .= get_the_title($parent);
    

    Regards,
    Elliott

    #356872

    Hi Elliott,
    Thanks for the quick reply. I’ve added the code (in English version), but nothing happens. What am I doing wrong?

    Regards,
    Charlotte

    #357178

    Hey!

    It’s working fine on my XAMPP setup. Please upgrade the login to administrator so we can take a closer look.

    Cheers!
    Elliott

    #358501

    Yes, done.

    #359077

    Hi!

    It looks like your using a child theme. In this case you’ll need to copy this to the bottom of your child theme functions.php file.

    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 .= get_the_title($parent);
    			$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; }
    }

    Best regards,
    Elliott

    #359181

    The thing is, when I copy the functions.php file to the child theme folder, the site goes all blank. So I don’t get the chance to change the child functions.php. Do you know how this can be?
    Regards,
    Charlotte

    #359738

    Hey!

    Yes that will cause problems. The child theme functions.php file should be blank except for this.

    <?php
    
    ?>

    You can then paste the code in my previous post inside those PHP tags.

    If your still having problems then download our child theme starter here, http://kriesi.at/documentation/enfold/downloads/, and do the edit in that one.

    Regards,
    Elliott

    #360788

    Yes, this works! Thanks!

    Ik only would like the parent layout to be the same as the parent layout in the main menu. I tried to find out but can’t find the right fix. How can I match this style?

    Kind regards,
    Charlotte

    #361102

    Hey!

    Hmm, I’m not sure I understand. Go ahead and take a screenshot and highlight how your wanting to style it so we can get a better idea.

    Best regards,
    Elliott

    #361399

    Hereby a screenshot of the lay out of the main menu. The names of the parent pages (column titles) are much larger in the lay out to set them apart from the rest of the nested subpages.

    I also want this effect for the parent pages (columns titles) in the sidebar.
    Really appreciate your help.

    Regards,
    Charlotte

    #361758

    Hey!

    Change the line to this.

    $sidebar_menu .= '<span>'.get_the_title($parent).'</span>';
    

    And then add this to your custom CSS.

    .inner_sidebar > span { font-size: 17px; color: #919191; }
    

    Best regards,
    Elliott

    #362157

    Hi Elliott,
    I’m not sure which ‘$sidebar_menu .=’-line I need to change.
    If I change the one at the top, nothing happens.
    Regards,
    Charlotte

    #362583

    Hi!

    It’s near the bottom.

    if ($children)
    		{
    			$default_sidebar = false;
    			$sidebar_menu .= get_the_title($parent); // this is the line you edit
    

    Cheers!
    Elliott

    #362754

    Yes! Thanks!
    Cheers!
    Charlotte

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Show parent page above nested subpages in sidebar navigation’ is closed to new replies.