Hello,
You can not override plugin files through a child theme. Please let me know what you are trying to achieve so I can help.
Hey,
hm okay. Actually it’s just a cosmetical edit, I want the separators to have some space between the numbers. So if a user enters a From-To Value [10,20] I want it to be displayed in the frontend like “10 – 20” instead of “10-20”. Thus, I just want to add two spaces around the “-” separator. I assume this is not possible via CSS. At least I tried and didn’t manage successfully.
Thanks for your support.
-
This reply was modified 2 years, 3 months ago by
bastibln.
-
This reply was modified 2 years, 3 months ago by
bastibln.
Hello,
Use this code in your ‘bp-custom.php’ file.
Please try the following code:
add_filter( 'bp_get_the_profile_field_value', function ( $value, $field_type, $field_id ) {
if ( 'fromto' === $field_type ) {
$user_id = bp_is_user() ? bp_displayed_user_id() : bp_get_member_user_id();
if ( ! $user_id ) {
return $value;
}
$separator = bp_xprofile_get_meta( $field_id, 'field', 'separator_token', true );
$separator = empty( $separator ) ? ' - ' : " $separator ";
$field_value = explode( ',', xprofile_get_field_data( $field_id, $user_id, 'comma' ) );
$field_value = array_map( 'trim', $field_value );
if ( count( $field_value ) !== 2 ) {
return $value;
}
$value = sprintf( '<span class="bpxcftr-fromto-from-value">%1$s</span>%3$s<span class="bpxcftr-fromto-to-value">%2$s</span>', $field_value[0], $field_value[1], $separator );
}
return $value;
}, 10, 3 );
Wow, thanks a lot for the quick and great help. This works perfectly.
Have a wonderful day !
Thank you for the acknowledgement. I am glad that I could help.