Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Using Hooks Inside Right Sidebar

  • I’ve created an element for the right sidebar on single posts. I would like to hook individual block elements into this sidebar area and thus achieve the ability to control what blocks are hooked into the sidebar based on GP location and exclusion rules. Is this feasible, or am I better off creating multiple sidebar elements with defined content blocks?

    Your insight would be appreciated.
    David

  • Hi there,

    the dynamic Display Rules only work at the element level.
    So you can either:

    1. Create separate sidebars for each kind you require.

    2. Hook multiple sidebar elements into the same place, ie. you can have more than one right sidebar on the same page. GP will order them by oldest element first.

  • Hey David –

    Wasn’t aware of the flexibility in creating multiple sidebar elements for the same page. So, gave that a quick whirl. As to ordering the appearance, that isn’t the best solution, though I understand the rationale behind it.

    We went back to the sketch pad & prototyped out a different solution using block elements and hooking them before_right_sidebar_content. That offers the use of the priority sequence with all the flexibility of blocks and achieves the result we’re looking for. We can now build a library of block elements that can be hooked anywhere and ordered in the sidebar with great control.

    Where we’re going with the site will likely wind up with multiple CPT’s. They are sufficiently different in terms of custom field requirements and should make maintenance easier. So, we’re working diligently to avoid any duplication by the “copy & paste” approach. I’m an old hat at OO programming so I really understand the value of component reutilization.

    Thanks for the insight David.

  • As to ordering the appearance

    We intend to “show” the Priority option to the sidebars element type in a future update. For some reason we choose to hide it. But you can i) switch the Element Type to hook ii) set the Priorty and iii) switch back to Sidebar. Just an FYI.

    But i like the before and after sidebar hooks personally 🙂

    Sounds like a good solution!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.