Skip to content

Instantly share code, notes, and snippets.

@thenbrent

thenbrent/gist:740720f767e2f9935051 Secret

Last active Dec 15, 2015
Embed
What would you like to do?
Sidebar filters
<div id="eex-events-filters" class="widget">
<div class="widget-wrap widget-inside">
<h3 class="widget-title"><?php _e( 'Filter Results:', hybrid_get_parent_textdomain() ); ?> <a href="#" title="You can refine your results using the filters below." class="btn-help">help</a></h3>
<p class="filter-help" style="display:none;">
<span>
<?php _e( 'You can refine your results using the filters below.', hybrid_get_parent_textdomain() ); ?> <a href="#" title="Close Help" class="btn-help-close">Close</a>
</span>
</p><!-- .filter-help -->
<h4 class="widget-title"><?php _e( 'Type', hybrid_get_parent_textdomain() ); ?></h4>
<ul class="categories filter">
<?php $post_types = eg_get_post_types_with_counts(); ?>
<?php foreach( $post_types as $post_type ) : ?>
<li class="cat-item <?php eg_the_filter_class( 'post_type', $post_type->name ) ?>">
<a href="<?php echo FS_Simple_Search::get_search_filter_uri( 'post_type', $post_type->name ); ?>" title="<?php print_r( __( 'Show only %s', hybrid_get_parent_textdomain() ), $post_type->label )?>"><?php printf( '%s <span>(%s)</span>', $post_type->label, $post_type->count ); ?></a>
</li>
<?php endforeach; ?>
</ul><!-- .filter .categories -->
<?php $taxonomies[] = get_taxonomy( 'eex_industry' ); ?>
<?php $taxonomies[] = get_taxonomy( 'eex_technology' ); ?>
<?php foreach( $taxonomies as $taxonomy ) : ?>
<h4 class="widget-title"><?php echo $taxonomy->labels->singular_name; ?></h4>
<ul class="categories filter">
<?php $terms = get_terms( $taxonomy->name ); ?>
<?php $search_query = get_search_query(); ?>
<?php if( ! empty( $search_query ) && ! in_array( $search_query, array( '~', '' ) ) ) : ?>
<?php $terms = eg_update_term_counts( $terms, $taxonomy->name ); ?>
<?php endif; ?>
<?php if( ! empty( $terms ) ) : ?>
<?php foreach( $terms as $term ) : ?>
<li class="cat-item <?php eg_the_filter_class( $taxonomy->query_var, $term->slug ) ?>">
<a href="<?php echo FS_Simple_Search::get_search_filter_uri( $taxonomy->query_var, $term->slug ) ?>" title="<?php print_r( __( 'Show only results in %s', hybrid_get_parent_textdomain() ), $term->name )?>"><?php echo $term->name . '<span>(' . $term->count . ')</span>'; ?></a>
</li>
<?php endforeach; ?>
<?php else : ?>
<li class="cat-item"><?php _e( 'None available.', hybrid_get_parent_textdomain() ); ?></li>
<?php endif; ?>
</ul><!-- .filter .categories -->
<?php endforeach; ?>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.