Skip to content

Commit

Permalink
Moved Masterbar initialization to a later point and added a condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
zinigor committed Dec 13, 2018
1 parent 15e2100 commit 386bc5d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions modules/masterbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
* Additional Search Queries: adminbar, masterbar
*/

include dirname( __FILE__ ) . '/masterbar/masterbar.php';
require dirname( __FILE__ ) . '/masterbar/masterbar.php';

new A8C_WPCOM_Masterbar;
// In order to be able to tell if it's an AMP request or not we have to hook into parse_query at a later priority.
add_action( 'parse_query', 'jetpack_initialize_masterbar', 99 );

/**
* Initializes the Masterbar in case the request is not AMP.
*/
function jetpack_initialize_masterbar() {
if ( ! Jetpack_AMP_Support::is_amp_request() ) {
new A8C_WPCOM_Masterbar();
}
}

0 comments on commit 386bc5d

Please sign in to comment.