Last active
May 4, 2021 21:50
-
-
Save racmanuel/17eeb18b06f81494f383cd6eb0690fd9 to your computer and use it in GitHub Desktop.
Show different archive-product.php if is a WC Vendor or is a Normal User
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
<?php | |
/** | |
* Show different archive-product.php if is a WC Vendor or is a Normal User | |
* Put this file in you folder theme or child theme in woocommerce folder | |
* | |
* The Template for displaying product archives, including the main shop page which is a post type archive | |
* | |
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php. | |
* | |
* HOWEVER, on occasion WooCommerce will need to update template files and you | |
* (the theme developer) will need to copy the new files to your theme to | |
* maintain compatibility. We try to do this as little as possible, but it does | |
* happen. When this occurs the version of the template file will be bumped and | |
* the readme will list any important changes. | |
* | |
* @see https://docs.woocommerce.com/document/template-structure/ | |
* @package WooCommerce/Templates | |
* @version 3.4.0 | |
* @author racmanuel | |
*/ | |
defined('ABSPATH') || exit; | |
/* | |
* Check if is a Product of Marketplace | |
* if is true show the template with horizontal view of products | |
* if is false show the template with vertical view of products | |
*/ | |
$vendor_shop = urldecode(get_query_var('vendor_shop')); | |
$vendor_id = WCV_Vendors::get_vendor_id($vendor_shop); | |
if ($vendor_id) { | |
include get_theme_file_path( '/woocommerce/archive-product-vendors.php'); | |
} else { | |
include get_theme_file_path( '/woocommerce/archive-product-store.php'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment