| 1 |
<?php |
| 2 |
/** |
| 3 |
* Elementor compatibility. |
| 4 |
* |
| 5 |
* @package OpenStation\Compat |
| 6 |
*/ |
| 7 |
|
| 8 |
defined( 'ABSPATH' ) || exit; |
| 9 |
|
| 10 |
/** |
| 11 |
* Hides Elementor 4's legacy menus from the dock. Elementor keeps its |
| 12 |
* old "Elementor" menu and the Templates menu registered for their URLs |
| 13 |
* and hides both from the classic sidebar with CSS the dock can't see. |
| 14 |
* Keyed on the new `elementor-home` menu: before Elementor 4 these two |
| 15 |
* are its only menus. |
| 16 |
* |
| 17 |
* @param string $placement Dock placement, `'dock'` or `'hidden'`. |
| 18 |
* @param string $menu_slug Menu slug. |
| 19 |
* @return string |
| 20 |
*/ |
| 21 |
function openstation_compat_elementor_dock_placement( $placement, $menu_slug ) { |
| 22 |
if ( 'elementor' !== $menu_slug && 'edit.php?post_type=elementor_library' !== $menu_slug ) { |
| 23 |
return $placement; |
| 24 |
} |
| 25 |
return empty( $GLOBALS['admin_page_hooks']['elementor-home'] ) ? $placement : 'hidden'; |
| 26 |
} |
| 27 |
add_filter( 'openstation_dock_placement', 'openstation_compat_elementor_dock_placement', 10, 2 ); |
| 28 |
|
| 29 |
// Elementor's editor prints its own head, so `admin_head` never fires, |
| 30 |
// and its Document-Isolation-Policy keeps the shell from reading the |
| 31 |
// frame's location: this ping is how a window learns it shows the editor. |
| 32 |
add_action( 'elementor/editor/wp_head', 'openstation_chromeless_navigation_ping_script' ); |
| 33 |
|