Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#33974 closed defect (bug) (fixed)

Theme preview breaks HTML code in theme menu

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

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 11 years ago.

Download all attachments as: .zip

Change History (8)

#1 @hvianna
11 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 11 years ago by hvianna (previous) (diff)

#2 @ocean90
11 years ago

  • Description modified (diff)

@obenland
11 years ago

#3 @obenland
11 years ago

  • Component GeneralPosts, Post Types
  • Keywords has-patch added
  • Milestone Awaiting Review4.4
  • Owner set to obenland
  • Status newaccepted

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

#4 @obenland
11 years ago

  • Version3.0

#5 @obenland
11 years ago

  • Resolutionfixed
  • Status acceptedclosed

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.


11 years ago

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


11 years ago

Note: See TracTickets for help on using tickets.