Skip to content

Commit b7f8306

Browse files
committed
Include yoast-seo-adminbar style in AMP dev mode
1 parent 1242987 commit b7f8306

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

inc/class-wpseo-admin-bar-menu.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ public function enqueue_assets() {
115115
$this->asset_manager->enqueue_style( 'adminbar' );
116116
}
117117

118+
/**
119+
* Filter the XPaths for which elements should get the data-ampdevmode attribute.
120+
*
121+
* Note that the data-ampdevmode attribute could alternatively be added via the style_loader_tag filter.
122+
*
123+
* @param string[] $xpaths XPaths.
124+
* @return string[] XPaths.
125+
*/
126+
public function filter_amp_dev_mode_element_xpaths( $xpaths ) {
127+
$xpaths[] = '//link[ @id = "yoast-seo-adminbar-css" ]';
128+
return $xpaths;
129+
}
130+
118131
/**
119132
* Registers the hooks.
120133
*
@@ -129,6 +142,8 @@ public function register_hooks() {
129142

130143
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_assets' ) );
131144
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
145+
146+
add_filter( 'amp_dev_mode_element_xpaths', array( $this, 'filter_amp_dev_mode_element_xpaths' ) );
132147
}
133148

134149
/**

0 commit comments

Comments
 (0)