C
C
CapitanFreeloader2016-11-12 20:57:39
WordPress
CapitanFreeloader, 2016-11-12 20:57:39

How to make your own template for displaying products in a category?

In general, Google provides links to the page of the product itself. But I need to change the output cycle of products in the category. Now they are displayed as a list and with missing information. It is necessary to somehow make a block output (not my whims) with the output of this information. That is, in fact, I am looking for a file in which the template for displaying a product card in a cycle is registered. All that was found was only the beginning and end of the cycle (I tried to search for files, I did not find anything). Can you write your own function somehow? For some reason there isn't much info on the internet about this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikitos08, 2016-11-15
@Nikitos08

Woocommerce has this file: taxonomy-product_cat.php in it you can generate the output as you need.
Here is an example of my code. Should be helpful.

if ( ! defined( 'ABSPATH' ) ) {
  exit; // Exit if accessed directly
}

global $wp_query;

$cate = get_queried_object();
$cateID = $cate->term_id;

if ( $cateID == "21") {
  woocommerce_get_template( 'content-benzin.php' );
}

elseif ( $cateID == "22") {
  woocommerce_get_template( 'content-disel.php' );
}

elseif ( $cateID == "318") {
  woocommerce_get_template('content-generators.php');
}

elseif ( $cateID == "319") {
  woocommerce_get_template('content-kompressors.php');
}

elseif ( $cateID == "156") {
  woocommerce_get_template('content-motopompy.php');
}

elseif ( $cateID == "467") {
  woocommerce_get_template('content-production.php');
}

else {
  wc_get_template( 'archive-product.php' );
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question