Making WordPress.org

Opened 11 years ago

Closed 5 years ago

Last modified 5 years ago

#395 closed defect (bug) (fixed)

Unexpected preview result on Themes Directory

Reported by: wikicms's profile wikicms Owned by:
Milestone: Priority: low
Component: Theme Directory Keywords: has-screenshots
Cc:

Description

I opened simultaneously in preview mode two tabs:
No.1 http://wordpress.org/themes/capture
No.2 http://wordpress.org/themes/split-me

If I click on first tab No.1 any link (preview mode active on both tabs) content shows from second No.2 tab to me. What happened? :)

Checked in Yandex.Browser (win) and Mozilla Firefox (linux)

Change History (19)

#1 @Otto42
11 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

The preview works by setting a cookie in your browser telling the site what theme you're previewing. When you load a different theme, then the cookies changes and now you're using another theme. Cookies go across your tabs.

#2 @SergeyBiryukov
11 years ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

I understand the current limitation, but the inability to preview two themes side by side seems counter-intuitive, especially when the core customizer already supports that.

Instead of relying just on the cookie initially set, can we pass the theme slug via an AJAX request when clicking on any link in the iframe, like the customizer does?

This ticket was mentioned in IRC in #wordpress-meta by sams. View the logs.


10 years ago

#5 @samuelsidler
10 years ago

Fwiw, this bug still exists with the new theme directory (not surprising) but now it shows Twenty Fifteen instead of showing the theme in tab 2.

#6 @Otto42
10 years ago

The previewer has not changed in how it operates under the hood. In redoing the preview data, I'll also look at this and see if a better method can be devised.

#7 @Otto42
10 years ago

  • Priority changed from high to low

#8 @SergeyBiryukov
7 years ago

#2943 was marked as a duplicate.

#9 @obenland
7 years ago

  • Owner set to Otto42
  • Status changed from reopened to assigned

#10 follow-up: @joyously
6 years ago

  • Keywords has-screenshots added
  • Priority changed from low to normal

This is not just about seeing two themes at once, or as in #2943 saying it's Safari or as in #145 saying it's old IE.

I am using latest Firefox, and I get the default theme in the preview when clicking a link, whether I'm on the .org Theme page or in the admin Add New theme page. It could be something to do with the browser blocking 3rd party cookies.

https://s33.postimg.cc/8dxbzlk4f/Screenshot_2018-07-18_Twenty8teen_Word_Press_org.png

Last edited 6 years ago by joyously (previous) (diff)

#11 in reply to: ↑ 10 @dd32
6 years ago

  • Priority changed from normal to low

Replying to joyously:

I am using latest Firefox, and I get the default theme in the preview when clicking a link, whether I'm on the .org Theme page or in the admin Add New theme page. It could be something to do with the browser blocking 3rd party cookies.

@joyously That seems to have been a new behaviour and not related to this old ticket.
The cookie values have been ignored for the last ~4 weeks causing all clicks to switch back to the current default theme.
That's now been fixed (dotorg14318 for those with access).

Due to how it's currently working - using cookies, the original report of not being able to preview two themes at the same time is still valid and will require a rearchitecture of the previewer. That's unfortunately a low-priority at present.

Last edited 6 years ago by dd32 (previous) (diff)

#12 @Otto42
6 years ago

  • Owner Otto42 deleted

#13 follow-up: @Otto42
6 years ago

I think I've worked out a simpler solution by adjusting the type of URLs we use in the previewer.

Right now, the previewer uses basic default permalinks for everything:
https://wp-themes.com/?p=19

However, it uses this type of format to set the initial theme (and the cookie):
https://wp-themes.com/twentyfourteen/

If we change the base URL to that, and thus generate all internal links like this, as if it was in a subdirectory:
https://wp-themes.com/twentyfourteen/?p=19

Then we don't need the cookie anymore. Some adjustment of rewrites might be needed, but seems like it should work for any theme.

#14 in reply to: ↑ 13 @dd32
6 years ago

Replying to Otto42:

If we change the base URL to that, and thus generate all internal links like this, as if it was in a subdirectory:
https://wp-themes.com/twentyfourteen/?p=19

I did try that, and didn't run into any issues at the time, simply stripping all the cookie handling and instead adding a pre_option_home filter like this

function home() {
	return WP_HOME . '/' . $this->theme->get_stylesheet();
}

seems to works OK.

PHP combines the GET parameters from the URL and the nginx rules and it was seemingly working fine.

I don't understand the alloptions stuff, as far as I can see it's not even needed, so after stripping that all out i stopped there to avoid breaking something before figuring out what it was trying to do.

#15 @Otto42
6 years ago

The alloptions stuff is there to set the values correctly in the global alloptions values, so as to be the same as those in the theme object. It's not strictly necessary, but having it different than what is in the theme object caused undesirable behavior for some themes.

I'll do some tests with the home filtering, see if I can find any anomalies.

Last edited 6 years ago by Otto42 (previous) (diff)

#16 @dingo_d
5 years ago

EDIT:

This is still not fixed...

Last edited 5 years ago by dingo_d (previous) (diff)

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


5 years ago

#18 @dd32
5 years ago

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

I've altered the Theme Previewer to rely upon the requested path rather than using cookies.

You should be able to open several themes side by side and navigate around without loosing the displayed theme now.
eg:
https://wp-themes.com/twentyten/
https://wp-themes.com/twentyseventeen/
https://wp-themes.com/twentytwenty/

This ticket was mentioned in Slack in #meta by joyously. View the logs.


5 years ago

Note: See TracTickets for help on using tickets.