[Resolved] Hook for block element to be same as header element?

Home Forums Support [Resolved] Hook for block element to be same as header element?

Home Forums Support Hook for block element to be same as header element?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2396057
    William

    Hi there,

    I am having some issues with GP hooks and hope there is a solution to the issue.

    I have a header element designed using the ‘Header’ element type, which you can see the example post here.

    I also have a ‘Hook’ element type, which adds a ‘header_advert’ div element, which is where an advert is loaded into. For the above post, you can see this displays it underneath the header element.

    I have just updated the design of the page hero to one in Blocks (thank you GP for doing block element types). As just mentioned, it is a ‘Block’ element type, with an example post here.

    However, you can see the advert/header_advert div element loads above the element, which is not my intention – I want it to load below it like the previous design.

    How can this be achieved? I currently have the ‘Block’ hook name set to ‘after_header’ and have tested and don’t see anything else that can achieve this.

    With the Header element type with the classic editor feel, moving to a Block element to replace it, how do you make the transition easy and seamless without any loss of position changes etc.?

    Many thanks,

    Will

    #2396409
    David
    Staff
    Customer Support

    Hi there,

    beneath where you set the elements Hook to after_header there is a Priority field. Set the priority to a higher value eg. 20

    The priority sets in what order the hook callback should be made, lower numbers come before higher numbers.
    So when you have many callbacks being made from the same hook ( note – Header Elements and Block Element – Page Heros are both hooked into after_header ) you can use priority to set their order.

    #2396546
    William

    I have been scratching my head at this with my ad company and can’t believe the solution was so simple and easy, inbuilt direct into Generate Press :’) Thank you so much David

    #2396593
    David
    Staff
    Customer Support

    Glad to be of help 🙂

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