• Resolved strangechild

    (@strangechild)


    When someone is looking at a friend’s wishlist there is no name displayed. Is there a way to have that displayed at the top of the page?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi there

    you can obtain this result by adding the following snippet of code at the end of functions.php file of your theme or child theme

    if ( ! function_exists( 'yith_wcwl_print_author_name' ) ) {
    	function yith_wcwl_print_author_name( $wishlist ) {
    		/**
    		 * @var YITH_WCWL_Wishlist $wishlist
    		 */
    		$user_id = $wishlist->get_user_id();
    
    		if ( ! $user_id ) {
    			return;
    		}
    
    		$user = get_userdata( $user_id );
    		$first_name = $user->first_name;
    		$last_name = $user->last_name;
    
    		if ( ! $first_name && ! $last_name ) {
    			return;
    		}
    
    		$complete_name = "{$first_name} {$last_name}";
    
    		echo wp_kses_post( sprintf( '<span class="wishlist-owner">by %s</span>', $complete_name ) );
    	}
    	add_action( 'yith_wcwl_before_wishlist', 'yith_wcwl_print_author_name', 10, 1 );
    }
    
    Thread Starter strangechild

    (@strangechild)

    Awesome! Worked like a charm!

    Plugin Author YITHEMES

    (@yithemes)

    You’re welcome

    We are doing our best to improve our plugins. Our target is to develop and release the best free plugins for WooCommerce, but to achieve this we need your help. Please leave a good review to support us and help our growth ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wishlist Owner Name Displayed’ is closed to new replies.