Jump to content
Sign in to follow this  
jenny20k

Moving search field

Recommended Posts

jenny20k

Hi I'd like to move the search field from within the nav bar region to net to the branding. Would I do this in custom code and what would the code be? Thanks J

Share this post


Link to post
Share on other sites
timlinson

Jennifer, you can add this hook to your functions.php file: `add_action("pagelines_branding_icons_end", "get_search_form");` Cheers

Share this post


Link to post
Share on other sites
jenny20k

Thanks - I have copied and pasted that to the end of the base functions file and it says it has saved. However, I see no difference on the page. It is the first hook I've tried - am I typing it in the correct place?

Share this post


Link to post
Share on other sites
timlinson

Do you have PlatformBase or PlatformPro activated? It will only work in the base functions.php if your base child theme is activated.

Share this post


Link to post
Share on other sites
jenny20k

Thanks you two - Catrina - I'm probably being really slow here but I have watched that video so many times and am still doing this all wrong. I replaced the code exactly as in the tutorial and get this Warning: Cannot modify header information - headers already sent by (output started at /home1/jennymc2/public_html/creativecheshire/wp-content/themes/platformbase/functions.php:58) in /home1/jennymc2/public_html/creativecheshire/wp-admin/theme-editor.php on line 99 meaning i have to reload the bases theme again. Have you any idea what I'm doing wrong? Sorry...

Share this post


Link to post
Share on other sites
catrina

Have you already reverted back to the way the functions file was before making the edits? Since you already know which hook you need to use, you will need to give the function a name (i.e. add_search_form). Did you follow this step or was this the part that confused you?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jenny20k

i have reloaded the platformbase theme so I can access wp again. ah - right, when I go into platformbass, editor, functions.php through wp-admin, I'm not sure whether to edit the stumble upon code or whether to start a new code. And I don't know where in the file to type my code, or whether to start it with // etc. What I originally did was edit it exactly the way the guy in the video did (although I didn't ever have a stumble upon icon - i don't know if that's odd in itself.) so I used pagelines_after_branding and get_search_form();

Share this post


Link to post
Share on other sites
timlinson

When you see two slashes at the start of the line, it means that the line is commented out, making the code in that line inactive. Note that the hook I posted is slightly different than the way Adam does it in the video. My hook calls the get_search_form function (without parentheses here) directly in the hook. To do it more like the video, you'd create a function (called whatever you please), which then calls the get_search_form() function.

Share this post


Link to post
Share on other sites
jenny20k

Woohoo! Finally I've managed to do it! Thank you, hopefully I'll be able to use hooks a bit better now.

Share this post


Link to post
Share on other sites
christiandisenolopezcom

Simpler way to do it: 1.) Disable search field in navigation from "Header and Nav" Settings on Wordpress admin. This will hide search field from the NAVIGATION. 2.) Paste this code where you want it to appear: <?php get_search_form(); ?> 3.) Additional CSS styling may be needed to get position you desire...But, that's a whole new topic.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×