Функция all_the_tags
-
Здравствуйте, у меня есть такая задача существует шаблон страницы в котором я хочу выводить анонсы постов разных категорий. посты нужной мне категории я хочу выводить проверив метку у соотв. поста
$all_the_tags = get_the_tags(); global $category; if( $all_the_tags ){ foreach($all_the_tags as $this_tag) { if ($this_tag->name == "single" ) { $category=4; } else if ($this_tag->name == "twin" ) { $category=5; } else if ($this_tag->name == "quarter" ) { $category=7; } else { echo '<p>метки не найдены</p>'; } } } $my_posts = get_posts('category= $category'); foreach ($my_posts as $post) : setup_postdata($post); ?> <div class="col-md-11 col-sm-17 clearfix content-pattern anonce"> <h2 class="my-content-header"><? the_title();?></h2> <div class="article_content clearfix"> <?php the_post_thumbnail('post-thumbnail','class=responsive');?> </div> <div class="cost clearfix"> <strong><?the_excerpt();?></strong> <a class="read-more pull-right" href="<?php the_permalink();?>">Посмотреть</a> </div> </div> <?php endforeach; ?>
Просмотр 5 ответов — с 1 по 5 (всего 5)
Просмотр 5 ответов — с 1 по 5 (всего 5)
- Тема «Функция all_the_tags» закрыта для новых ответов.