Tagged: avia, Sidebar Menu
-
AuthorPosts
-
November 2, 2015 at 4:50 pm #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 theavia_sidebar_menu
function.The issue is that if I set a
title_li
in the$args
array which is passed towp_list_pages
, the result will be a complete<ul>
menu structure which enfold then wraps around<nav><ul>
.
The resulting HTML, whenever setting atitle_li
argument, will have a nested<ul>
structure which is not valid HTML.This also affects the CSS rules applied to the menu items.
November 3, 2015 at 5:30 am #528987Hi 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,
RikardNovember 3, 2015 at 6:24 pm #529547Hi,
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 infunctions-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 whichwp_list_pages
will wrap in aul
.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; }
November 5, 2015 at 4:45 pm #530932Hi!
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 -
AuthorPosts
- You must be logged in to reply to this topic.