Show name fields as initials

Let's say you have a View to display donations.

Screenshot of a View showing Names and Donation Amounts as columns.

In most cases, donors want to keep their names private; they want to make anonymous donations instead. For these cases, GravityView has an option for name fields to display initials instead of full names.

Screenshot showing the settings modal for the name field.

With the option "Show as initials" checked:

Screenshot of a View showing name initials and Donation Amounts as columns.

This setting can also be set for specific subfields of the name field, like the last name field:

Screenshot of a View showing the full first name and only initials of the last name field.


For Developers

This functionality also has a WordPress filter that allows further customization.

add_filter('gk/gravityview/fields/name/initials', 'customize_initials', 10, 2);
function customize_initials($display_value, $gravityview) {
    $display_value = strtolower($display_value);
    return $display_value;
}

Read here how to add these code samples to your website: Where to put code samples.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us