- This topic has 4 replies, 2 voices, and was last updated 11 years ago by
Michael.
-
AuthorPosts
-
July 18, 2015 at 6:44 am #121995
Michael
Hi all,
First – thanks Tom for a great theme. I’m completely new to all of this and your theme has made it very easy to get up an running.
I’ve signed up for an Adsense account and have the ads showing up on some of my pages using a combination of a text widget in the left sidebar on some pages and a hook on others.
What I want to do is disable the sidebar entirely from the search page or remove the text widget I added to the left sidebar so the Adsense ad does not appear on the search results page.
I have customcss which I am using the following code in, if that makes a difference:
body.page-id-4 .grid-container {
max-width: 98%;
}I can’t just tell the page to run another sidebar because those are setup for other pages. Is there a way to do this on the search page?
Thank you!
July 18, 2015 at 8:20 am #122001bdbrown
Hi Michael. Take a look at this KB article.
July 18, 2015 at 8:27 am #122002Michael
Thank you, bdbrown!
I used what I read there and after doing some searches found that I should change the category to search. My Custom CSS now has this in it, but the sidebar still shows on the search page. Do I have to do something special when adding more than one thing to the Custom CSS?
Thank you!
body.page-id-4 .grid-container { max-width: 98%; }add_filter( 'generate_sidebar_layout','generate_custom_category_sidebar_layout' ); function generate_custom_category_sidebar_layout( $layout ) { // If we are on a category, set the sidebar if ( is_search() ) return 'no-sidebar'; // Or else, set the regular layout return $layout; }July 18, 2015 at 8:59 am #122003bdbrown
The function would go in a child theme functions.php file, not your css file. More information here.
You can download a blank child theme for GP here: http://generatepress.com/api/themes/generatepress_child.zip
July 18, 2015 at 9:12 am #122005Michael
It worked! I used a plugin to adjust the function and now the search results page has no sidebar. Won’t have to worry about AdSense saying I have ads on a search page now!
Thanks a lot, bdbrown!
-
AuthorPosts
- You must be logged in to reply to this topic.