Display author meta on WooCommerce vendor product page

I am using the WooCommerce product Vendor plugin on my WP site. Each vendor got their own vendor profile. I want to display author meta such as LinkedIn, facebook wikipedia etc. on the frontend of the vendor’s product.

After doing some research I found some guy who have done something similar

In the blogpost above, he is using a custom image upload field. I am using the standard meta fields with wikipedia, facebok etc. that already exist in the WordPress user profile page.

I tried to modify the code provided in the blogpost above to fit my needs, but it doesn’t seem to work. Nothing is being shown in the frontend of my site.

// Show links from vendor profile product page
add_action( ‘product_vendors_tab_content_before’, ‘our_vendor_info’ );
function our_vendor_info() {

if( is_tax( ‘shop_vendor’ ) ) {
// Get vendor ID
$vendor_id = get_queried_object()->term_id;

// Get vendor info
$vendor = get_vendor( $vendor_id );
$user_title = $vendor->title;
// Now get user id from title
$user = get_userdatabylogin($user_title);

// Get social profiles
$wikipedia = get_the_author_meta( ‘wikipedia’, $user->ID );

echo ‘<div class=”large-3 columns venprofilelink”>’;
if (get_the_author_meta( ‘wikipedia’, $user->ID )) {
echo ‘<span class=”some-talent”><a href=”‘. $wikipedia .'” target=”blank” rel=”noopener noreferrer”><img src=”http://example.local/wp-content/uploads/2019/09/wikipedia-logo.svg” /></a></span>’;
} else {
echo ‘Hello World!’;
}
}
echo ‘</div>’;
}

Read more here:: Display author meta on WooCommerce vendor product page

Leave a Reply

Your email address will not be published. Required fields are marked *