Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Adding search to top-bar? #324

Closed
swthate opened this issue May 4, 2015 · 6 comments
Closed

Adding search to top-bar? #324

swthate opened this issue May 4, 2015 · 6 comments

Comments

@swthate
Copy link

swthate commented May 4, 2015

Hello,

This may be a silly question. But is there a best way to add a search bar to the top-bar navigation in this theme, without going into functions.php?

@Luciaisacomputer
Copy link
Contributor

How exactly are you trying to implement it, you should be able to simply add the search form using the form structuring here: https://codex.wordpress.org/Function_Reference/get_search_form, although you'd still have to adjust the styling based on your layout.

@swthate
Copy link
Author

swthate commented May 5, 2015

Ah-ha.

Thank you. Been a while, so I'm still clearing out some theme development cobwebs. This is what I was looking for. I had a suspicion it didn't have anything to do with this theme necessarily, but I wasn't sure. Thanks again.

@swthate swthate closed this as completed May 5, 2015
@swthate
Copy link
Author

swthate commented Jun 23, 2015

Hello,

I finally made my way back to my search bar. I tried using <?php get_search_form(); ?>, and even after removing the row and column from searchform.php, it's still acting a little odd:

Example of search behavior

I'm sure it's not necessarily acting odd, but that I'm just missing something.

I tried looking throughout the theme for the correct place to put the call to the form. I settled on top-bar.php:

<section class="top-bar-section">
  <?php foundationpress_top_bar_l(); ?>
  <?php foundationpress_top_bar_r(); ?>
  <?php get_search_form(); ?>
</section>

I'm trying to get the search bar in the right-side section of the top-bar, but I'm not sure on how to do that. My assumption of just plopping the call to the form like I have shown in the above code sample is all wrong... but I can't find where I should be doing that.

Here is what I'm trying to accomplish:

Desired search behavior

Any help/suggestions/haikus is much appreciated!

@swthate swthate reopened this Jun 23, 2015
@shackep
Copy link

shackep commented Jul 22, 2015

This is what I am doing:
`




`

@FlatspinZA
Copy link

Your search form is not being included in the top-bar DIV, from your code.

You can get it working by including a DIV for your search box, in top-bar.php, and defining a specific size for the containing DIV.

<section class="top-bar-section"> <?php foundationpress_top_bar_l(); ?> <?php foundationpress_top_bar_r(); ?> <div class="small-4 large-4 right"> <?php get_search_form(); ?> </div> </section>

I just messed around with it quickly in a sandbox.

@FlatspinZA
Copy link

Now I see my code is exactly the same as Shackep :S

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants