Skip to content

Instantly share code, notes, and snippets.

@fervous
Last active February 16, 2017 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fervous/a7e6bddc1f7d89b3395d3e09f11031fe to your computer and use it in GitHub Desktop.
Save fervous/a7e6bddc1f7d89b3395d3e09f11031fe to your computer and use it in GitHub Desktop.
buddypress view profile link for store page and product page WC Vendors Pro
/* WC Vendors Pro - Adds a View Profile link on the vendors store header */
add_action('wcv_after_main_header', 'custom_wcv_after_vendor_store_title');
function custom_wcv_after_vendor_store_title() {
if ( is_shop() ) {
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
$wcv_profile_id = WCV_Vendors::get_vendor_id( $vendor_shop );
$profile_url = bp_core_get_user_domain ( $wcv_profile_id );
echo '<center><a href="'. $profile_url .'profile/" class="button">View Profile</a></center>';
}
}
/* WC Vendors Pro - Adds a link to Profile on Single Product Pages */
add_action('woocommerce_product_meta_start', 'custom_woocommerce_product_meta_start');
function custom_woocommerce_product_meta_start() {
$wcv_profile_id = get_the_author_meta('ID');
$profile_url = bp_core_get_user_domain ( $wcv_profile_id );
echo '<a href="'. $profile_url .'">Visit My Profile</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment