Last active
August 25, 2016 03:18
-
-
Save fervous/a8b4a77d3ba1692fbe3de7bf4d4121d7 to your computer and use it in GitHub Desktop.
vendor icon and links for meta products page
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
/*for theme's functions.php*/ | |
/* Remove sold by on single product pages */ | |
remove_action( 'woocommerce_product_meta_start', array( 'WCV_Vendor_Cart', 'sold_by_meta' ), 10, 2 ); | |
/* shop icon & shop link in product meta*/ | |
add_action('woocommerce_product_meta_start', 'custom_woocommerce_product_meta_start_icon'); | |
function custom_woocommerce_product_meta_start_icon() { | |
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) ); | |
$vendor_id = get_the_author_meta('ID'); | |
$store_url = WCVendors_Pro_Vendor_Controller::get_vendor_store_url( $vendor_id ); | |
$shop_name = get_user_meta( $vendor_id, 'pv_shop_name', true ); | |
$sold_by = '<a href="'.$store_url.'">'.$shop_name.'</a>'; | |
$store_icon_src = wp_get_attachment_image_src( get_user_meta( $vendor_id, '_wcv_store_icon_id', true ), array( 35, 35) ); | |
$store_icon = ''; | |
if ( is_array( $store_icon_src ) ) { | |
$store_icon = '<img src="'. $store_icon_src[0].'" alt="" class="store-icon" />'; | |
} | |
echo '<div id="shop-icon-meta"><span style="font-size:.90em;text-transform:uppercase;color:#aaa;">Sold By: '.$sold_by.'</span><br><span style="font-size:16px;font-weight:700;"><a href="'.$store_url.'">' . $store_icon . ' '. $sold_by.'</a></span></div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment