-
Author
-
July 16, 2013 at 10:53 #659ZeRoEParticipant
Hi there,
Is there an easy way to change the homepage search box to show Woocommerce Featured Products instead of “I am a…” “looking for a…”?
Or if its not easy, how would it be done?
Thanks
July 16, 2013 at 14:36 #666SQadminKeymasterHi,
You can change the function that renders the search form by adding this in sweetdate-child/functions.phpCOPY CODEfunction render_user_search() { if (is_page_template('page-templates/front-page.php') AND sq_option('home_search',1) == 1) get_template_part('page-parts/home-search-form'); }
Try changing get_template_part(‘page-parts/home-search-form’); with what you want to show. It you want to display a shortcode you can do this:
COPY CODEecho do_shortcode('[my_shortcode]');
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 19, 2013 at 14:40 #757ZeRoEParticipantHey,
Sorry I’m not very good with PHP, I pasted the above code into functions using Dreamweaver and it’s showing a syntax error on the “get_template_part” line of text. 🙁
July 20, 2013 at 06:24 #762SQadminKeymasterIf you added it in sweetdate-child/functions.php it should work
Anyway that was an example how to replace the form. Another one is to modify the way you like the form template:
page-parts/home-search-form.phpHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 29, 2013 at 12:49 #982ZeRoEParticipantApologies for the delay.
I added the above code to functions, I now get “Parse error: syntax error, unexpected ‘echo’ (T_ECHO) in /wp-content/themes/sweetdate-child/functions.php on line 50”
July 29, 2013 at 21:31 #998SQadminKeymasterHi,
I don’t know what your code looks like. Please give more details on your problems.
You should end up having:COPY CODEfunction render_user_search() { if (is_page_template('page-templates/front-page.php') AND sq_option('home_search',1) == 1) echo do_shortcode('[my_shortcode]'); }
Like I said, this is an example and you need to put an actual shortcode there.
RegardsHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 30, 2013 at 13:12 #1024ZeRoEParticipantHey sqadmin,
That works perfect, thanks!
(Hopefully) Last question – Is there any way of merging it with the original style of the original search box?
EDIT: Not last question apparently. When I try other shortcodes within the code, they align to the right of the page?
July 30, 2013 at 19:17 #1046SQadminKeymasterHi,
You need to do it from css to match the our form style.
To keep the same width of as the original form you could wrap the shortcode like this:COPY CODEfunction render_user_search() { if (is_page_template('page-templates/front-page.php') AND sq_option('home_search',1) == 1) { echo '<div class="twelve columns"> <div class="row"> <div class="five columns">'; echo do_shortcode('[my_shortcode]'); echo '</div> </div><!--end row--> </div><!--end twelve-->'; } }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.