Search Results for 'bp_after_has_activities_parse_args'
-
Search Results
-
I’m filtering my activity pages using the bp_after_has_activities_parse_args filter and using conditionals depending on the activity page. But my conditionals are not working correctly for my custom pages. I’m not great with PHP but I’ve followed the instructions the best I can to put this together and I hope someone can help me with this to find a work around.
Here is what I’ve done.
I’m creating custom activity pages by setting them up in admin>pages>add page ‘custom-page-1’, ‘custom-page-2’ etc. I’ve setup each of these pages similar to the activity/index.php to create the activity loop:
<div id="buddypress"> <div class="activity"> <?php bp_get_template_part( 'activity/activity-loop' ); ?> </div> </div>
Now with the parse_args filter, I can use conditionals to filter some of the activity pages, but my conditionals are not working correctly for my custom pages – they work to begin with but when I click the load more button, the new items are not being filtered. Here is an example to show you what is working and what is not (using the per_page filter for demonstration):
function cm_activity_filter( $retval ) { // The following conditionals to filter are working fine: // Activity directory if ( bp_is_activity_directory() ) { $retval['per_page'] = 2; } // User profile just-me component if ( bp_is_current_action( 'just-me' )) { $retval['per_page'] = 3; } // A custom component in the members profile I setup using bp_core_new_nav_item if ( bp_is_current_action( 'custom-compenent' )) { $retval['per_page'] = 10; } // The following conditionals to filter my custom pages are not working when the load more button is clicked : // custom activity page 1 if (is_page( 'custom-page-1' ) ) { $retval['per_page'] = 2; } // custom activity page 2 if (is_page( 'custom-page-2' ) ) { $retval['per_page'] = 8; } return $retval; } add_filter( 'bp_after_has_activities_parse_args', 'cm_activity_filter' );
So the is_page() conditionals are not working when the load more button is clicked. Is there a way to get this to work correctly. Any help appreciated.