Created
October 28, 2014 16:39
-
-
Save bentasm1/56a56f8996b289c076f8 to your computer and use it in GitHub Desktop.
Customizing the Vendor Header
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
Copy archive-product.php from WooCommerce into /wp-content/YOURTHEME/woocommerce/archive-product.php | |
Around line 23 or so, ***ABOVE*** the line that says: | |
<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?> | |
....enter your custom code. | |
Let's include a sample that checks if the page being loaded is for a vendor, and then do some stuff. Customize as you need for your own purposes. The sample below was written for a BuddyPress site that has private messages and profiles. The [button] shortcode is instead of just displaying text. Again, modify to your own desires :) | |
<?php | |
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) ); | |
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); | |
if ( $vendor_id ) { | |
?> | |
<center> | |
<?php | |
$vendor_name_message = get_userdata($vendor_id); | |
$current_user = wp_get_current_user(); | |
if ( is_user_logged_in() ) { | |
echo do_shortcode( '[button link="/members/'.$current_user->user_login.'/messages/compose/?r='.$vendor_name_message->user_login.'"]SEND ME A PRIVATE MESSAGE[/button]' ); | |
} else { | |
echo do_shortcode( '[button link="/my-account/"]LOGIN TO SEND ME A PRIVATE MESSAGE[/button]' ); | |
}; | |
echo do_shortcode( '[button link="/members/'.$vendor_name_message->user_login.'"]VIEW MY PROFILE[/button]' ); | |
?> | |
</center> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment