$('.product-tab-gallery').each(function() {
var items = [];
var $gallery = $(this);
// Get links
$gallery.find('a.imageitem').each(function() {
items.push($(this).attr('href'));
});
var uniqueItems = [];
// Remove duplicates
$.each(items, function(i, el) {
if($.inArray(el, uniqueItems) === -1) {
uniqueItems.push(el);
}
});
items = [];
// Put in Magnific format
$.each(uniqueItems, function(i, el) {
items.push({
src: el,
type: 'image'
});
});
// Assign an index to each link so the clicked one is shown first
$gallery.find('a.imageitem').each(function() {
var $a = $(this);
$.each(items, function(i, el) {
if (el.src == $a.attr('href')) {
$a.data('index', i);
return;
}
});
});
$gallery.on('click', 'a.imageitem', function(e) {
e.preventDefault();
var $a = $(this);
$.magnificPopup.open({
type: 'image',
items: items,
gallery: {
enabled: true
}
});
$.magnificPopup.instance.goTo($a.data('index'));
});
});
<?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>
<?php if($other_photo == 4) : ?>
разметка
<?php elseif($other_photo == 3) : ?>
другая разметка
<?php elseif($other_photo == 2) : ?>
третья разметка
<?php else : ?>
минимальная разметка
<?php endif; ?>
/* Template name: About page */