WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#17686 closed defect (bug) (fixed)

Twenty Eleven's Width changes after first log in to new install

Reported by: blepoxp Owned by: nacin
Milestone: 3.2 Priority: normal
Severity: normal Version: 3.2
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description

Just installed trunk and noticed that the Twenty Eleven theme's width jumped up by several hundred pixels after first log in attempt. I don't have time to track it down in the PHP right now but firebug tells me the following:

After a fresh install, before I log in, the HTML source of the home page looks like this on the body element:

<body class="home blog one-column ">

After logging in and then logging back out and returning to the home page it looks like this:

<body class="home blog two-column content-sidebar">

Attachments (1)

17686.diff (635 bytes) - added by dcowgill 4 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 @nacin4 years ago

  • Milestone changed from Awaiting Review to 3.2

So the issue is that the option is instantiated on admin_init.

Solution: twentyeleven_get_theme_options() should return twentyeleven_get_default_theme_options() if for some reason the option === false. Then on admin we'll properly instantiate it.

comment:2 follow-up: @nacin4 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [18141]:

Sanity check in twentyeleven_get_theme_options() -- if the option doesn't exist, return the default options instead. We already instantiate the option on admin_init. fixes #17686.

comment:3 @blepoxp4 years ago

  • Keywords needs-patch removed

comment:4 in reply to: ↑ 2 @westi4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to nacin:

In [18141]:

Sanity check in twentyeleven_get_theme_options() -- if the option doesn't exist, return the default options instead. We already instantiate the option on admin_init. fixes #17686.

Why not use the built-in default support of get_option instead of reimplementing it?

comment:5 @westi4 years ago

  • Component changed from Themes to Bundled Theme

@dcowgill4 years ago

comment:6 @dcowgill4 years ago

  • Keywords has-patch added

comment:7 @nacin4 years ago

Thanks westi. I usually block that feature from memory as it's better to ensure options are autoloaded.

comment:8 @nacin4 years ago

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

In [18152]:

Use default argument for get_option(). props dcowgill, westi. fixes #17686.

Note: See TracTickets for help on using tickets.