Skip to content

Instantly share code, notes, and snippets.

@akshuvo
Forked from bekarice/wp-change-one-page.php
Created July 1, 2018 18:58
Show Gist options
  • Save akshuvo/d761eca981aa1c8abb4dd2577a094abb to your computer and use it in GitHub Desktop.
Save akshuvo/d761eca981aa1c8abb4dd2577a094abb to your computer and use it in GitHub Desktop.
Apply code or styles to a single page in WordPress
/**
* Change styles applied to one page
*
* Uses 'wp' to run after WP class object so page content is available
*/
function sv_hide_header_footer_for_page() {
if( is_page( 2576 ) ) {
?> <style>
header#header,
div.footer-widgets { display:none; }
</style>
<?php
}
}
add_action( 'wp', 'sv_hide_header_footer_for_page' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment