- This topic has 21 replies, 5 voices, and was last updated 2 weeks, 4 days ago by David.
January 15, 2021 at 2:32 am #1619647Fabien
When using a Block Element, is there a way to add a priority (like you can do with hooks) ?
ThanksJanuary 15, 2021 at 2:33 am #1619650Fabien
Just to clarify, I am talking about a (Right) Sidebar block typeJanuary 15, 2021 at 5:52 am #1619860DavidStaffCustomer Support
Priorities will only apply if you use a Hook – you can can use the
after_right_sidebar_contentto hook into the same place.
The alternative when replacing the Sidebar, is to create the complete Sidebar for page X and then create a complete alternative for page YJanuary 15, 2021 at 6:15 am #1619885Fabien
I guess I’ve found a “hack”, switch to “hook” change priority, go back to “right sidebar” !January 15, 2021 at 7:07 am #1620118DavidStaffCustomer SupportMarch 27, 2022 at 4:28 am #2168620Natalie
I was looking for the way to change the order of my 4 seperate right sidebar elements.
I could not find anything in the documentation. I saw that other Element Types have the Priority item but Right Sidebar does not.
The “Hack” Fabien suggests works, Thanks for that.
Surely Priority should be an option under the Right Sidebar Elemet Type.March 27, 2022 at 9:25 am #2168921DavidStaffCustomer Support
Hmmm… it was never in our consideration that a user may want to add many Right Sidebars to the page, that is where the
aftersidebar hooks should be used.
Ill take a look whether we can adding priority for the sidebar option itself is a possibility.July 23, 2022 at 5:18 am #2291277Scott
If I’m not mistaken, every one of those GP Element types gets inserted in the appropriate place via a hook, and all hooks have a priority (with a default of 10 if not specified), so it would seem that exposing that priority would make a lot of sense. Since you can cause multiple GP Elements to fire off for a page, you would expect you would be able to control the order when they all hang off a common hook, like after-main-content. Using a different hook to attach to a different part of the page doesn’t make sense; you would expect to be able to write these hooks/blocks independently from each other.July 23, 2022 at 10:26 am #2291541DavidStaffCustomer Support
Yeah, its on our list of to dos, hopefully with the next elements update.
For the record, the priority is only missing from the specific block element types that are used to replace a theme template part such as the Right or Left Sidebar. The Priority is available for the Element Type > Hook.July 24, 2022 at 11:19 am #2292340Scott
…but not Blocks, which is where it’s really needed. Thanks for keeping the issue visible!July 25, 2022 at 2:56 am #2292750DavidStaffCustomer Support
FYI – If the Block Element is set to Element Type: Hook then the priority is there:
Glad to be of helpJuly 25, 2022 at 8:28 am #2293193Scott
Hmm, I don’t think it works that way anymore… When I create an Element, I choose type Block, because if I choose type Hook the editor I’m given is a code editor, not a Block editor. In that case, I’m not presented with the metabox containing the hook priority as is shown in the article.
That’s how I _wish_ it would work, but I do not think the current version does it that way. I’d love to be proven wrong, though!July 25, 2022 at 8:34 am #2293195DavidStaffCustomer SupportJuly 25, 2022 at 7:51 pm #2293542Scott
When I select Element type Hook, I see what you see, but I don’t get the block editor then, I get a code/text editor. When I select type Block, I get the Block editor, but not the hook metabox. So yes, I can make the hook metabox appear, but then I can’t edit blocks.July 25, 2022 at 8:01 pm #2293547Fernando Customer Support
May we know what you’re trying to do?
The Hook Element and the Block Element are two different features.
If you’re wanting to use a Block Element – Hook, you’ll need to select Block as the Element type when creating a new element. Then, once in the Block Element edit page, in the Element type in the Element settings, select Hook.
Hope this clarifies!
- You must be logged in to reply to this topic.