제가워드 프레스 카테고리 필터는 서브 카테고리를 필터링하지 않는
- 부모 등 다수의 서브 카테고리가
- 아이 1
- 하위 2
- 하위 3
- 하위 4
목록 (링크) 모든 하위 범주의 각 카테고리에 포함 된 사용자 정의 포스트의 수량 : 내가 도달하기 위해 노력하고 무엇
내 사용자 정의 카테고리의 템플릿입니다.
<div class="category">
<h3>Category:</h3>
<?php
$args = array(
'post_type' => 'books',
'orderby' => '_swauteur',
'order' => 'ASC',
'parent' => '513'
);
$categories = get_categories($args);
foreach($categories as $category) {
echo '<div class="cat"><h2><a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("have a look at %s"), $category->name) . '" ' . '>'
. $category->name.'</a></h2><br /><p>Books: '. $category->count.' </p></div> ';
}
?>
</div>
이것은 매력으로 작동합니다. 게시물이 포함 된 모든 카테고리를 얻습니다! 4 하위 범주
<div class="box">
<div class="post-alt blog">
<ul class="article-list article-list--related">
<?php $books = new WP_Query($args); while ($books->have_posts()) : $books->the_post();?>
<li class="article-list_item tile post-tile">
<article class="article-list_article">
<section class="article">
<div class="article_thumb"><?php if (has_post_thumbnail()) { the_post_thumbnail('thumbnail');} else { echo '<img src="' . get_bloginfo('stylesheet_directory') . '/images/placeholder.png" />';}?></div>
<div class="article_title"><h1><?php the_title(); ?></h1>
<p>Auteur: <?php echo get_post_meta($id, "_swauteur", true); ?></p>
<p class="article_pub-date">Publicatie datum:<?php echo date('d-m-Y', strtotime(get_post_meta($id, "_pubdatum",true)));?></p>
</div>
<div class="article_excerpt">
<p class="article_excerpt_content"><?php the_excerpt(); ?></p>
<p><a title="<?php _e('Read More'); ?>" href="<?php the_permalink() ?>" rel="bookmark">Lees meer</a></p>
</div>
</section>
</article>
</li>
</ul>
<?php endwhile; ?>
</div><!--/post-alt blog-->
<div class="navigation">
<div class="alignleft"><?php next_posts_link(__('« Previous Entries')) ?> </div>
<div class="alignright"><?php previous_posts_link(__('Next Entries »')) ?></div>
</div>
</div> <!--closebox-->
</div><!--/col1-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
이것은 또한 노력의 루프에서 다음
모든 게시물, 나는 모든 범주의 모든 게시물을 얻을!내가 아이 하나의 카테고리 링크를 클릭 할 때, 어떤 선택이 이루어지지 않기 때문에, 나는 아직도 모든 게시물을 얻을 둘의 조합을 만드는 방법을 알아낼 수 없습니다 : 여기
그러나
내 질문입니다 다른 하위 카테고리.
(루프를 생성하기 전에 어떤 하위 카테고리가 올바른 $ args를 설정했는지 확인하기 위해 전역 $ 쿼리를 확인하는 category.php 템플릿을 만듭니다.) 나에게도 가장 좋은 방법이지만, 나는 이것을 할 수있는 방법이 없다. 어떤 도움이 가능 할까? – Jeroen
하이 Nus, 명확한 설명을위한 thnx 그리고 이것은 참으로 일하고있다 ..... 감사합니다 – Jeroen