Created
February 15, 2018 16:01
-
-
Save amanhstu/8928f8df08ea4f7da5d2c485c6f3dc4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//woocommerce | |
/* | |
Show Seller name or store name in the top of Product title from Dokan Plugin | |
For WooCommerce | |
*/ | |
add_action( 'woocommerce_before_single_product','sold_by' ); | |
function sold_by(){ | |
?> | |
</a> | |
<div class="product-vendor-name-wrap"> | |
<?php | |
global $product; | |
$seller = get_post_field( 'post_author', $product->get_id()); | |
$author = get_user_by( 'id', $seller ); | |
$store_info = dokan_get_store_info( $author->ID ); | |
if ( !empty( $store_info['store_name'] ) ) { ?> | |
<span class="details"> | |
<h1 class="product-vendor-name"> | |
<?php printf( '<a href="%s">%s</a>', dokan_get_store_url( $author->ID ), $store_info['store_name'] ); ?> | |
</h1> | |
</span> | |
</div><!-- product vendor name wrap ends here --> | |
<?php | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment