<?php
/*
*Template name: MAIN
*/
?>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#projects" aria-controls="projects" role="tab" data-toggle="tab">Все проекты</a></li>
<?php
$args = array(
'taxonomy' => 'afisha_kat',
'hide_empty' => true,
);
$terms = get_terms( $args );
foreach ($terms as $term) { ?>
<li role="presentation"><a href="#<?php echo $term->slug;?>" aria-controls="<?php echo $term->slug;?>" role="tab" data-toggle="tab"><?php echo $term->name; ?></a></li>
<?php }?>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="projects">
<?php
$args = array(
'post_type' => 'afisha',
'posts_per_page' => 8,
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) : ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<a href="<?php the_permalink();?>">
<figure class="project-thumb">
<?php the_post_thumbnail()?>
</figure>
<p class="project-descr">
<?php the_title();?>
</p>
</a>
<?php endwhile; ?>
</div>
<?php
endif; wp_reset_postdata(); ?>
</div>
<?php
$args = array(
'taxonomy' => 'afisha_kat',
'hide_empty' => true,
);
$terms = get_terms( $args );
foreach ($terms as $term) { ?>
<div role="tabpanel" class="tab-pane" id="<?php echo $term->slug;?>">
<div class="projects-grid">
<ul class="project-tabs-items">
<?php
$args = array(
'post_type' => 'afisha',
'posts_per_page' => 3,
'tax_query' => array(
array(
'taxonomy' => 'afisha_kat',
'field' => 'slug',
'terms' => $term->slug,
)
)
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) : ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<li>
<a href="<?php the_permalink();?>">
<figure class="project-thumb">
<?php the_post_thumbnail('project-thumb')?>
</figure>
<p class="project-descr">
<?php the_title();?>
</p>
</a>
</li>
<?php endwhile; ?>
<?php
endif; wp_reset_postdata(); ?>
</ul>
</div>
</div>
<?php } ?>
</div>
$terms = get_terms("my_taxonomy");
$count = count($terms);
if($count > 0){
echo "<ul>";
foreach ($terms as $term) {
echo '<li><a href="'.get_term_link($term).'">'.$term->name.'</a></li>';
}
echo "</ul>";
}
Когда открываю файлы сайта через встроенный редактор хостинга - все символы сбиты, везде иероглифы
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
@media only screen and (min-width: 481px) and (max-width: 769px) {
здесь пишите стили которые будут применяться в рамках нужных брейкпоинтов
}