Site logo

Archived topic

Place a widget in elements

1 reply · Started by Dimitrios on September 7, 2021

Viewing posts 1–2 of 2

Dear GeneratePress team,

How I could place a widget in elements or in post/page area?

Thank you
Dimitris

Hi there,

it depends, if the Widget has a Block Version available in the editor then you can simply add the Block to your post content or a hook element.

If it doesn't then you can widgetize a GP Hook - heres an example that will point you in the right direction:

https://generatepress.com/forums/topic/language-switcher-for-sticky-navigation-on-mobile-with-multilingualpress/#post-1916464

In the code - this line is where you set the GP hook:

add_action('generate_menu_bar_items', function(){

ie. replace generate_menu_bar_items with the relevant hook.

More info on widgetizing:

https://codex.wordpress.org/Widgetizing_Themes

This archived topic is closed to new replies.