Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #945600

    Hi I will display the automatic »page_nesting_nav« (from Settings) with an custom parent in the portfolio sidebar.

    Is that possible?

    Thanks, Timo

    #945614

    Hey pixelsaft,

    No, that isn’t currently supported with the portfolio post type and layout builder elements.

    Best regards,
    Jordan Shannon

    #945622

    Hi Jordan, thanks for the fast respond!

    Is it possible to fetch the nav with an a parameter e. g. the base page id in php?

    I am looking forward to your feedback.

    #946892

    Hi,

    Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Basilis

    #958816

    Hi Basilis,

    we found a way and updated the function “via_sidebar_menu”. We put this into functions.php.

    // Add Parent to Sidebar Menu
    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 = 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];
    		} 
    		// If Portfolio use the Breadcrumb Parent
    		else if ('portfolio' == get_post_type())
    		{
    			
    			$breadcrumbParent  = get_post_meta(avia_get_the_ID(), 'breadcrumb_parent', true);
    			$parent = wp_get_post_parent_id ($breadcrumbParent);
    
    			// Fix if portfolio_entries at Page <- the page will output as Portfolio when added in builder
    			if (!$breadcrumbParent) 
    			{
    			$ancestors  = get_post_ancestors(avia_get_the_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;
    			// Add Parent link
    			$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 reply was modified 6 years, 6 months ago by Pixelsaft GbR.
    #958820

    Hi,

    I’m glad you were able to get this resolved. Also, thank you for sharing the solution as this may help others that have this issue in the future.

    Best regards,
    Jordan Shannon

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