Tagged: ,

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

    Hi,

    I am trying to add a title to a a nested sidebar menu by hooking into the avia_sidebar_menu_args filter fired in the avia_sidebar_menu function.

    The issue is that if I set a title_li in the $args array which is passed to wp_list_pages, the result will be a complete <ul> menu structure which enfold then wraps around <nav><ul>.
    The resulting HTML, whenever setting a title_li argument, will have a nested <ul> structure which is not valid HTML.

    This also affects the CSS rules applied to the menu items.

    #528987

    Hi ocetechnologies,

    Could you please provide us with a temporary admin login so that we can take a closer look? You can post the details in the Private Content section of your reply.

    Regards,
    Rikard

    #529547

    Hi,

    Thank you for your reply.
    Unfortunately, I cannot provide you access, the site is hosted in a corporate intranet environment.

    You can follow the logical error I am having, if you look into the avia_sidebar_menu function in functions-enfold.php.
    I could override the function in a child theme and have it do what I am expecting it to do, but this is a workaround.
    Since the function exposes a filter to manipulate arguments (avia_sidebar_menu_args) which are then passed into a WordPress function, it should also respect/consider the functionality of that WordPress function.

    A workaround on the issue for me is to use a regex on the sidebar html before rendering it and remove the invalid html tags, but this is still a workaround.

    Example: The code below will produce invalid HTML since it is setting the title_li argument which wp_list_pages will wrap in a ul.

    add_filter('avia_sidebar_menu_args', 'useParentPageAsTitleInSidebarMenu', 11);
    function useParentPageAsTitleInSidebarMenu($args, $post){
        $title = get_the_title($args['child_of']);
        $args['title_li'] = sprintf('<h3>%1$s</h3>', $title);
        return $args;
    }
    #530932

    Hi!

    not sure what you are trying to achieve. Could you highlight your intentions using screenshots please? you can use imgur.com or dropbox.
    Do you get the same error when activating a WordPress default theme?

    Regards,
    Andy

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