Skip to content

Instantly share code, notes, and snippets.

@jrstaatsiii
Created July 3, 2014 14:46
Show Gist options
  • Save jrstaatsiii/7b6608e197de1c2c39fc to your computer and use it in GitHub Desktop.
Save jrstaatsiii/7b6608e197de1c2c39fc to your computer and use it in GitHub Desktop.
Product Search Block
<section id="product-search" class="products-search products content-block entry">
<?php if ( get_sub_field('ssm_headline') ) { ?>
<header class="content-block-header">
<?php if ( get_sub_field('ssm_intro_copy') ) { ?>
<div class="intro">
<?php the_sub_field('ssm_intro_copy'); ?>
</div>
<!-- end .intro -->
<?php } ?>
<div class="headline">
<h1><?php the_sub_field('ssm_headline'); ?></h1>
</div>
<div class="sizes-pricing">
<?php if ( get_field('ssm_sizes_and_prices_image', 'options') ) { ?>
<a class="fancybox" href="<?php the_field('ssm_sizes_and_prices_image', 'options'); ?>">Sizes/Prices</a>
<?php } else { ?>
<a class="fancybox" href="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/sizes-prices.png">Sizes/Prices</a>
<?php } ?>
</div>
<div class="collections">
<a href="/collections/">View Collections</a>
</div>
</header>
<?php } // end get_sub_field('ssm_headline') ?>
<?php if ( get_sub_field('ssm_include_search_facets') == 'Yes' ) { ?>
<div class="facets">
<?php if ( get_sub_field('ssm_search_form') == 'Yes' ) { ?>
<?php echo do_shortcode('[facetwp facet="search"]'); ?>
<?php } ?>
<?php if ( get_sub_field('ssm_searchable_facets') ) { ?>
<?php $facets = get_sub_field('ssm_searchable_facets'); ?>
<?php $totalCount = count($facets); ?>
<?php $count = 1; ?>
<div class="facet-wrap cols-<?php echo $totalCount; ?>">
<h2>Filters</h2>
<?php foreach ( $facets as $facet ) { ?>
<?php switch ( $facet ) {
case 'Sizes':
echo '<div class="facet col-' . $count . '">';
echo '<h3>Sizes</h3>';
echo do_shortcode('[facetwp facet="size"]');
echo '</div>';
break;
case 'Collections':
echo '<div class="facet col-' . $count . '">';
echo '<h3>Collections</h3>';
echo do_shortcode('[facetwp facet="collections"]');
echo '</div>';
break;
case 'Tags':
echo '<div class="facet col-' . $count . '">';
echo '<h3>Tags</h3>';
echo do_shortcode('[facetwp facet="tags"]');
echo '</div>';
break;
} ?>
<?php $count++; ?>
<?php } // end foreach $facet ?>
</div>
<!-- end .facet-wrap -->
<?php } // endif get_sub_field('ssm_searchable_facets')?>
</div>
<!-- end .facets -->
<?php } // endif get_sub_field('ssm_include_search_facets') ?>
<div class="product-gallery pull-width">
<div class="gallery-container">
<?php echo do_shortcode('[facetwp template="gallery"]'); ?>
</div>
<!-- end .gallery-container -->
</div>
<!-- end .product-gallery -->
<div class="pagination">
<?php echo do_shortcode('[facetwp pager="true"]'); ?>
</div>
<!-- end .pagination -->
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment