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

    Hello,
    I created a site with individual navigations. My client wants to see ALL subpages of a category in the right column :
    Please look here : http://imerysrefractoryminerals.com/americas/products-2/andalusite/
    Americas has to subpages > Products and Markets with serveral subpages

    Wed like to show all subpages of “Markets” AND” Products” in the right colum – currently we can see only the “Product” subpages – is this possible without doing it manually?

    Thank you in advance,

    AB

    #317768

    Hi!

    This could work, add this to the functions.php file:

    add_filter('avf_sidebar_menu_filter', 'avia_add_parent_page_to_sidebar', 10, 3);
    function avia_add_parent_page_to_sidebar($sidebar_menu, $args, $post)
    {
    	$sidebar_menu2 = "";
    
    	$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 = 750;
    	    $sidebar_menu2 = "";
    
    	    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_menu2_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_menu2_display_child', 'widget_nav_hide_child', $args, $post);
    
    	    $children = wp_list_pages($args);
    
    	    if ($children)
    	    {
    	        $default_sidebar = false;
    	        $sidebar_menu2 .= "<nav class='widget widget_nav_menu $display_child_pages'><ul class='nested_nav'>";
    	        $sidebar_menu2 .= $children;
    	        $sidebar_menu2 .= "</ul></nav>";
    	    }
    	}
    
    	$sidebar_menu .= $sidebar_menu2;
    
        return $sidebar_menu;
    }

    Change 750 by the ID of the other page (Markets/Products).

    Cheers!
    Josue

    #320434

    Hi Josue,

    Thank you, but when I tried I crashed WP and could not login anymore, ouff !! Fortunately my hosting company has a “restore” option.

    I did not understand the replacing ID number and how to add them in the code.

    Is there not a plugin available ?

    Best,

    AB

    #320693

    Hey!

    I tested the code i posted and it worked fine on my install, basically it will create another page list below the normal, automatic one (the ID is needed because the script can not guess which additional page children to bring).

    There are plugins solutions that could work for you like Page List, note that we don’t cover fixes or customizations for third party plugins.

    Regards,
    Josue

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.