Job2 Street

Saturday, June 16, 2018

wordpres - remove header from pages

Viewing 15 replies - 1 through 15 (of 22 total)
  • erator 
    (@zoonini)
    Automattic Happiness Engineer
    Give this a try:
    .site-header {
      display: none;
    }
    Don’t edit the theme files directly, otherwise your changes will be overwritten every time the theme is updated.
    An easy way to add custom CSS is to install the Jetpack plugin and activate theCustom CSS module. You’ll then add your custom CSS in the new stylesheet editor that’ll appear in your dashboard, under Appearance > Edit CSS. You could also install a standalone custom CSS plugin if you prefer.
    A custom CSS editor is also included in the Customizer with WordPress 4.7.
    cameronwaynesmith 
    (@cameronwaynesmith)
    Is there a way to do this on some pages, but not all, like for a landing page?
    taabi 
    (@taabi)
    Kathryn Thanks. It is working but it also removes menu alongwith header. Is there any way menu stays at its place and header removed?
    ModeratorKathryn 
    (@zoonini)
    Automattic Happiness Engineer
    Kathryn Thanks. It is working but it also removes menu alongwith header. Is there any way menu stays at its place and header removed?
    Give this a try:
    .site-branding {
      display: none;
    }
    Is there a way to do this on some pages, but not all, like for a landing page?
    To hide the whole header on every page except the homepage, try:
    .site-header {
      display: none;
    } 
    .home .site-header {
      display: inherit;
    }
    [Edit: fixed typo in code]
    If you want to keep the menu visible, use .site-branding in both places instead of .site-header
    • This reply was modified 10 months ago by  Kathryn. Reason: fixed typo in code
    sansmail 
    (@sansmail)
    Kathryn,
    Thank you so much…it works! But I want to keep the header on the opening post. How do I do that?
    ModeratorKathryn 
    (@zoonini)
    Automattic Happiness Engineer
    Thank you so much…it works! But I want to keep the header on the opening post. How do I do that?
    Could you please provide a link to your site and point out exactly what you mean by the “opening post”? Thanks.
    cameronwaynesmith 
    (@cameronwaynesmith)
    How would I go about hiding the header on one single page?
    ModeratorKathryn 
    (@zoonini)
    Automattic Happiness Engineer
    How would I go about hiding the header on one single page?
    .page-id-XX .site-header {
      display: none;
    }
    Grab the real page ID from the <body> tag on that specific page. If you need help, please provide a link to the page in question.
    sansmail 
    (@sansmail)
    ezerkenegdo.net
    sansmail 
    (@sansmail)
    I could do this but where do I find the <body> tag? Sorry I know just enough to be dangerous.
    ModeratorKathryn 
    (@zoonini)
    Automattic Happiness Engineer
    sansmail – thanks for the link. Sorry, there was a typo in my earlier code. Try:
    
    .site-header {
      display: none;
    } 
    .home .site-header {
      display: inherit;
    }

How to create a WordPress page without header, menu, sidebar and footer?

In this tutorial, we will guide you how to create a WordPress page with no header, menu, sidebar and footer etc. The only content will be what you have entered in the page editor.

Step 1 - Create a WordPress page template file

In your local computer, create a text file, copy the following code and save it as "page-cleanpage.php".
<?php
/**
 * Template Name: Clean Page
 * This template will only display the content you entered in the page editor
 */
?>
 
<html <?php language_attributes(); ?> class="no-js">
<head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php wp_head(); ?>
</head>
<body>
<?php
    while ( have_posts() ) : the_post();   
        the_content();
    endwhile;
?>
<?php wp_footer(); ?>
</body>
</html>

Step 2- Upload the file to your WordPress theme folder

FTP the created file page-cleanpage.php to your WordPress theme folder, which is wp-content -> themes -> yourthemename.

Step 3 - Select the template in the WordPress page editor

In the WordPress page editor, Page Attributes tab, choose Clean Page from the Template drop-down list.
WordPress page without header, menu, sidebar and footer
In the above demo page, I entered a shortcode of WonderPlugin Audio Player, so it only displays the audio player without any other elements.

No comments:

Post a Comment

K-Play

kPlaylist - get your music online

The player will show in this paragraph

2 3

IkimFM

speaker music speaker