Answer the question
In order to leave comments, you need to log in
What's with the archive-product.php file in woocommerce?
Copied the archive-product.php file to the theme/woo commerce/ folder in the theme. theme/wocommerce/archive-product.php
I needed to display a block with a message when displaying products of a certain category.
As I understand it, this file is responsible for displaying products when viewing a category.
Added code.
But there were no changes.
Deleted the file and folder in the theme folder. Went directly to the plugin folder. Pasted there. Also zero response.
What's wrong?
Answer the question
In order to leave comments, you need to log in
Most likely you have a self-written theme (instead of archive-product.php it pulls the page.php file), in order for archive-product.php to work, you need to insert the code in functions.php to declare support in the theme:
<?php
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
} ?>
<?php
/**
* Шаблон обычной страницы (page.php)
* @package WordPress
*/
get_header(); // подключаем header.php ?>
<section>
<div class="container">
<div class="row">
<?php get_sidebar(); // подключаем sidebar.php ?>
<div class="<?php content_class_by_sidebar(); // функция подставит класс в зависимости от того есть ли сайдбар, лежит в functions.php ?>">
<?php woocommerce_breadcrumb(); ?>
<?php woocommerce_content(); ?>
</div>
</div>
</div>
</section>
<?php get_footer(); // подключаем footer.php ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question