我构建了一个特定的页面,只显示特定子类别中的帖子。我想把每月档案放在右边,但只与那些特定的儿童类别相关。
到目前为止,我有这个,但是它忽略了的child\\u并显示所有内容。
<?php $arc = array(
\'type\' => \'monthly\',
\'limit\' => \'\',
\'format\' => \'html\',
\'before\' => \'\',
\'after\' => \'\',
\'show_post_count\' => false,
\'echo\' => 1,
\'order\' => \'DESC\',
\'child_of\' => 19);?>
<?php wp_get_archives( $arc ); ?>
这是我的代码页。
<div class="container">
<div class="row">
<div class="col-lg-7 col-md-7 col-sm-8">
<h1 class="entry-title-big">Knowledge</h1>
<?php
$catquery = new WP_Query( \'category_name=knowledge\' );
while($catquery->have_posts()) : $catquery->the_post();
?>
<article class="articlePost clearfix">
<?php if ( has_post_thumbnail() && ! post_password_required() && !is_single() ) : ?>
<div class="entry-thumbnail col-lg-5 col-md-5 col-sm-5">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail(\'full\', array(\'class\' => \'img-responsive\')); ?>
</a>
</div>
<?php endif; ?>
<div class="clearfix postDets">
<div class="the-date"><?php the_time(\'F j, Y\'); ?></div>
<div class="the-categories">
<?php
$categories = get_the_category();
$separator = \' \';
$output = \'\';
if($categories){
foreach($categories as $category) {
$output .= \'<a class="feedcat" href="\'.get_category_link( $category->term_id ).\'" title="\' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . \'">\'.$category->cat_name.\'</a>\'.$separator;
}
echo trim($output, $separator);
}
?>
</div>
</div>
<a href="<?php the_permalink() ?>" rel="bookmark" class="entry-title"><?php the_title(); ?></a>
<?php the_excerpt(); ?>
<a class="read-more" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
Read More...
</a>
</article>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
<aside id="serSideBar" class="col-lg-4 col-lg-offset-1 col-md-4 col-md-offset-1 col-sm-4">
<div id="catsWidget">
<h2>Categories</h2>
<ul>
<?php
$args = array(
\'orderby\' => \'name\',
\'order\' => \'ASC\',
\'child_of\' => 19
);
$categories = get_categories($args);
foreach($categories as $category) {
echo \'<li class="cat-item"><a href="\' . get_category_link( $category->term_id ) . \'" title="\' . sprintf( __( "View all posts in %s" ), $category->name ) . \'" \' . \'>\' . $category->name.\'</a>\';
echo \'(\'. $category->count . \')</li>\'; }
?>
</ul>
</div>
<div id="arcWidget">
<?php $arc = array(
\'type\' => \'monthly\',
\'limit\' => \'\',
\'format\' => \'html\',
\'before\' => \'\',
\'after\' => \'\',
\'show_post_count\' => false,
\'echo\' => 1,
\'order\' => \'DESC\',
\'child_of\' => 19
); ?>
<?php wp_get_archives( $arc ); ?>
</div>
</aside>
</div>