Hello Carsten,
Use the following section of code in the function ‘mobile_menu_logged_in_likes_button’ :
$show_count = ''; if ( $count ) { $show_count = '<span class="bpuplike-like-count">' . $count . '</span>'; } // Replace svg with your svg code. return '<a href="' . esc_url( $like_link ) . '"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16"> <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/> </svg>' . $show_count . '</a>';
Regards
RaviHello Carsten,
Replace the function ‘mobile_menu_logged_in_likes_button’ with the following one:
function mobile_menu_logged_in_likes_button( $loggedin_id ) { if ( ! $loggedin_id || ! bpuplike_is_tab_available_for_user( $loggedin_id ) ) { return; } $user_link = bp_core_get_user_domain( $loggedin_id ); $like_link = trailingslashit( $user_link . bpuplike_get_tab_slug() ); $count_type = bpuplike_get_option( 'enable_likes_counter', 'all' ); if ( 'unread' === $count_type ) { $count = bpuplike_get_unread_received_likes_count_for_user( $loggedin_id ); } else { // other people liking the user. $count = bpuplike_get_received_likes_count_for_user( $loggedin_id ); } $show_count = ''; if ( $count ) { $show_count = '<span class="bpuplike-like-count">' . $count . '</span>'; } $icon = '<svg xmlns="http://www.w3.org/2000/svg”" width="24" height="24" fill="currentColor" class="bi bi-heart" viewBox="0 0 16 16"> <path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01L8 2.748zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143c.06.055.119.112.176.171a3.12 3.12 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15z"/> </svg>'; // Replace svg with your svg code. return '<a href="' . esc_url( $like_link ) . '">' . $icon . $show_count . '</a>'; }
Give it a try now.
Regards
RaviHello Carsten,
I have modified the function a little bit. The likes count only reset once the user visits the ‘Received Tab’ on their profile. So, I have changed the link URL to ‘Received Tab’ if visible to the user.
function mobile_menu_logged_in_likes_button( $loggedin_id ) { if ( ! $loggedin_id || ! bpuplike_is_tab_available_for_user( $loggedin_id ) ) { return; } $user_link = bp_core_get_user_domain( $loggedin_id ); $like_link = trailingslashit( $user_link . bpuplike_get_tab_slug() ); if ( _bplike_is_tab_visible( bpuplike_get_option( 'received_likes_tab_visibility', array() ), $loggedin_id, $loggedin_id ) ) { $like_link = trailingslashit( $user_link . bpuplike_get_tab_slug() ) . 'by-others/'; } $count_type = bpuplike_get_option( 'enable_likes_counter', 'all' ); if ( 'unread' === $count_type ) { $count = bpuplike_get_unread_received_likes_count_for_user( $loggedin_id ); } else { // other people liking the user. $count = bpuplike_get_received_likes_count_for_user( $loggedin_id ); } $show_count = ''; if ( $count ) { $show_count = '<span class="bpuplike-like-count">' . $count . '</span>'; } $icon = '<svg xmlns="http://www.w3.org/2000/svg”" width="24" height="24" fill="currentColor" class="bi bi-heart" viewBox="0 0 16 16"> <path d="m8 2.748-.717-.737C5.6.281 2.514.878 1.4 3.053c-.523 1.023-.641 2.5.314 4.385.92 1.815 2.834 3.989 6.286 6.357 3.452-2.368 5.365-4.542 6.286-6.357.955-1.886.838-3.362.314-4.385C13.486.878 10.4.28 8.717 2.01L8 2.748zM8 15C-7.333 4.868 3.279-3.04 7.824 1.143c.06.055.119.112.176.171a3.12 3.12 0 0 1 .176-.17C12.72-3.042 23.333 4.867 8 15z"/> </svg>'; // Replace svg with your svg code. return '<a href="' . esc_url( $like_link ) . '">' . $icon . $show_count . '</a>'; }
Please give it a try now.
Regards
Ravi
You must be logged in to reply to this topic.
This topic is: not resolved