Ignore sticky posts
-
This plugin could really use an equivalent of the “ignore_sticky_posts” argument in WordPress core. For me, it doesn’t really make much sense to have sticky posts in the groups widget, for example. In lack of a better way of achieving this, I came up with the following solution in my functions.php:
if (class_exists('BP_Sticky_Groups') && !is_admin() ) { remove_filter( 'bp_groups_get_paged_groups_sql', array( BP_Sticky_Groups::instance(), 'alter_bp_groups_query' ), 10, 2 ); function allow_sticky_groups() { add_filter( 'bp_groups_get_paged_groups_sql', array( BP_Sticky_Groups::instance(), 'alter_bp_groups_query' ), 10, 2 ); } add_action('bp_before_groups_loop', 'allow_sticky_groups'); function disallow_sticky_groups() { remove_filter( 'bp_groups_get_paged_groups_sql', array( BP_Sticky_Groups::instance(), 'alter_bp_groups_query' ), 10, 2 ); } add_action('bp_after_groups_loop', 'disallow_sticky_groups'); }
I hope that helps someone and/or maybe even encourages the plugin author to implement a neater solution. ??
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Ignore sticky posts’ is closed to new replies.