You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
cosmopet.ae/wp-content copy/themes/woodmart/gp-archive-subscribe.php

109 lines
2.6 KiB

<?php
/*
Template Name: GP | Subscribe Product
Template Post Type: page
*/
defined( 'ABSPATH' ) || exit;
if( isset($_GET['ajax_load']) ) {
while ( have_posts() ) {
the_post();
wc_get_template_part( 'content', 'product' );
}
die();
}
$loc = pll_current_language();
if ($loc == 'en'){
get_header('gp_eng');
}
else{
get_header('gp');
}
?>
<main class="wrapper">
<div class="breadcrumbs">
<a href="<?php echo home_url() ?>" class="breadcrumbs__item">
<?php echo esc_html__( 'main', 'woodmart' ) ?>
</a>
<a href="<?php echo get_permalink( wc_get_page_id( 'shop' ) ) ?>" class="breadcrumbs__item">
<?php echo esc_html__( 'products', 'woodmart' ) ?>
</a>
</div>
<div class="product ">
<div class="product__header">
<p class="product__title"><?php woocommerce_page_title(); ?></p>
</div>
<div class="product__main">
<?php
$query = new WP_Query(
array(
'post_type' => array('product', 'product_variation'),
'posts_per_page' => 12
)
);
if ($query->have_posts()) {
while ($query->have_posts() ) {
$query->the_post();
$product = wc_get_product(get_the_ID());
$product_type = $product->get_type();
if(in_array($product_type, array('subscription', /*'subscription_variation',*/'variable-subscription'))) {
wc_get_template_part( 'content', 'product-subscribe' );
}
}
} else {
/**
* Hook: woocommerce_no_products_found.
*
* @hooked wc_no_products_found - 10
*/
do_action( 'woocommerce_no_products_found' );
}
?>
</div>
<?php
global $wp_query;
// текущая страница
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$max_pages = $wp_query->max_num_pages;
?>
<div class="product__footer product__footer--error">
<? if( $paged < $max_pages ) {
?>
<button class="button button--white btn-load-ajax" data-page="<?php echo $paged ?>" data-maxpage="<?php echo $max_pages ?>">
<?php echo esc_html__( 'load more', 'woodmart' ) ?>
</button>
<?php
}
?>
<a href="<?php echo get_permalink( wc_get_page_id( 'shop' ) ) ?>" class="product__error-button" style="display:none;">
<?php echo esc_html__( 'reset search query', 'woodmart' ) ?>
</a>
</div>
</div>
</main>
<?php
do_action( 'woocommerce_sidebar' );
if ($loc == 'en'){
get_footer('gp_eng');
}
else{
get_footer('gp');
}
wp_footer();