Site logo

Archived topic

Add widget at the top of a page

5 replies · Started by Daniel on July 19, 2021

Viewing posts 1–6 of 6

Hi there,
I have built a left sidbar with some widgets. Now I would like to have the sidebar at the top of my page like a "topbar". Do you have a workaround for this?
Thanks,
Daniel

Hi there,

why not use the Top Bar Widget area ?

Hi David,
thank you for your reply. Yes, I also tried the Top Bar Widget Area, but it's above the secondary-navigation. For clarificatin: I would like to have the widget area at the top of my shop archive page.
Thanks,
Daniel

So if you want it immediately above the Shop archive, then you can create a Hook Element to add the sidebar into the shop archive.

1. Create a new Hook Element:

https://docs.generatepress.com/article/hooks-element-overview/

a. Add this snippet to the element:

<?php get_sidebar( 'right-sidebar'); ?>

b. Select the Hook you want eg. woocommerce_arhive_description

You can see the available Woo hooks here:

https://www.businessbloomer.com/woocommerce-visual-hook-guide-archiveshopcat-page/

c. Check the Execute PHP option.

d. Set the Display Rules to: Product Archive and you can add other locations if required.

2. Disable the Sidebar in Customizer > Layout > Woocommerce to it doesn't output it in the default position as well.

NOTE: The sidebar will load with it default styling which is a stack of widgets, it won't convert them into a row. That will require some CSS.

Hi David,
I've followed your steps exactely, but it doesn't work. No sidebar will be visible at the top of the shop page.
Any ideas?
Thanks a lot,
Daniel

This archived topic is closed to new replies.