- This topic has 5 replies, 3 voices, and was last updated 8 months ago by
David.
-
AuthorPosts
-
November 14, 2020 at 9:04 pm #1531663
Jackson
Generally Widgets are meant for sidebars and usually displayed after the main content in responsive view.
I need a separate widget area below the header, so that, it is displayed before the main content in Mobile View. Is is possible?
Note: I don’t want to make modifications with existing Sidebars (Both Right and Left)
Thank YouNovember 15, 2020 at 6:10 am #1531931David
StaffCustomer SupportHi there,
you can register your own widget areas and use a GP Hook eg.
generate_after_header
to output your custom widget area:https://codex.wordpress.org/Widgetizing_Themes
But that will require you defining the HTML and CSS for its display.
If you’re using the Block Editor, than this is one method i use:
1. Install the GenerateBlocks and Organic Widget Area Block plugins.
2. Create a New Block Element and set it to Hook >generate_after_header
3. Build your responsive layout and stying using the GenerateBlocks Grid Block etc. and add the Organic Widget Area blocks to them.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 15, 2020 at 6:14 pm #1532820Jackson
Thank you very much David for mentioning available solutions. I may go with the first one…Probably
November 16, 2020 at 1:18 am #1533004David
StaffCustomer SupportYou’re welcome
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 27, 2021 at 6:47 am #1978143WebbPlatsen
I want this too and I just want use Appearance > Widgets.
Specific Genesis code below works.
I understand “genesis_after_header” need to be replaced by “generate_after_header” and genesis_widget_area function can not be used.// Register TopContent Widget Area register_sidebar( array( 'id' => 'topcontent-widget', 'name' => __( 'Top Content', 'genesis' ), 'description' => __( 'Top Content Widget Area', 'childtheme' ), 'before_widget' => '<div>', 'after_widget' => '</div>', ) ); // Hook add_action( 'genesis_after_header', 'add_genesis_widget_area' ); function add_genesis_widget_area() { genesis_widget_area( 'topcontent-widget'); }
October 27, 2021 at 7:35 am #1978263David
StaffCustomer SupportHi there,
you would use the core
dynamic_sidebar
function eg.add_action('generate_after_header', 'add_custom_widget_area' ); function add_custom_widget_area() { dynamic_sidebar( 'topcontent-widget' ); }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.