Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #35274
    gladavisj
    Member

    Using Catcheverest Pro I can use the custom CSS to hide the header, menu, page title and footer.
    But I want to do this

      conditionally

    ie I want to do this for a specific page (so that its URL can be put into an iframe).
    I have created a template page and want to add a /<?php if( !is_page( ‘1’ ) ) : ?>/ statement somewhere. But where?
    If I try putting it in I just a get a white screen so presumably some key elements of the header are not being called. Where can I put the code so that all the header components are assigned but the header is not displayed?

    #35306
    Sakin
    Keymaster

    @gladavisj: Sorry I don’t understand what you are trying to do it. If you are building custom page template then why do you need condition tag. You can assign your page template to specific page you want.

    Note: when you are adding template or editing any theme files, you need to build child theme and edit it. I hope you haven’t edited core theme files inside ‘catch-everest-pro’ directory. As all the edits in ‘catch-everest-pro’ directory will be reverted back to original when you update the theme.

    #35307
    gladavisj
    Member

    Yes I have a child theme.
    The reason i need the conditional statement is because if my custom template page does not call

    get-header();

    then the site does not show any pages.
    I figured I needed to put in a conditional statement to make sure that all the header variables/settings are assigned but without actually showing the header.
    Sorry I can’t show give you a URL but I am working an offline version of WP with MAMP

    #35339
    gladavisj
    Member

    Correction:
    I have checked the site and it is only the page with the custom template that does not show. All the other pages are ok.
    But if I remove get_header(); from the custom template then the content I

      do

    want to show is in a different format.
    And if I remove <?php get_footer(); ?> then the page is blank

    #35357
    Sakin
    Keymaster

    @gladavisj: You shouldn’t remove get_header(); and get_footer();. These are required.

    if you want to edit that you can either do from action hook or you can copy header.php and footer.php files and add conditional tags.

    For example for pages you can use is_page() or is_page_template(), depending on your requirement.

    #35380
    gladavisj
    Member

    That is my question…
    What part of header.php do I put inside the conditional tags?
    I know that I need the values assigned but I can’t see which part of the php makes the call to display the header (which is the bit that I want to avoid)

    #35429
    Sakin
    Keymaster

    @gladavisj: It depends on what you want to hide it. For example: ff you just want to hide Masthead then you can start you condition tag before
    <header id="masthead" role="banner">
    and end after
    </header><!-- #masthead .site-header -->

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Hide header and footer on selected pages’ is closed to new replies.