H
H
HelloWJS2021-06-25 13:02:18
WordPress
HelloWJS, 2021-06-25 13:02:18

How to make a transition through navigations (categories)?

There are custom categories (there are several of them)

<ul class="two__ul">
  <?php 
    $categories = get_categories( [
      'orderby'            => 'include',
  'order'              => 'ASC',
  'style'              => 'list',
  'show_count'         => 0,
  'hide_empty'         => 1,
  'child_of'           => 0,
  'exclude'            => '',
  'include'            => '4,5,6,7,8,9,10',
  'hierarchical'       => true,
  'title_li'           => __( '' ),
  'number'             => NULL,
  'echo'               => 1,
  'depth'              => 0,
  'pad_counts'         => 0,
  'taxonomy'           => 'category',
  'walker'             => 'Walker_Category',
    ] );

    if( $categories ) {
      foreach( $categories as $cat ) {

    ?>
      <li class="tu__li">
        <a  class="nav-link "
          href="<?php echo get_category_link($cat->term_id); ?>"
         >
          <?php echo $cat->name; ?>
        </a>
      </li>
  <?php
      }
    }
  ?>
</ul>

They are my menus, I want to make a transition on the same page by category. In fact, I go to another page (that is, to the page of the selected categories)
site.abc (click on the categories) --> site.abc/?cat=5 (5 here is the ID of the categories), I don’t understand which file (template ) it refers to I WANT to give the categories the same template as the main one.

In general, I found a solution, but I do not think that it is correct. I created a category.php file in the theme and copied my main (main page) template there

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question