- This topic has 12 replies, 3 voices, and was last updated 3 years, 10 months ago by
Tom.
-
AuthorPosts
-
April 19, 2017 at 12:22 am #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.46GP Premium 1.2.96April 19, 2017 at 4:42 am #307626Jamal
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.
April 19, 2017 at 9:23 am #307735Tom
Lead DeveloperLead DeveloperAre you wanting to remove the header across the entire site, or just the search page?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 19, 2017 at 4:03 pm #307932Dean
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
April 19, 2017 at 9:19 pm #308017Tom
Lead DeveloperLead DeveloperYou 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' ); } }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 19, 2017 at 10:09 pm #308025Dean
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,
DeanApril 20, 2017 at 9:35 am #308189Tom
Lead DeveloperLead DeveloperWhat version of GP are you using?
Are you using a child theme? If so, any custom template files (like header.php)?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 20, 2017 at 5:22 pm #308321Dean
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
April 20, 2017 at 9:18 pm #308385Tom
Lead DeveloperLead DeveloperCan 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.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 20, 2017 at 9:59 pm #308387Dean
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
April 21, 2017 at 9:21 am #308595Tom
Lead DeveloperLead DeveloperAh, 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; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 21, 2017 at 10:04 am #308612Dean
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
April 21, 2017 at 10:48 am #308633Tom
Lead DeveloperLead DeveloperAh 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; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.