Last active
November 30, 2018 18:27
-
-
Save CKMacLeod/75211e5cfabcc6e1ce665a33e366ee09 to your computer and use it in GitHub Desktop.
Files relevant to conflicts between WPFacet and Woocommerce Product Bundles (files in use at GBES to display blog posts with FacetWP filtering, sorting, and pagination, plus fix for product archives and blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
get_header(); | |
if ( have_posts() ) { | |
?> | |
<div class="archive-posts-wrapper"> | |
<div class="row align-center archive-posts-facets"> | |
<div class="columns small-12 medium-5 large-4 text-center"> | |
<?php echo facetwp_display( 'facet', 'categories' ); ?> | |
</div> | |
</div> | |
<div class="row archive-posts-sort"> | |
<div class="column"> | |
Sort by: <?php echo facetwp_display( 'sort' ); ?> | |
</div> | |
</div> | |
<div class="row facetwp-template"> | |
<?php | |
while ( have_posts() ) { | |
the_post(); | |
get_template_part( 'template-part/archive-post-single' ); | |
} | |
?> | |
</div> | |
<div class="row"> | |
<div class="columns small-12 text-right"> | |
<?php echo facetwp_display( 'pager' ); ?> | |
</div> | |
</div> | |
</div> | |
<?php | |
} else { | |
?> | |
<div class="row text-center"> | |
<div class="column"> | |
Sorry, no posts were found! | |
</div> | |
</div> | |
<?php | |
} | |
get_footer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); | |
if ( is_post_type_archive( 'post' ) || ( ( is_date() || is_tag() || is_category() ) && 'post' === get_query_var( 'post_type' ) ) ) { | |
locate_template( 'template-part/archive-post.php', true ); | |
} | |
get_footer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* FIX ARCHIVE AND BLOG DISPLAY WHEN BUNDLED ITEM IN CART - ckm 30 NOV 2018 | |
filter function works with FacetWP plugin, addressing conflicts with WooCommerce Product Bundles | |
*/ | |
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) { | |
if ( ! is_home() && 'product_query' != $query->get( 'wc_query' ) ) { | |
$is_main_query = false; | |
} | |
return $is_main_query; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment