wordpress - Trying to replace PHP String to show different on output -
i using buddypress xprofile plugin.
the string in profile date of birth, want display age on profile page output instead.
this default code, display profile field name , value field.
<dl<?php bp_field_css_class('dl-horizontal'); ?>> <dt><?php bp_the_profile_field_name(); ?></dt> <dd><?php bp_the_profile_field_value(); ?></dd> </dl>
i want have exception, if string named "date of birth" appears in bp_the_profile_field_name(); , display string "age" instead, display rest of fields same are.
as stated in comments, should able see if function bp_get_the_profile_field_name()
returns string 'date of birth', appropriately.
example using if/else block:
if (bp_get_the_profile_field_name() == 'date of birth') { print 'age'; } else { print bp_get_the_profile_field_name(); }
or through ternary operator (shorthand if/else):
<?php print bp_get_the_profile_field_name() ? 'age' : bp_get_the_profile_field_name(); ?>
Comments
Post a Comment