F
F
freeman02042019-03-08 18:53:43
WordPress
freeman0204, 2019-03-08 18:53:43

How to make 2 loops with custom parameters in archive-product.php?

I want to change this template https://github.com/woocommerce/woocommerce/blob/ma...
There is already a cycle here for both posts and categories, as I understand it.

woocommerce_product_loop_start();
  if ( wc_get_loop_prop( 'total' ) ) {
    while ( have_posts() ) {
      the_post();
      /**
       * Hook: woocommerce_shop_loop.
       *
       * @hooked WC_Structured_Data::generate_product_data() - 10
       */
      do_action( 'woocommerce_shop_loop' );
      wc_get_template_part( 'content', 'product' );
    }
  }
  woocommerce_product_loop_end();

The code that I am looping is here. wc_get_template_part( 'content', 'product' );
Everything works fine, I go to the subcategory and display the posts of the subcategory.
I need to do the following, create another same cycle of posts, in the first one limit the posts to 10, and in the second cycle make a shift by 10 posts and also a limit of 10 posts.
I copied this cycle again and tried to modify the standard cycle according to this example. But nothing happened.
<?php
global $query_string; // параметры базового запроса
query_posts( $query_string .'&cat=-6,-9&order=ASC&posts_per_page=20' ); // базовый запрос + свои параметры 

[СТАНДАРТНЫЙ ЦИКЛ WORDPRESS]

wp_reset_query(); // сброс запроса
?>

How it is possible to implement what is described above?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lev Rozanov, 2019-03-08
@freeman0204

Don't use multiple query_posts on the same page!
https://wp-kama.ru/id_767/3-sposoba-postroeniya-ts...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question