Hey Petr
Yes, basically you need to create your own template, and create a widget area specifically for this page…
1) Make sure custom template is ticked in admin
2) Make sure you enter a slug (ie product-search
)
3) Create your custom template
Now that you are using a slug you can access your search results like:
yoursite.com/product-search
and if you are using a custom template then you can restrict S&F to only appear on this template.
Now the tricky part…. I had to do quite a lot of modification to get it working with the mystile theme exactly how I wanted.
First I duplicated the archive-product.php
from the woocommerce templates folder and called this products-search.php
and put this in my theme folder.
Then I create and register a sidebar, so…. Add this code to functions.php of your theme:
register_sidebar(array(
'name'=> 'Search & Filter Form Widgets',
'id' => 'search_filter_form_widget',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>'
));
Now you will find a new widget area to add S&F widget.
We need to include this in our products-search.php
though so we must create a sidebar first…
Create a new file in your theme folder called sidebar-search-form.php
and add the code:
<?php
/**
* Sidebar Template
*
* If a <code>primary</code> widget area is active and has widgets, display the sidebar.
*
* @package WooFramework
* @subpackage Template
*/
global $woo_options;
if ( isset( $woo_options['woo_layout'] ) && ( $woo_options['woo_layout'] != 'layout-full' ) ) {
?>
<aside id="sidebar" class="col-right">
<?php dynamic_sidebar( 'search_filter_form_widget' ); ?>
</aside><!-- /#sidebar -->
<?php } // End IF Statement ?>
Now we have a sidebar that loads our custom widget area…. but this is still not in our template… so in the template product-search.php
add:
<?php
get_sidebar('search-form');
?>
And there you have it! A new widget area just for your custom template 🙂