-
AuthorPosts
-
November 21, 2014 at 6:31 pm #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!
CharlotteNovember 21, 2014 at 11:28 pm #355679Hi 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,
ElliottNovember 24, 2014 at 3:41 pm #356872Hi Elliott,
Thanks for the quick reply. I’ve added the code (in English version), but nothing happens. What am I doing wrong?Regards,
CharlotteNovember 24, 2014 at 10:39 pm #357178Hey!
It’s working fine on my XAMPP setup. Please upgrade the login to administrator so we can take a closer look.
Cheers!
ElliottNovember 26, 2014 at 7:54 pm #358501Yes, done.
November 27, 2014 at 5:12 pm #359077Hi!
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,
ElliottNovember 27, 2014 at 9:41 pm #359181The 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,
CharlotteNovember 28, 2014 at 6:33 pm #359738Hey!
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,
ElliottDecember 1, 2014 at 3:31 pm #360788Yes, 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,
CharlotteDecember 1, 2014 at 10:26 pm #361102Hey!
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,
ElliottDecember 2, 2014 at 11:41 am #361399Hereby 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,
CharlotteDecember 2, 2014 at 8:53 pm #361758Hey!
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,
ElliottDecember 3, 2014 at 4:05 pm #362157Hi Elliott,
I’m not sure which ‘$sidebar_menu .=’-line I need to change.
If I change the one at the top, nothing happens.
Regards,
CharlotteDecember 3, 2014 at 11:38 pm #362583Hi!
It’s near the bottom.
if ($children) { $default_sidebar = false; $sidebar_menu .= get_the_title($parent); // this is the line you edit
Cheers!
ElliottDecember 4, 2014 at 10:08 am #362754Yes! Thanks!
Cheers!
Charlotte -
AuthorPosts
- The topic ‘Show parent page above nested subpages in sidebar navigation’ is closed to new replies.