Archived topic
Block Element in Sidebar
24 replies · Started by Ian on February 17, 2021
Am I missing something. I created a Block Element of social icons using GB Buttons. Is there a way to grab this as a shortcode and inject it into the default WP sidebar?
Hi Ian,
You could choose hook as block type, choose generate_before_sidebar or generate_after_sidebar as hook. Here's a visual guide for GP hooks.
Hope it helps :)
Thanks Ying. The Social Icons need to be the 2nd widget in the sidebar. Is there any other way to do this?
Also, I was hoping to use GB to build out the icons. I think I may be missing something here. Given the great tools like Blocks and Elements, it seems to be doable. lol
Yes, could use some CSS to re-order the widgets in sidebar :)
Please link us to the site in question using the private info field so we can have a look.
Thank you. I have added a link to a post. You can see the social icons right now. I want to replace this using GB Buttons.
Alright, set block element using generate_before_right_sidebar hook, and here's the CSS to position the sidebar content:
.inside-right-sidebar {
display: flex;
flex-direction: column;
}
.inside-right-sidebar #search-8 {
order: -1;
}
Hi Ying,
If I am using Blocks (GB Buttons module) to make these icons, how can I hook it? There is no hook function within Element > Blocks Element. Again, I may be missing something here.
Come to think of it, since Blocks is a thing now, I wonder if we can use GB to build the entire sidebar and insert it this way?
First option use block element as a hook:
1. Choose hook as block type:
https://docs.generatepress.com/article/block-element-overview/#block-type
2. Choose generate_before_right_sidebar as hook.
3. Add CSS to customizer > additional css.
Second option, yes, you can build the entire sidebar using blocks. Just choose right sidebar as block type, it will replace the default sidebar you are having now.
https://docs.generatepress.com/article/block-element-overview/#right-sidebar-type
Let me know :)
When I choose Element = Hook, there is no way to launch Gutenberg to use Generate Blocks to build the icons using GB Buttons?
Well all the steps are based on it's a Block element, not Hook element or Header element or any other elements. :P
So before all the steps I mentioned in my previous reply, you go to Appearance > Elements, Create a Block element.
https://docs.generatepress.com/article/block-element-overview/#creating-a-block-element
Wait, I see the issue now. This site is still running the Classic Editors so we have installed a plugin to be able to switch Between Classic and Block Editor. When choosing Block, I see Block Type in the classic Editor. But once I switch to Block Editor, the Block Type options disappear even if I switch back to the Classic Editor. Glitch?
Any chance you can link us the login info?
You can use the private information field.
Hi Ying, done. Let me know what else I can provide!
I just had a look, got what you were struggling with.
Once you deactivate classic editor plugin, you can add a new Block element with all the settings available :)
Doh! Site has a long history, not ready to deactivate that yet. May I ask if you deactivated that plugin when you logged in?
If so, do you think all old content will stay as is until someone edits with Block editor and choose Convert to Blocks? We have some very old content that rocks so don't want to break anything.