[Support request] Search Page – no header

Home Forums Support Search Page – no header

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #307577
    Dean

    Hi Tom,

    I’ve copied search.php to my child theme to make some customisations.

    I’ve followed your function on https://docs.generatepress.com/article/sidebar-layout/ to remove the sidebar, that’s all great.

    I also want to remove the Header (as I do in the Disable Elements part of the page setup) — as I have a sliding carousel image in GP Hooks that replaces the usual header.

    I’m not sure though how to do this — do I edit search.php (what do I edit? I haven’t changed anything in the file I copied to my child theme yet) … OR do I have that too as another function?

    I’ve searched extensively through the docs and forum posts but can’t find anything relevant — hoping you can help me!

    The page this is on is temporary (as about 90 pages are hidden behind a plain splash page as we are not quite ready for public viewing ) — but I can share any URL if needed.

    Thanks and kind regards,

    Dean

    GeneratePress 1.3.46
    GP Premium 1.2.96
    #307626
    Jamal

    Hi Dean

    I would leave the search.php alone in this situation and use this hook instead https://docs.generatepress.com/article/generate_header/

    Agressively support the kind of work you want to see. Buy it. Talk about it. Review it.

    #307735
    Tom
    Lead Developer
    Lead Developer

    Are you wanting to remove the header across the entire site, or just the search page?

    #307932
    Dean

    Thanks for both replies!

    I really just want to do this for the search page.

    Longer answer:

    Having said that, I have also disabled the header on EVERY page I’ve created (about 100 content pages), using the Disable Elements check box. My header slider is in a GP Hook and my footer is in widgets.

    But when we start to add Posts as blog content, I do want to keep the sidebar — so I’d prefer to have an option just for removing the header on the search page.

    I could use Jamal’s solution I guess with some kind of check in a GP Hook, but think maybe like the Function to remove the search.php sidebar, I can do the same for the header (or edit the child version of search.php).

    I can probably then later too work out how to insert other content into the search page, I haven’t played around with that kind of thing in WordPress for many years, but am happy to test it.

    Thanks again,

    Dean

    #308017
    Tom
    Lead Developer
    Lead Developer

    You could try this function:

    add_action( 'after_setup_theme','tu_remove_search_header' );
    function tu_remove_search_header() {
        if ( is_search() ) {
            remove_action( 'generate_header','generate_construct_header' );
        }
    }
    #308025
    Dean

    Thanks Tom, I added that to my Functions.php file but unfortunately it hasn’t changed the output — the header still appears on the search results page.

    I have tried searches in a couple of different browsers, doesn’t seem to be a caching issue (I’m not yet running a cache plugin either, and my hosting isn’t cloud-based).

    Happy to show you specific page links if that helps …

    Kind regards,
    Dean

    #308189
    Tom
    Lead Developer
    Lead Developer

    What version of GP are you using?

    Are you using a child theme? If so, any custom template files (like header.php)?

    #308321
    Dean

    Hi Tom,

    Using GeneratePress 1.3.46 and GP Premium 1.2.96.

    No custom template files in my child theme. I have copied across the search.php file from the main GP files, that’s all. And it hasn’t been edited.

    I have a GP hook for my elementor image slider that I use instead of a header.

    And on most pages I have the Header, Content Title disabled, and full content (no sidebars).

    The only functions I have are for the sidebar removal (as mentioned in my original post) and now this function you’ve suggested above.

    Otherwise nothing else I can think of.

    Given I do have the Header removed everywhere — and I only want the *sidebars* for blog posts / posts (not pages) — maybe there is another way to disable the header from appearing globally? I would be happy just to have the Elementor template I am using in the After Header GP Hook.

    EDIT: So in that case should I just use the process you have outlined at https://docs.generatepress.com/article/generate_header/ then as Jamal mentioned? Do I place this into a GP Hook? Or copy the header.php file to my Child theme and remove the action?

    Thanks, Dean

    #308385
    Tom
    Lead Developer
    Lead Developer

    Can you link me to a search results page/page using the header possibly?

    The generate_header hook function would go in your functions.php file.

    #308387
    Dean

    Thanks Tom —

    Search for example from: http://www.theterritorycollection.com.au/aa-home-draft/ (this is the draft home page; later will change URL of course)

    Results showing at: http://www.theterritorycollection.com.au/?s=camping

    I haven’t yet added that hook function into my functions.php file.

    Kind regards, Dean

    #308595
    Tom
    Lead Developer
    Lead Developer

    Ah, you’re not using GP for the header which is why the GP function isn’t working.

    You could try this:

    .search .elementor-379 {
        display: none;
    }
    #308612
    Dean

    Thanks Tom — that’s not what I want to achieve.

    Sorry, I might not have been clear enough.

    I’m using the Elementor image slider as my header in a GP Hook.

    I want to keep that there.

    But on the search results page, you can see the GP regular header — the name of the site and also the tagline.

    I don’t want these to appear.

    On all the other pages, I have the “Header” (and Content title) disabled in the options available in the page settings that come with GP Premium.

    That’s the only header I want to remove — the standard GP one. I only want to keep the Elementor slider as the header that I serve from the GP “after header” hook, not the Header that sits between the top menu and this slider.

    Hopefully that is clearer.

    Kind regards, Dean

    #308633
    Tom
    Lead Developer
    Lead Developer

    Ah I see – sorry about that.

    The code I provided above should work – not sure why it’s not.

    Alternatively, you could do this:

    .search .site-header {
        display: none;
    }
Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.