Automattic / Automattic/jetpack
Shortcodes: [Presentation] shortcode does not work when used outside the main query
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
Moving this from Automattic/themes#9
#### Steps to reproduce the issue
1) Activate the Shoreditch theme.
2) Publish a new page with the Panel Page template.
3) Publish a child page of the Panel Page created in step 2, and add a [presentation] to it.
4) View the Panel Page created in step 2. The presentation does not display.
5) Edit the Panel Page, and add a second [presentation] there.
6) View the Panel Page again. Both presentations will now display.
The plugin appears to look for the presentation shortcode in the main query's content only; Shoreditch uses a new WP_Query to populate a page of children, and the content in this new query is ignored by the presentation plugin.
The same problem happens with the Affinity theme when a [presentation] is added to a page, and then that page is chosen as one of the subpages of the static home page in Customizer -> Theme Options -> Panel 1.
#### What I expected
The presentation shortcode should display a presentation regardless of the context in which it is shown -- within the main query or within a new WP_Query.
#### What happened instead
The presentation shows with an error: "This slideshow could not be started. Try refreshing the page or viewing it in another browser."
Adding a second [presentation] to the parent page "fixes" the issue, because the scripts and styles get properly enqueued.
Contributor guide
Research direction
Reproduce the issue with the Shoreditch theme and a child page containing [presentation], then compare it with the Affinity case described above. Trace how the presentation shortcode is detected and how its scripts and styles are enqueued for content loaded by the main query versus a new WP_Query; done means the presentation displays without the error in both contexts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100