Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 64413

[Enh] Add a hook to modify search form input

$
0
0

Replies: 0

WordPress uses query_var post_type=product to load WooCommerce’s search results template (archive-product.php)- if not present, the standard blog template (search.php) is loaded which is not acceptable for a product overview.

That means that the search form should have

<input type=”hidden” name=”post_type” value=”product”>

I didn’t found a way how to correct this behaviour except hacking the final search.php.

Please add a hook called from asl.shortcode.php:46 as you do before (41) and after the form (52).

<?php do_action(‘asl_layout_in_form’, $id); ?>

It will be possible then to add some custom elements, i.e.

<?php

if (is_woommerce() { ?>

<input type=”hidden” name=”post_type” value=”product”>

<?php } ?>

Thanks


Viewing all articles
Browse latest Browse all 64413