Помогите модифицировать код
-
Часть кода который проверяет и выводит , при наличие подрубрики
<ul class="nawi"> <?php $args=array( 'parent' => get_query_var('cat'), ); $news_cats = get_categories($args); foreach ($news_cats as $news_cat): echo '<li><a href="'.get_category_link( $news_cat->term_id ).'" >' . esc_html($news_cat->name).'</a></li>'; endforeach; ?> </ul>
Другая часть кода которая выводит надпись «ничего не найдено» если нет постов.
<article id="post-0" class="post no-results not-found"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Nothing Found', 'tempera' ); ?></h1> </header><!-- .entry-header --> <div class="entry-content"> <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'tempera' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </article><!-- #post-0 -->
Как сделать так чтобы при наличии хотя бы одной подрубрики, 2й кусок кода пропускался?
Просмотр 2 ответов — с 1 по 2 (всего 2)
Просмотр 2 ответов — с 1 по 2 (всего 2)
- Тема «Помогите модифицировать код» закрыта для новых ответов.