Site logo

Archived topic

Place html or widgets inside sticky menu nav bar?

9 replies · Started by Are Martin on September 3, 2015

Viewing posts 1–10 of 10

Hi Tom, I would like to put an adsense custom search box inside the sticky menu instead of the built in search function. I currently use a html text widget to to this elsewhere on my site.

I would like the search box to appear somewhere in the middle of the nav bar between the menu items and the logo, alternatively just right next to the logo. Could this be achieved in a relatively easy way?

Kind Regards

Are Martin Kallaak

You're probably better off disabling the navigation search and hooking your HTML into the navigation like this:

add_action( 'generate_inside_navigation','generate_insert_into_navigation' );
function generate_insert_into_navigation()
{ ?>
      Put your HTML or whatever in here
<?php }

You'll have to put your search code in a div with a class so you can target it with CSS to position it, but this should get you started :)

Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

Thanks! That´s perfect! :)

No problem! :)

Hmm.. I was a bit too fast there.... Nothing shows up in the nav bar when I put in the code above. :/

Can you link me to your site? :)

Here you go: http://www.fysionett.no

I´ve used a plugin called code snippets to add the code you supplied above and pasted in the code for the search box.

I gave it a class called "sok" , which means search in my language. However I haven't positioned it with css yet. But still nothing shows up anywhere...

Ah, I made a mistake in the code snippet above.

Re-paste it and you should be good to go :)

It´s working now. Thank you! :)

You're welcome :)

This archived topic is closed to new replies.