- This topic has 7 replies, 2 voices, and was last updated 3 years, 2 months ago by
Ying.
-
AuthorPosts
-
February 2, 2023 at 11:17 am #2518924
Daniel
Hi there!
I need to create a custom button that, when clicked, will load the GeneratePress search form. I need to put that search button in a block inside Gutenberg.
I want to know if that is possible. To create a button with a specific class or to use a shortcode to generate the GP search button and be able to place it inside a Gutenberg block.
Any other system that you recommend me and that I can include inside a Gutenberg block can be useful to me.
Thanks!
February 2, 2023 at 11:31 am #2518931Ying
StaffCustomer SupportHi Daniel,
Do you consider using the WP search block?
February 2, 2023 at 11:47 am #2518944Daniel
Hi Ying,
What I need is a button or something like the magnifier icon GP adds to the main menu that when clicked opens the search form template.
The WP search block is a search input and a search button. I can’t use that block for what I want to achieve.
February 2, 2023 at 12:17 pm #2518969Ying
StaffCustomer SupportWhere are you going to place the button? There’s no easy way to use just a class to achieve this.
Let me know!
February 2, 2023 at 1:24 pm #2519031Daniel
I need it for use within Gutenberg.
I don’t care if it is a button, an icon or a shortcode that I can use to call the search template.I don’t know if in GP there is a function that generates the search button/icon. If there is such a function, maybe I can build it into a shortcode to display it where I need it.
February 2, 2023 at 3:53 pm #2519125Ying
StaffCustomer SupportYou can give this code a try, using the
[gp_navigation_search]shortcode.function generate_navigation_search_shortcode() { // Call the theme's built-in function $navigaion_button = generate_do_navigation_search_button(); $search_form = generate_navigation_search(); $output = $navigaion_button .$search_form; echo $output; } add_shortcode( 'gp_navigation_search', 'generate_navigation_search_shortcode' );February 3, 2023 at 2:26 am #2519749Daniel
Thanks for the code, Ying.
Unfortunately, once I added the code to functions.php and inserted the shortcode, nothing is generated on the page.
Anyway, I have found a workaround to achieve what I needed, so I’ve got it solved.
February 3, 2023 at 10:10 am #2520400Ying
StaffCustomer SupportGlad to hear that 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.