<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
</header><!-- .page-header -->
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_format() );
// End the loop.
endwhile;
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'twentysixteen' ),
'next_text' => __( 'Next page', 'twentysixteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>',
) );
// If no content, include the "No posts found" template.
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<div class="posts__item-title">
<a href="<?php the_permalink() ?>"><?php the_title() ?></a>
</div>
<div class="posts__item-content">
<?php if ($excerpt_or_content == 1) {
global $more;
$more = 0;
echo wp_trim_words(get_the_excerpt(), 20, '...');
}
else {
if ( get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true) ) {
echo wp_trim_words(get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true), 20, '...');
}
else {
echo wp_trim_words(get_the_excerpt(), 20, '...');
}
}
?>
</div>
<div class="posts__item posts__item_second">
<div class="posts__item-img">
<?php
$w = 320; $h = 200;
if ( kama_thumb_src() ) {
echo '<img src="'.kama_thumb_src('w='.$w.'&h='.$h).'" width="'.$w.'" height="'.$h.'" alt="'.get_the_title().'" />';
} else {
echo '<img src="'.get_stylesheet_directory_uri().'/images/no-photo.jpg" width="'.$w.'" height="'.$h.'" alt="Изображение для публикации не задано">';
} ?>
<div class="post-info post-info_loop">
<?php if ($show_comments_number) { ?>
<div class="post-info__comment"><?php echo get_comments_number(); ?></div>
<?php } ?>
<?php if ($show_date) { ?>
<time class="post-info__time" datetime="<?php the_time('Y-m-d') ?>"><?php the_time('d.m.Y') ?></time>
<?php } ?>
</div>
</div>
<div class="posts__item-title">
<a href="<?php the_permalink() ?>"><?php the_title() ?></a>
</div>
<div class="posts__item-content">
<?php if ($excerpt_or_content == 1) {
global $more;
$more = 0;
echo wp_trim_words(get_the_excerpt(), 20, '...');
}
else {
if ( get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true) ) {
echo wp_trim_words(get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true), 20, '...');
}
else {
echo wp_trim_words(get_the_excerpt(), 20, '...');
}
} ?>
</div>
</div>
<?php
// check if the flexible content field has rows of data
if( have_rows('content1') ):
// loop through the rows of data
while ( have_rows('content1') ) : the_row();
if( get_row_layout() == 'quote' ):
the_sub_field('quote');
the_sub_field('name');
endif;
endwhile;
endif;
?>
<?php
// check if the flexible content field has rows of data
if( have_rows('content1') ):
// loop through the rows of data
while ( have_rows('content1') ) : the_row();
if( get_row_layout() == 'gallery' ):
the_sub_field('title');
endif;
endwhile;
endif;
?>
<?php
// check if the flexible content field has rows of data
if ( have_rows( 'content1' ) ) :
// loop through the rows of flexible content field data
while ( have_rows( 'content1' ) ) : the_row();
// check current row layout for gallery
if ( get_row_layout() == 'gallery' ) :
// get all images in gallery
// note the get_SUB_field function - it's a SUB field of flexible content
$images = get_sub_field( 'gallery' );
// if there are some images, build output
if ( $images ) : ?>
<ul class="hr">
<?php
// Loop through all images and output them
foreach( $images as $image ): ?>
<li>
<a href="<?php echo $image['url']; ?>">
<img src="<?php echo $image['sizes']['thumbnail']; ?>"alt="<?php echo $image['alt']; ?>"/></a>
<p><?php echo $image['caption']; ?></p>
</li>
<?php endforeach; // end images loop ?>
</ul>
<?php endif; // end images output
endif; // end gallery layout
endwhile; // end flexible content field loop
else :
// no layouts found
endif; ?>
<?php
// check if the flexible content field has rows of data
if( have_rows('content1') ):
// loop through the rows of data
while ( have_rows('content1') ) : the_row();
if( get_row_layout() == 'gallery' ):
the_sub_field('description');
endif;
endwhile;
endif;
?>