-
AuthorPosts
-
January 11, 2018 at 11:02 am #896092
Hi,
I created two new widget areas.
One I want to display in the header. That works, but I want the output before and not after the menu. In the templatepart “helper-main-menu.php” I fount the menu, but not where the widget is created.
Can you help me, how to change the position of the widget?
Thank you.And the other widget I want to place in the main content. How can I add it?
Thank you for your helpNadja
January 11, 2018 at 12:24 pm #896129first to your second widget area. On using the alb editor of enfold there are to many possiblities to place a widget to. So enfold comes with an predefined widget alb element you can place it whereever you like ( called Widget Area )
to your first request: what was the code you entered in functions.php of your child-theme to place the header widget area?
on my end i noticed three different codes to have different places:
/*********header widget ****************************/ add_action( 'ava_after_main_menu', 'enfold_customization_header1_widget_area' ); function enfold_customization_header1_widget_area() { dynamic_sidebar( 'header1' ); } /*********************************/ /*********header widget area before **********/ add_action( 'ava_main_header', 'enfold_customization_header2_widget_area' ); function enfold_customization_header2_widget_area() { dynamic_sidebar( 'header2' ); } /**********************/ /*********header widget area just right after main container starts **********/ add_action( 'ava_after_main_container', 'enfold_customization_header3_widget_area' ); function enfold_customization_header3_widget_area() { dynamic_sidebar( 'header3' ); } /**********************/
pay attention – i renamed the functions and widget areas to 1,2, 3 to avoid double function names and to have the possibility to use all of them as
header1, header2, header3 areasJanuary 11, 2018 at 12:35 pm #896137by the way – you can find those hooks on enfold – search for do_action in the enfold folder.
on your helper-main-menu.php there are 6 do_actions to find ( one is for header left right position only)avia_meta_header ava_main_header ava_main_header_sidebar ava_before_bottom_main_menu ava_inside_main_menu ava_after_main_menu
sometimes they got comments before the do_action like f.e.: Hook that can be used for plugins and theme extensions
you see the code – the add_action concerns to the do_action rules in the code. So you can insert code here like it does with the header widgetJanuary 11, 2018 at 2:58 pm #896175Sorry, I don’t understand what you are meaning in your first post.
I created two widget areas. But I cannot display it in the main content.
And I found the hooks, but cannot found one for my problem: The widget is shown in the header but I want to change the position. I want to display it before the nav. but in the template I cannot find where the widget area is created.Nadja
January 11, 2018 at 11:53 pm #896303the advanced layout builder ( short alb) has an element called Widget Area.
You can drag&drop this to where ever you like in your content ! On that widget area alb element you have than the choice which widget should be displayed.what kind of header have you choosen for your layout ?
Header on top and navigation under it?- This reply was modified 6 years, 11 months ago by Guenni007.
January 12, 2018 at 5:51 am #896425Hi,
Thanks for helping out @guenni007, did you try out the last suggestion and did you have any luck with it @nadjak77?
Best regards,
RikardJanuary 12, 2018 at 9:45 am #896474by the way – i created a hook into helper-main-menu.php between logo and menu. But all calculations of header-height and scroll-offset including shrink function and and … are invalid than. So it realy makes no sense. On positioning absolute – you can take the other hooks aswell.
But see here on relative position: https://webers-testseite.de/impressum/
i placed a google map widget inbetween – and you see what happens to main content ! with the color-section (50% height) on the top.- This reply was modified 6 years, 11 months ago by Guenni007.
January 12, 2018 at 9:45 am #896475Thank you Guenni007. The Widget in the layout builder works fine.
The header is fixed on the left side, like a sidebar.
In the “general layout” tab of my enfold child I can see, that first came my logo and Main menu, then my navi and after that, the widgets. I want to change the position from widget and navi.
And I also want to add a second widget area to the header. This one should be like a footer with the navi for the imprint.Thank you
NadjaJanuary 12, 2018 at 9:49 am #896479ah – ok if you have that header setting: https://kriesi.at/themes/enfold-consulting/
there might be a solution !Let me see …
January 12, 2018 at 9:50 am #896480Yes, it is like that.
Are you from Germany? So we can talk into german. That is easier to explaine ;)
NAdjaJanuary 12, 2018 at 10:38 am #896492Also es gibt dort keinen widget bereich der vorgesehen ist.
Man kann einen dort hinbasteln. Leider geht die Einstellung dann beim nächsten Update verlorenich habe in die helper-main-menu.php oberhalb der Zeile 151 (Enfold 4.2) :
$main_nav = "<nav class='main_menu' data-selectname='" …
folgendes eingefügt:
ob_start(); do_action('ava_before_nav_on_header_left'); $output .= ob_get_clean();
hochladen des ganzen in den Original Folder includes.
Dann kann man mit :
add_action( 'ava_before_nav_on_header_left', 'enfold_customization_header1_widget_area' ); function enfold_customization_header1_widget_area() { dynamic_sidebar( 'header1' ); }
einen header1 widget bereich bei Widgets anlegen, der in der Position ist – Beispielseite: https://webers-testseite.de/bernhard/
Es ist dann ratsam den Abstand nach links dem Menu anzupassen (allerdings mit padding)
#header_main .widget { padding-left: 13%; padding-right: 5%; }
ich kann dir das auch hochladen: https://pastebin.com/dl/54ZRXJze
Perhaps a mod could help here to make it via child-theme “helper-main-menu.php” – i don’t know how.
January 12, 2018 at 10:55 am #896504by the way Günter here on Board created a filter which might be implemented in the next Enfold (4.2.1 ?) https://kriesi.at/support/topic/a-way-to-have-an-own-register-backend-advanced-styles-php-in-child-theme/
dann ist es wahrscheinlich möglich die veränderte helper-main-menu.php im child-theme zu lassen und diese über functions.php des Child-theme einzubinden.
Dann melde ich mich nochmal hier.Please Mods : let this thread open for future modifications.
January 12, 2018 at 11:06 am #896513or Mods – this might be a nice position for a hook if header is left or right layout for next update
January 15, 2018 at 9:22 am #897432Vielen Dank für deine Hilfe!
Ich habe es jetzt wie folgt gelöst:1. das Widget über das Menü platzieren: mit CSS. Das Menü hat einen größeren Abstand nach oben bekommen und das Widget wird absolut positioniert.
2. um unten in der Header-“Sidebar” noch ein Menü zu platzieren, habe ich ein neues Menü Footer angelegt.
In der helper-main-menu.php habe ich folgenden Code hinzugefügt:$args = array( 'menu'=>'Footer' ); $nav = wp_nav_menu($args);
(vor dem schließenden Tag von <div id=’header_main’ class=’container_wrap container_wrap_logo’>)
Meine geänderte php-Datei hab ich in meinem Child-theme in den Ordner “includes” kopiert. So sollte es auch Updatesicher sein.lg NAdja
January 17, 2018 at 5:36 am #898286Hi,
Glad that you figured it and thanks to @guenni007. Please feel free to open a new thread if you need anything else. :)
Best regards,
Ismael -
AuthorPosts
- The topic ‘Add Enfold Widgetarea to main content / special parts of the template’ is closed to new replies.