Jump to content

Topic on Project:Support desk

Hide search box on Main_Page

8
Summary by Onlyforwikiapps
62.96.213.62 (talkcontribs)

Hi! I'm running v1.31 and trying to hide the search box on the main page only. I have the following code in my MediaWiki:Common.css but it doesn't work:

body.page-Main_Page.action-view h1.firstHeading, body.page-Main_Page.action-submit h1.firstHeading .p-search { display: none; }

TheDJ (talkcontribs)

you are hiding the first heading, and you are hiding the search box within the first heading. Since the search box isn't within the first heading, it's not hiding it. You are also targeting the classname p-search, but p-search is an element ID.

This is likely more accurate:

body.page-Main_Page.action-view h1.firstHeading, #p-search { display: none; }

Seb35 (talkcontribs)

This would hide the search box eveywhere. To hide it only on the main page, it would be something like:

body.page-Main_Page.action-view #p-search { display: none; }
Ency (talkcontribs)
62.96.213.62 (talkcontribs)

Thanks TheDJ! That worked but it hides the search form on all pages... hmmm...

p-search appears as both an id and a class: <div id="p-search" class="p-search navbar-form" role="search">

62.96.213.62 (talkcontribs)

Thanks both - Seb35: I just worked that out and it hides it only on the Main_Page, perfect!

Infinitepeace (talkcontribs)

To delete the search bar type:

#p-search { display:none; }

In MediaWiki:Common.css

Onlyforwikiapps (talkcontribs)

Hello how about removing the search bar for anonymous, non-logged in readers only?

Reply to "Hide search box on Main_Page"