-
AuthorPosts
-
December 5, 2017 at 8:11 pm #885215
Hello,
we have set menu items to display as a icon on desktops and we would like to add polylang switch next to it, before (or after) social icons.
I’ve already tried following your guide to add a widget to a header area but that leads to an error:
Warning: Cannot modify header information – headers already sent by (output started at /home/…functions.php:7) in /home/…/wp-admin/includes/misc.php on line 1114
Best regards
December 6, 2017 at 12:04 pm #885525Hey digizel,
Can you show us what code you tried?
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaDecember 6, 2017 at 12:38 pm #885546Hello,
I’ve tried adding this code to functions.php:
add_action( ‘ava_after_main_menu’, ‘enfold_customization_header_widget_area’ );
function enfold_customization_header_widget_area() {
dynamic_sidebar( ‘header’ );
}I have created an admin account so you can have a look.
Best regards
December 6, 2017 at 5:07 pm #885666Hi digizel,
You can add the language switcher to the menu
https://cl.ly/3X1N1I402d0dhttps://polylang.pro/doc/the-language-switcher/
The code for the widget in the header is correct, there must have been some warning that was output and so it seemed to break stuff.
You could also edit the helper-main-menu.php in a child theme and put the code there.
If you need further assistance please let us know.
Best regards,
Victoria- This reply was modified 7 years ago by Victoria.
December 6, 2017 at 5:11 pm #885673Hello,
we have already added the switcher to the menu but that’s not really visible enough and that is why we asked how to add it next to burger menu icon.
Are you saying that we cannot add a custom widget area to header?
Can we use the position for search icon?
Best regards
December 6, 2017 at 6:39 pm #885719Hi digizel,
I did not say that. I said that the code for the widget is working and that the other option is to edit the theme files.
Best regards,
VictoriaDecember 6, 2017 at 7:20 pm #885736Ok, so what do I need to do the have a widget area in the header, next to the social icons?
December 7, 2017 at 1:18 am #885850December 7, 2017 at 11:52 am #886028I’ve already tried that and it’s leads to an error like I’ve described in the first message:
Warning: Cannot modify header information – headers already sent by (output started at /home/dh_zg80dh/zagreb80.com/wp-content/themes/zg80/functions.php:7) in /home/dh_zg80dh/zagreb80.com/wp-admin/includes/misc.php on line 1114
Best regards
December 8, 2017 at 9:23 pm #886622Hi,
Something on the code has a blank state on top, that is why the issue exists.
You would need to fix your code.Best regards,
BasilisDecember 9, 2017 at 11:16 am #886768Hello,
ok, and how do I fix the code?
December 9, 2017 at 11:45 am #886786Hi digizel,
In order to have the code in your functions.php you need to use a child theme and add the code there. Otherwise the code you add in the parent theme, it will be overwritten by the next update.
Best regards,
VictoriaDecember 9, 2017 at 11:55 am #886791I have a child theme in place and I have added the code to functions.php.
I’ve also added custom widget area named header and after that, this is what I get in the backend:
add_action( ‘ava_after_main_menu’, ‘enfold_customization_header_widget_area’ ); function enfold_customization_header_widget_area() { dynamic_sidebar( ‘header’ ); }
Warning: Cannot modify header information – headers already sent by (output started at /home/dh_zg80dh/zagreb80.com/wp-content/themes/zg80/functions.php:7) in /home/dh_zg80dh/zagreb80.com/wp-admin/includes/misc.php on line 1114Warning: Cannot modify header information – headers already sent by (output started at /home/dh_zg80dh/zagreb80.com/wp-content/themes/zg80/functions.php:7) in /home/dh_zg80dh/zagreb80.com/wp-includes/pluggable.php on line 1216
December 9, 2017 at 2:30 pm #886831Hi,
First you will need to remove the code you added to the functions.php via FTP.
Then can try to understand why you are getting the error, do you have more that one custom widget?Best regards,
MikeDecember 9, 2017 at 4:06 pm #886872Hello,
I’ve noticed that I’ve made an error when I previously copied the code so now I don’t get any errors :)
I’ve added the polylang switcher to custom widget area named header but I don’t see anything on the page.
Please note that I haven’t done any other theme file modification and the cache plugin has been disabled.
I would appreciate if you can have a look and let me know if there is something wrong or missing.
Best regards
- This reply was modified 7 years ago by digizel.
December 9, 2017 at 6:47 pm #886942Hi,
I see your flags are showing in your burger menu, and your main menu is disabled.
The option is to put the language items in the secondary menu and set the secondary menu to the top of the page, which I did.
But it is not showing as it should. Also your theme options don’t show the “Menu Items for mobile” option and I see no css to set your burger menu to always on. So there is a conflict somewhere.
Did you make changes to the parent theme? Perhaps try disabling your plugins. If that resolves the issue, reactivate each one individually until you find the cause.
Otherwise I would recommend re-uploading the parent theme to correct any broken files.Best regards,
MikeDecember 9, 2017 at 7:43 pm #886952Hello,
the parent theme is enfold 4.2 and I haven’t made any modifications there. I did changed the option for child theme: zg80>Main menu>General>Menu Items for Desktop to “Display as icon” because my client prefers the burger menu. You can see that in the attached screenshot.
Previously I’ve also added Polylang switcher to the menu but only as a temporally solution until we can show it somewhere else in the header.
Would it be possible to have a widget instead of search as we don’t need that?
I have already disabled all plugins except Polylang so that shoudn’t cause any troubles.
brDecember 9, 2017 at 8:36 pm #886966Hi,
Thanks for the feedback, I see that I missed that, and with using the “Display as icon” setting the Extra Elements > Header Secondary Menu is also hidden. Which now makes sense.
You can add a widget to the header, see here.
Or how about setting the menu back to display as text and using this code to show the burger menu:@media only screen and (max-width: 1990px) { .av-burger-menu-main { display: block!important; } #top .av_mobile_menu_tablet .av-main-nav .menu-item { display: none!important; }}
Then the Extra Elements > Header Secondary Menu will show, which has the language switcher in it.
Best regards,
MikeDecember 9, 2017 at 8:54 pm #886972The client prefers to add the language switch to the header so it can we always visible. I’ve already followed the guide on how to add widget to the header are:
1. I’ve added the following code to the function.php of the child theme: add_action( ‘ava_after_main_menu’, ‘enfold_customization_header_widget_area’ ); function enfold_customization_header_widget_area() { dynamic_sidebar( ‘header’ ); }
2. I’ve added the polylang switcher to custom widget area named header
I can now see the widget with icon for languages but they are located under the logo. How do I move them in the same line as the burger menu? Preferred position would be left of right to the burger menu.
Best regards
December 10, 2017 at 3:56 am #887031December 10, 2017 at 10:57 am #887076Well, there is clearly a flag icon in the lower left corner of the logo.
December 13, 2017 at 6:27 am #888222Hi,
Please adjust the left position of the header widget.
#header .widget { left: 80%; }
Use additional css media queries to adjust the widget position on mobile view.
Best regards,
IsmaelDecember 13, 2017 at 12:24 pm #888285Thank you for your support.
Best regards
December 13, 2017 at 4:16 pm #888411Hi digizel,
Glad we got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.