Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#33974 closed defect (bug) (fixed)

Theme preview breaks HTML code in theme menu

Reported by: progmastery's profile progmastery Owned by: obenland's profile obenland
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: has-patch
Focuses: ui, template Cc:

Description (last modified by ocean90)

Theme preview modifies HTML code of navigation menu in some themes.

Here is an example:
https://wordpress.org/themes/best-magazine/
https://wp-themes.com/best-magazine/

This is how it should be
http://themedemo.web-dorado.com/bestmagazine/

nav menu call parameters:

wp_nav_menu(	array(
'show_home' => true,
'theme_location'  => 'primary-menu',
'container'       => false,
'container_class' => '',
'container_id'    => '',
'menu_class'      => 'top-nav-list',
'menu_id'         => '',
'echo'            => false,
'fallback_cb'     => 'wp_page_menu',
'before'          => '',
'after'           => '',
'link_before'     => '',
'link_after'      => '',
'items_wrap'      => '<ul id="top-nav-list" class=" %2$s">%3$s</ul>',
'depth'           => 0,
'walker'          => ''
));


It seems there is some problem with wrapping menu, but I don't know if this is site issue or something related with WordPress version (ver=4.4-alpha-34443). Therefore I submitted this ticket here , not in w.org meta.

Attachments (1)

33974.diff (498 bytes) - added by obenland 9 years ago.

Download all attachments as: .zip

Change History (8)

#1 @hvianna
9 years ago

Same problem here, with 4.4-alpha-34884

I verified the problem only occurs when you have 'container' => false in wp_nav_menu() and there's no menu assigned to that location (i.e., menu is generated automatically by WP). It then adds a blank tag (the container, that shouldn't be added) which breaks the layout.

Edit: I believe the problem is not related to theme preview (customizer), because it happens in the actual rendering of the site as well.

Last edited 9 years ago by hvianna (previous) (diff)

#2 @ocean90
9 years ago

  • Description modified (diff)

@obenland
9 years ago

#3 @obenland
9 years ago

  • Component changed from General to Posts, Post Types
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.4
  • Owner set to obenland
  • Status changed from new to accepted

wp_page_menu() doesn't have the option to omit a container. 33974.diff will add a fallback.

#4 @obenland
9 years ago

  • Version set to 3.0

#5 @obenland
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 34950:

Template: Add fallback for empty containers.

Since [14031] the container can be omitted in wp_nav_menu(). It can not
however in wp_page_menu(), which creates a conflict if it is set as
the fallback, Let's make sure there is always a valid container tag.

Fixes #33974.

This ticket was mentioned in Slack in #themereview by jcastaneda. View the logs.


9 years ago

This ticket was mentioned in Slack in #core by ocean90. View the logs.


9 years ago

Note: See TracTickets for help on using tickets.