Support Forum
Hopefully, I can communicate this odd question effectively.
I am using a Genesis theme, and have this little bit of code that adds descriptions to my WP custom menus.
/** Add description to secondary navigation */
add_filter( 'walker_nav_menu_start_el', 'add_description', 10, 4 );
function add_description( $item_output, $item, $depth, $args ) {$args = (array) $args;
if ( $args['theme_location'] === 'primary' ) {
return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . "<span class=\"menu-description\">{$item->post_content}</span><", $item_output );
}
else {
return $item_output;
}}
All works perfectly until I get to the SPF forum page. On that page, it displays the menu descriptions, but below each description adds the word "Forums" below the menu description, colored as if it were a link, but it's not. "Forums" happens to be the page title of my SPF forums page.
Without finding the cause, I created a page template that removed the WP primary navigation menus, and set that page template to the template for my SPF forum page, which seems to work fine. I don't have to have the primary nav on the forums, since I can treat the forums like a landing page of sorts.
So my questions are:
1) is it ok to control the SPF forum page by setting a page template or will that break anything in SPF?
2) any idea why SPF would interact with my little bit of code?
Great, thanks. I had already implemented #1 when I made this post, and I actually prefer taking away the nav menu on the forum, since it introduces its own navigation options with breadcrumbs.
#2 is strange. It gets added after the span, but still inside the markup for each menu item which are list items. It doesn't happen on any other WP page, just SPF, so it's at least SPF-related.
Ok. But why would the page title impact the primary nav? And every list element in the primary nav for that matter?
One thing I did not try but might find the time for is what SPF does when my primary nav is enabled but I do not add the description to it with that code. My previous efforts did not use the Genesis primary nav menu, so the issue may not be with that code but the way 5.0 interacts with the Genesis primary nav menu. I have had previous versions of 5.0 on Genesis where the primary nav menu was enabled, but the Genesis child theme was different and it might have had other stuff going on with the menus that I didn't take into account.
I'll let you know if my testing reveals anything of interest.
Well I know nothing about Genesis so can't really comment.
My point was that a lot of menu type systems are based on the wp_list_pages() or wp_nav_menu() routines which pull in the page titles. Because we alter our page title based on the SEO settings these can pull in out massaged title instead of the page title. Actually they do because of a long-standing and annoying Wp bug.
YELLOW
SWORDFISH
|
1 Guest(s)