-
-
Save imath/039456f31f48596ec0e41efa98b5946a to your computer and use it in GitHub Desktop.
Force the Groups loop query to get groups having a specific tag
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 | |
function bp_groups_taxo_loop() { | |
$bp = buddypress(); | |
$reset_term = 0; | |
$reset_tax_query = array(); | |
if ( ! empty( $bp->groups->tag->term ) ) { | |
$reset_term = $bp->groups->tag->term; | |
} | |
if ( ! empty( $bp->groups->tag->tax_query ) ) { | |
$reset_tax_query = $bp->groups->tag->tax_query; | |
} | |
// Set the term | |
$bp->groups->tag->term = BP_Groups_Terms::get_term_by( 'slug', 'thetagslug' ); | |
// The Groups loop. | |
bp_get_template_part( 'groups/groups-loop' ); | |
$bp->groups->tag->term = $reset_term; | |
$bp->groups->tag->tax_query = $reset_tax_query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment