<?php
/**
* Move WooCommerce subcategory list items into
* their own <ul> separate from the product <ul>.
*/
add_action( 'init', 'move_subcat_lis' );
function move_subcat_lis() {
// Remove the subcat <li>s from the old location.
remove_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' );
add_action( 'woocommerce_before_shop_loop', 'msc_product_loop_start', 40 );
add_action( 'woocommerce_before_shop_loop', 'msc_maybe_show_product_subcategories', 50 );
add_action( 'woocommerce_before_shop_loop', 'msc_product_loop_end', 60 );
}
/**
* Conditonally start the product loop with a <ul> contaner if subcats exist.
*/
function msc_product_loop_start() {
$subcategories = woocommerce_maybe_show_product_subcategories();
if ( $subcategories ) {
woocommerce_product_loop_start();
}
}
/**
* Print the subcat <li>s in our new location.
*/
function msc_maybe_show_product_subcategories() {
echo woocommerce_maybe_show_product_subcategories();
}
/**
* Conditonally end the product loop with a </ul> if subcats exist.
*/
function msc_product_loop_end() {
$subcategories = woocommerce_maybe_show_product_subcategories();
if ( $subcategories ) {
woocommerce_product_loop_end();
}
}
<div class="row-short-post">
<?php
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
$args = array(
'posts_per_page' => 2,
'post_type' => 'feedback',
'paged' => $paged,
);
$wp_query = new WP_Query($args);
?>
<?php if ( $wp_query->have_posts() ) : ?>
<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
<div class="col-short-post">
<div class="short-post-video">
<?php the_post_thumbnail(); ?>
<div class="short-post-overlay">
<img src="<?php the_field('logo_company_feedback'); ?>" alt="">
</div>
</div>
<a class="short-post-author" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<span class="short-post-author-position"><?php the_field('position_company_feedback'); ?></span>
<div class="short-post-author-text">
<?php echo excerpt(25); ?>
</div>
<a class="short-post-author-more" href="<?php the_permalink(); ?>">
<span>Читать отзыв</span>
<img src="img/covid/arrow_light.svg" alt="">
</a>
</div>
<?php endwhile;?>
<?php endif; wp_reset_query(); ?>
</div>
<div class="paginations">
<?php
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $the_query->max_num_pages,
'prev_text' => '«',
'next_text' => '»',
) );
?>
</div>
/* Template name: About page */