Example #1
0
/**
 * Get other templates (e.g. product attributes) passing attributes and including the file.
 *
 * @access public
 * @param mixed $template_name
 * @param array $args (default: array())
 * @param string $template_path (default: '')
 * @param string $default_path (default: '')
 * @return void
 */
function dokan_get_template($template_name, $args = array(), $template_path = '', $default_path = '')
{
    if ($args && is_array($args)) {
        extract($args);
    }
    $located = dokan_locate_template($template_name, $template_path, $default_path);
    if (!file_exists($located)) {
        _doing_it_wrong(__FUNCTION__, sprintf('<code>%s</code> does not exist.', $located), '2.1');
        return;
    }
    do_action('dokan_before_template_part', $template_name, $template_path, $located, $args);
    include $located;
    do_action('dokan_after_template_part', $template_name, $template_path, $located, $args);
}
Example #2
0
 /**
  * Include store template
  *
  * @param type    $template
  * @return string
  */
 function store_template($template)
 {
     $store_name = get_query_var('store');
     if (!$this->is_woo_installed()) {
         return $template;
     }
     if (!empty($store_name)) {
         $store_user = get_user_by('slug', $store_name);
         // no user found
         if (!$store_user) {
             return get_404_template();
         }
         // check if the user is seller
         if (!dokan_is_user_seller($store_user->ID)) {
             return get_404_template();
         }
         return dokan_locate_template('store.php');
     }
     return $template;
 }
Example #3
0
 /**
  * Account migration template on my account
  *
  * @param string  $file path of the template
  * @return string
  */
 function account_migration_template($file)
 {
     if (get_query_var('account-migration') && dokan_is_user_customer(get_current_user_id())) {
         return dokan_locate_template('update-account.php');
     }
     return $file;
 }
Example #4
0
 /**
  * Returns the edit product template
  *
  * @param string  $template
  *
  * @return string
  */
 function product_edit_template($template)
 {
     if (!$this->is_woo_installed()) {
         return $template;
     }
     if (get_query_var('edit') && is_singular('product')) {
         if (dokan_get_option('product_style', 'dokan_selling', 'old') == 'old' && WeDevs_Dokan::init()->is_pro()) {
             $edit_product_url = dokan_locate_template('products/product-edit.php', '', '', true);
         } elseif (dokan_get_option('product_style', 'dokan_selling', 'old') == 'new' && WeDevs_Dokan::init()->is_pro()) {
             $edit_product_url = dokan_locate_template('products/new-product-single.php');
         } else {
             $edit_product_url = dokan_locate_template('products/new-product-single.php');
         }
         return $edit_product_url;
     }
     return $template;
 }
 /**
  * Account migration template on my account
  *
  * @param string  $file path of the template
  *
  * @return string
  */
 function account_migration_template($file)
 {
     if (get_query_var('account-migration') && dokan_is_user_customer(get_current_user_id()) && basename($file) == 'my-account.php') {
         $file = dokan_locate_template('global/update-account.php', '', '', true);
     }
     return $file;
 }
Example #6
0
 /**
  * Returns the store review template
  *
  * @since 2.4.3
  *
  * @param string  $template
  *
  * @return string
  */
 public function store_review_template($template)
 {
     if (!function_exists('WC')) {
         return $template;
     }
     if (get_query_var('store_review')) {
         return dokan_locate_template('store-reviews.php', '', '', true);
     }
     return $template;
 }