CMS Development

Jlawal
Top Contributor

Removing search bar from landing pages

Hello,

 

We use Addsearch as the search function on our website, this sits in our navigation. We don't use this navigation for our landing pages but the search bar appears at the very bottom of all of our landing pages (different templates).

 

I have been trying to remove this and have been told by AddSearch that there is some extra code that needs to be removed, but neither they, nor i or HubSpot Support can find it.

 

Here is an example of one of our landing pages:  www.groupcall.com/gdpr-ebook-for-schools (more examples can be found here)

 

Any help would be greatly appreciated.

 

Many thanks,

Jamila

3 Replies 3
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Removing search bar from landing pages

hello @Jlawal - could you please try adding this script to the bottom of your page? in the page editor go to Settings -> advanced options -> footer HTML and drop in the following code.

<script>
var addSearchInterval = window.setInterval(function(){
  if($('input.addsearch').length > -1){
    $('input.addsearch').remove();
    window.clearInterval(addSearchInterval);
  }
}, 300);
</script>

If this answer helped, please, mark as solved 😄


tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.

 

Drop by and say Hi to me on slack.

0 Upvotes
Jlawal
Top Contributor

Removing search bar from landing pages

Hi @tjoyce - thank you for taking the time to help!

 

I have tried something similar on one of my landing pages and while it does work for that individual page I was hoping for something that would remove it from each page (They have different templates).

 

Many thanks,

 

Jamila

tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Removing search bar from landing pages

okay @Jlawal - It looks like your landing pages have a body class of "hs-landing-page", so, just drop this code in a global js file and it will only remove it for all landing pages.

$(function(){
  if($('body.hs-landing-page').length > -1){
    var addSearchInterval = window.setInterval(function(){
      if($('.hs-landing-page input.addsearch').length > -1){
        $('input.addsearch').remove();
        window.clearInterval(addSearchInterval);
      }
    }, 300);
  }
})
0 Upvotes