Skip to content

Instantly share code, notes, and snippets.

@adrianduffell
Last active November 2, 2023 11:58
Show Gist options
  • Save adrianduffell/9f2cc2f6ac4ebb55a6f0c591d06a1266 to your computer and use it in GitHub Desktop.
Save adrianduffell/9f2cc2f6ac4ebb55a6f0c591d06a1266 to your computer and use it in GitHub Desktop.
CYS hotfix for removing wpcom elements from dynamic image
<?php
/*
* Plugin Name: CYS hotfix for removing wpcom elements from dynamic image
* Author: Adrian Duffell
* Description: Hotfix until the following PR is deployed on Woo Express https://github.com/Automattic/wc-calypso-bridge/pull/1344/f
* Version: 1.0.1
*/
add_action( 'wp_head', 'possibly_remove_wpcom_ui_elements' );
function possibly_remove_wpcom_ui_elements() {
if ( isset( $_GET['cys-hide-admin-bar'] ) ) {
echo '
<style type="text/css">
#wpadminbar,
#wpcom-gifting-banner,
#launch-banner,
#atomic-proxy-bar { display: none !important; }
.woocommerce-store-notice { display: none !important; }
html { margin-top: 0 !important; }
body { overflow: hidden; }
</style>';
echo '
<script type="text/javascript">
( function() {
document.addEventListener( "DOMContentLoaded", function() {
document.documentElement.style.setProperty( "margin-top", "0px", "important" );
} );
} )();
</script>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment