- This topic is empty.
-
AuthorPosts
-
March 24, 2015 at 6:51 am #198882
case1001
ParticipantHello,
I am having a trouble with my search bar. You see i have a home page with a search bar right in the middle of it. I also have a navigation bar on top of the home page with an additional search bar. My question is how do i make it so the additional search bar does NOT appear on the home page but still appears on the other pages. Is there any way to do that?March 24, 2015 at 6:58 am #198883Senff
ParticipantYes, that can be done, most likely. But….we’ll need to see the site so we can tell you what CSS you’ll need to change/add.
March 24, 2015 at 7:33 am #198885case1001
ParticipantHello Senff
this is the website: http://rescore.ioMarch 24, 2015 at 7:34 am #198886case1001
Participanti am just experimenting at the moment and that is what i have (probably fileld with mistakes)
<?php if( !is_front_page() ) : ?>
form action=”/movies/search_by_title”
input name=”query” type=”text” placeholder=”Search movies” /
<?php ?>March 24, 2015 at 8:05 am #198887case1001
Participantbasically the initial code is
li
form action=”/movies/search_by_title”
input name=”query” type=”text” placeholder=”Search movies” /And what i need to do is say if i am not on the home page execute this bit of code.
March 24, 2015 at 9:01 am #198893Senff
ParticipantThis code…
<?php if( !is_front_page() ) : ?>
…would indicate you’re working with WordPress, but looking at the site you sent, that’s not a WordPress site?
If you’re redoing that non-WP site and making it a WP one, then this CSS should just hide the search form from the home page:
body.home .top-bar form { display:none; }
March 24, 2015 at 10:06 am #198901case1001
ParticipantAnd if i just want to leave it non-WP is there anyway to just say if that is the home page don’t show the top right search bar on it ?
March 24, 2015 at 10:11 am #198902Paulie_D
MemberCan you give that specific page a class or ID?
March 24, 2015 at 10:19 am #198903case1001
ParticipantThe thing is that i don’t want to do it in WP
March 24, 2015 at 10:22 am #198904Paulie_D
MemberNothing to do with WP….
I assume you can edit the HTML of the home page, so can you add a class or ID to the
body
of that page?Simple enough question.
March 24, 2015 at 10:24 am #198905case1001
ParticipantYes i can do that
March 24, 2015 at 11:16 am #198907Paulie_D
MemberThen give the body a class of “home” and follow Senff’s CSS suggestion a few posts up.
March 24, 2015 at 11:19 am #198909case1001
ParticipantOk did that and it works. Thanks to both of you :)
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.