• Resolved shenalorlof

    (@shenalorlof)


    I want to show Vendor’s profile picture in the single product page.. if i cant get the function i can show it in the single product page using a short code. need help.
    “add_shortcode( ‘dokan_vendor_avatar’, ‘dokan_store_avatar_shortcode’ );
    function dokan_store_avatar_shortcode() {
    global $product;
    $seller = get_post_field( ‘post_author’, $product->get_id());
    $author = get_user_by( ‘id’, $seller );
    $vendor = dokan()->vendor->get( $seller );

    $store_info = dokan_get_store_info( $author->ID );

    if ( !empty( $store_info[‘store_name’] ) ) { ?>
    <span class=”details”>
    <?php printf( ‘Sold by: %s‘, $vendor->get_avatar() ); ?>
    </span>
    <?php
    }
    }”
    This didn’t work. i want to show the avatar of the specific seller in the single product page

    • This topic was modified 4 years, 2 months ago by shenalorlof.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hello @shenalorlof ,

    I did not test this with a shortcode but you can get the vendor’s profile picture using this trick –

    <img src = "<?php echo esc_url( get_avatar_url( $author->ID ) ); ?>" />

    I used the variable names from your code to avoid confusion.

    The function I used is a default WordPress function – get_avatar_url()

    I hope the information helps.

    Thank you ??

Viewing 1 replies (of 1 total)
  • The topic ‘Show Vendor Avatar/Logo in the single product page’ is closed to new replies.