Archived topic
Hooks inside widgets?
19 replies · Started by Media Friendly on May 23, 2015
It baffles me since this features is not because of a limitation with WordPress but because a non-existing GeneratePress hook.
A theme can't inject a hook to a pre-made widget block. Widget blocks are hard-coded by its developer so its rendered HTML structure is fixed.:) (the content is dynamic, taken from its text field but the structure is fixed)
While some have filter hooks, it's usually something minor like changing the widget heading/title or its class selector.
Depending what you're trying to do, I think it's doing a template on Block Element and hooking it to a portable hook may be a good idea.
Check the portable_hook shortcode snippet provided here –
https://generatepress.com/forums/topic/hook-in-hook/#post-1636333
True. I should be specific again. I am referring to the GeneratePress theme. So to my understanding even with the GeneratePress theme AND the GeneratePress plugin there is no way to hook into the contents of a sidebar widget. Only above or below the entire sidebar (not within an individual widget).
I am referring to the GeneratePress theme. So to my understanding even with the GeneratePress theme AND the GeneratePress plugin there is no way to hook into the contents of a sidebar widget.
That's correct. For reason I've stated on my previous reply. :)
Only above or below the entire sidebar (not within an individual widget).
That's correct as well. With the hooks I've mentioned here - https://generatepress.com/forums/topic/hooks-inside-widgets/#post-1998031
As a workaround solution if you want to hook something in between widgets, you can add your own hook there w/ a shortcode, manually. :D
Thank you for the replies. My original comment was simply to confirm that GeneratePress does NOT have the ability to hook into a widget (through the GP plugin or GP theme). Again thank you for the replies.
No problem. Feel free to open a new topic if you need further help in relation to this. :)