Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    Here are two different methods. Put one of them in your active theme’s functions.php file.

    /**
     * Displays the author's name as initials
     */
    add_filter( 'site-reviews/get/review', function( $review ) {
        if( !is_admin() ) {
            preg_match_all( '/(?<=\s|\b)\pL/u', $review->author, $matches );
            $initials = implode( '. ', $matches[0] ).'.';
            $review->author = strtoupper( $initials );
        }
        return $review;
    });
    /**
     * Masks the author's name with asterisks
     */
    add_filter( 'site-reviews/get/review', function( $review ) {
        if( !is_admin() ) {
            $author = &$review->author;
            $author = mb_substr( $author, 0, 1 ).'****'.mb_substr( $author, -1 );
        }
        return $review;
    });
    Thread Starter Christopher Hilling

    (@chilling)

    That works perfectly: resolved
    Thanks
    Chris

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is possible to show just initials?’ is closed to new replies.