You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When viewing an Altis site on the frontend, the audience preview in the WP Admin Bar does not work as expected unless you use wp_body_open() which will render the admin bar at the top of the <body> instead of appending it before the end of the <body> element.
Specifically, here is where we are getting the element by ID to then render the React components.
On the Altis demo site, the admin bar is output as the first child element of the body, so when this script is run the admin bar is already able to be selected. On two client sites, the admin bar is output as part of wp_footer() in the footer and therefore this selector is run before the admin bar is rendered and therefore returns without rendering the menu correctly.
I think we should document somewhere that in order for audience previews to work, it is required to use wp_open_body() so the admin bar is rendered before the audience preview script is included.
The text was updated successfully, but these errors were encountered:
Thanks @kevinlangleyjr, we need to connect up when the audience preview script is output and where the admin bar is output. Is this just down the theme and whether it uses that function?
When viewing an Altis site on the frontend, the audience preview in the WP Admin Bar does not work as expected unless you use
wp_body_open()
which will render the admin bar at the top of the<body>
instead of appending it before the end of the<body>
element.Specifically, here is where we are getting the element by ID to then render the React components.
On the Altis demo site, the admin bar is output as the first child element of the body, so when this script is run the admin bar is already able to be selected. On two client sites, the admin bar is output as part of
wp_footer()
in the footer and therefore this selector is run before the admin bar is rendered and therefore returns without rendering the menu correctly.I think we should document somewhere that in order for audience previews to work, it is required to use
wp_open_body()
so the admin bar is rendered before the audience preview script is included.The text was updated successfully, but these errors were encountered: