Jump to content


Photo
- - - - -

Moving search field


  • Please log in to reply
11 replies to this topic

#1 jenny20k

jenny20k

    Super Member

  • Members
  • PipPipPipPip
  • 100 posts

Posted 27 March 2011 - 04:53 PM

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

#2 timlinson

timlinson

    Advocate

  • Members
  • PipPipPipPipPip
  • 1032 posts

Posted 27 March 2011 - 04:57 PM

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

#3 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 27 March 2011 - 05:25 PM

If you need help adding the hook Tim suggested above, look here:

Please Login or Register to see this Hidden Content



#4 jenny20k

jenny20k

    Super Member

  • Members
  • PipPipPipPip
  • 100 posts

Posted 27 March 2011 - 05:25 PM

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?

#5 timlinson

timlinson

    Advocate

  • Members
  • PipPipPipPipPip
  • 1032 posts

Posted 27 March 2011 - 05:27 PM

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

#6 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 27 March 2011 - 05:29 PM

The hook should be implemented within the functions file as instructed in

Please Login or Register to see this Hidden Content

, not added to the end:

#7 jenny20k

jenny20k

    Super Member

  • Members
  • PipPipPipPip
  • 100 posts

Posted 27 March 2011 - 06:09 PM

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...

#8 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 27 March 2011 - 06:16 PM

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?

#9 jenny20k

jenny20k

    Super Member

  • Members
  • PipPipPipPip
  • 100 posts

Posted 27 March 2011 - 07:02 PM

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();

#10 timlinson

timlinson

    Advocate

  • Members
  • PipPipPipPipPip
  • 1032 posts

Posted 27 March 2011 - 07:51 PM

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.

#11 jenny20k

jenny20k

    Super Member

  • Members
  • PipPipPipPip
  • 100 posts

Posted 27 March 2011 - 08:08 PM

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

#12 christiandisenolopezcom

christiandisenolopezcom

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 09 May 2011 - 01:54 PM

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.