S
S
Sergey Burduzha2019-08-26 13:20:02
WooCommerce
Sergey Burduzha, 2019-08-26 13:20:02

Why is page.php used to display categories instead of taxonomy-product_cat.php?

Good afternoon.
On my site, page.php is used instead of the taxonomy-product_cat.php template.
I can't understand why?
Here is the content of page.php.

<?php
  /**
   * The template for displaying all pages
   *
   * This is the template that displays all pages by default.
   * Please note that this is the WordPress construct of pages
   * and that other 'pages' on your WordPress site may use a
   * different template.
   *
   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
   *
   * @package benefis
   */
  
  get_header();
?>
    <script>
    jQuery(document).ready(function () {
      $('.woocommerce').removeClass();
    });
    </script>
    <div class="slider">
        <div class="slider_video_parent">
            <span></span>
            <video src="http://benefis.myihor.ru//images/video/10000000_690038651457564_3112166903667890767_n.mp4" class="videoslider" autoplay="" loop="" muted="" width="1280" height="720"></video>
        </div>
    </div>
    <div class="container">
        <div class="row">
      <?php get_sidebar(); ?>
      
      <?php while (have_posts()) :
          the_post();
          
          get_template_part('template-parts/content', 'page');
        
        endwhile; // End of the loop.
      ?>
        </div>
    </div>
<?php get_footer();

I moved the templates folder from the plugin folder to my theme.
Renamed to woocommerce.
Even query-monitor tells you which templates to use
5d63b25099e31593380037.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Burduzha, 2019-08-27
@serii81

Found the answer.
The fact is that I did not start developing this site from scratch. Before me, a miracle developer installed woocommerce and set it up, but somehow in its own way.
After reading this article https://delaemsait.info/integriruem-woocommerce-s-...
I learned that you need to include woocommerce in functions.php.

add_action('after_setup_theme', 'woocommerce_support');
  function woocommerce_support()
  {
    add_theme_support('woocommerce');
  }

It is clear that when you start developing a theme from scratch, use a template from underscores.me, do not forget to check the woocommerce checkbox when initializing the theme on this resource, then this code is inserted automatically into the functions.php file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question