Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to place Search this site box in Navigation bar
- This topic has 19 replies, 3 voices, and was last updated 8 years, 10 months ago by Susan.
-
AuthorPosts
-
May 8, 2015 at 5:03 am #150875GordyMember
Hi All,
I just changed my site from the old streamline theme to Magazine pro theme, in order to have a mobile responsive site. After the movement, I cannot see the search box displaced on the site as it was before.
When I look at the demo of the Magazine pro, I could see that the search box is actually placed at the footer area. But, I cannot see it on my site and I would actually prefer to have it placed at the Navigation bar.
Please help.
http://afroscandic.com/May 8, 2015 at 5:58 am #150902SusanModeratorTo add a search bar to your Primary Navigation, go to Dashboard > Genesis > Theme Settings > Primary Navigation Extras > select the search bar.
If you don't have that option, use this code snippet: http://my.studiopress.com/snippets/nav-extras/
May 8, 2015 at 6:11 am #150903GordyMemberI don't have the Navigation extra that shows "select search bar" option.
Where eaxctly do I need to place the code snippet in the theme's functions.php file ?
Is it at the beginning or at the end , after the last code :
'description' => __( 'This is the bottom section of the homepage.', 'magazine' ),
) );May 8, 2015 at 7:02 am #150907SusanModeratorGordy:
Technically, you can place the code at any place in your functions.php (as long as you don't break into another PHP statement). I typically place it at the end of the file, so I know that it's not going to break anything else.
May 8, 2015 at 9:13 am #150955GordyMemberOk. But, when I pasted it. It gave an error as follow:
Parse error: syntax error, unexpected '<' in /home4/olaoluwa/public_html/test/wp-content/themes/magazine-pro/functions.php on line 120
From this link : http://my.studiopress.com/snippets/nav-extras/
Should I click "view raw" before I copy and paste? Or should I just copy the one in the box?
May 8, 2015 at 9:19 am #150956Brad DaltonParticipantMay 8, 2015 at 10:27 am #150960GordyMemberI removed :
<?php
//* Do NOT include the opening php tagand pasted from :
add_filter( 'wp_nav_menu_items', 'theme_menu_extras', 10, 2 );
/**
* Filter menu items, appending either a search form or today's date.BUT, I GOT THIS :
Fatal error: Cannot redeclare theme_menu_extras() (previously declared in /home4/olaoluwa/public_html/test/wp-content/themes/magazine-pro/functions.php:132) in /home4/olaoluwa/public_html/test/wp-content/themes/magazine-pro/functions.php on line 212
May 8, 2015 at 10:30 am #150962Brad DaltonParticipantMay 8, 2015 at 11:33 am #150974GordyMemberNo. I added it only once.
And I cannot get to the dashboard any longer because of this error. When I clicked any of the menu button, it takes me to the error.
I even wanted to go to Appearance>themes, so that I can probably delete the theme and re-install again but, it's not possible because am taken to the error page.
May 8, 2015 at 12:40 pm #150983Brad DaltonParticipantYou should always use a code editor with FTP when adding/removing or modifying PHP code.
You have added the function name twice which is why you are getting an error.
theme_menu_extras()
On line 132 and 212
May 9, 2015 at 8:37 am #151236GordyMemberBut, I copied the code from "Studiopress link" into "Notepad" and copied it from Notepad into functions.php file.
1. What code editor do you want me to use?
2. Do you mean that I should save the code in a file and then upload it via FTP?
May 9, 2015 at 3:32 pm #151323Brad DaltonParticipantUse Notepad++ with FTP.
You have an error because you have copied the function twice. On line 132 and line 212
Fatal error: Cannot redeclare theme_menu_extras() (previously declared in /home4/olaoluwa/public_html/test/wp-content/themes/magazine-pro/functions.php:132) in /home4/olaoluwa/public_html/test/wp-content/themes/magazine-pro/functions.php on line 212
May 9, 2015 at 6:50 pm #151350GordyMemberCould you please tell me how you want me to use FTP? should I copy the codes from the studiopress link and save it in Notepad and then upload via FTP?
May 9, 2015 at 6:55 pm #151352Brad DaltonParticipant1. Download your child themes functions.php file and open it with notepad++
2. Copy the PHP code from the view raw link in the Gist and paste it at the end of your functions file and save the file.
3. Then upload the file back to your child themes root directory over writing the old file.You will need to remove the code you added twice on line 132 and 212
May 9, 2015 at 7:54 pm #151370GordyMemberThank you.
In number 3, you said "...root directory over writing the old file.
Do you mean back to "functions.php file". ?
May 9, 2015 at 8:23 pm #151373Brad DaltonParticipantMay 10, 2015 at 8:33 am #151472GordyMemberThank you. It now works on my test site : http://test.the-brilliant-idea.com/
BUT, I want the search box to be on the Primary menu, at the far right side.
What should I do?
May 10, 2015 at 4:12 pm #151593Brad DaltonParticipantTry this code snippet yourself first http://my.studiopress.com/snippets/nav-extras/
May 11, 2015 at 9:19 am #151722GordyMemberThat's the code snippet that I have already added to have the search box displayed above header area of my site.(secondary Navigation).
http://test.the-brilliant-idea.com/
BUT, I want the Search Box to be displayed below the header area of my site, at the Primary navigation.
May 11, 2015 at 9:27 am #151724SusanModeratorIf you have already added it, that's why your site keeps crashing - you can't add the same code twice.
Are you saying that you already have the code for your secondary navigation, and you want a search bar for BOTH primary and secondary navigation?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.