<?php
if ( function_exists( 'bp_follow_add_follow_button' ) ) :
if ( bp_loggedin_user_id() && bp_loggedin_user_id() != get_the_author_meta( 'ID' ) ) {
bp_follow_add_follow_button( array(
'leader_id' => get_the_author_meta( 'ID' ),
'follower_id' => bp_loggedin_user_id(),
'link_class' => 'post-follow-btn'
) );
}
endif;
?>
//jQuery Also here
<script>
jQuery( document).ready( function ($) {
$(document).on("click", ".hentry .follow-button a", function() {
bp_follow_button_action( $(this) );
return false;
});
});
</script>