- This topic has 7 replies, 2 voices, and was last updated 4 years, 5 months ago by
Leo.
-
AuthorPosts
-
June 28, 2019 at 7:32 am #943938
Sebastien
Hi,
At the moment, I use a GP ELEMENT > Header to add custom content into the header of a page.
I plan to build a php template to get more flexibility.1) Can you tell me which is the right php Filter/Hook to replace this element?
2) In a second time, I would like to apply this hook to a WP Custom Block (that I’ve made). I would like to know if my idea would work?
The plan is to apply the hook to the BLOCK: That would able me to manage my “header content” from the Nativ WP Editing page.
I’m not sure if this method will have any effect with performence (maybe block get more time to load?)Thanks.
June 28, 2019 at 12:06 pm #944128Leo
StaffCustomer SupportHi there,
1. That depends on where the code is supposed to be added. Usually it should be in
wp_head
in Hooks Elements:
https://docs.generatepress.com/article/hooks-element-overview/2. Not sure if I fully understand. You are referring to Gutenberg blocks? It’s not possible use Gutenberg editor with Elements currently unfortunately.
Let me know if this helps 🙂
June 28, 2019 at 12:39 pm #944164Sebastien
Hi,
Thanks for the answer.
about the 2cnd point:
I’ve already built my own custom WP Gutenber Block.
What I want is that this block appears into my Header.
Can I use:wp_head( 'your_hook_name','example_function_name' ); function example_function_name() { ?> Insert your hook contents in here. <?php }
hook into my Custom Gutenberg Block (into the .php template) to “force” it to be displayed into the Header (the same way like using Hooks Element) when it is called?
The plan is to add this custom block into a page. Then when the page is loaded (when the block is called) it is displayed into the header (instead of the normal content position).How can I manage that? Where do I need to place the hook? thanks
June 28, 2019 at 12:41 pm #944165Leo
StaffCustomer SupportIt’s not possible to insert a block into hook unfortunately.
You will have to build the content directly in hooks without blocks.
June 28, 2019 at 11:06 pm #944390Sebastien
Thanks Leo for information,
My question may be a bit redudent but you said it is not possible to insert a block into hook.
But is it possible to insert hook into blook?The block would be called… and from inside its template it would launch the hook to force its position to be into the header.
June 28, 2019 at 11:35 pm #944397Leo
StaffCustomer SupportDon’t think that’s possible either.
What exactly are you trying to build? Couldn’t you just build it with default hooks and HTML content?
June 29, 2019 at 12:00 am #944400Sebastien
I try to use a block that I could manage (editing content) directly from the EDITING PAGE (gutenberg, like a classic Block) AND I would this block be positionned into the header (like it does when using Hook Element or php hook + HTML content..
Of course I can stay with a “hook element” and html….. but for my end users and for I, it would be definitly nicer to regroup all the content into the same Editing page.
it would be very helpfull if you can confirm that is not currently possible ?
thanks so much !
June 29, 2019 at 7:02 am #944539Leo
StaffCustomer SupportYes I can confirm this is not possible.
-
AuthorPosts
- You must be logged in to reply to this topic.