Wordpress类别页面分页?

时间:2015-06-03 06:58:09

标签: php jquery wordpress pagination

我只是在类别页面上遇到了一些不同的问题。我不想在类别页面上显示帖子。我在类别页面上显示其父类别的子类别,因此当用户单击父类别时,它将显示该父级有多少孩子将在具有缩略图的类别页面上显示的子项。但现在我只是遇到了一个问题,我只想显示16个子类别,然后我想对下一个孩子使用pagination。所以任何人都请帮忙。 这是我现在正在使用的代码。

<?php
$thiscat =  get_query_var('cat'); // The id of the current category
$catobject = get_category($thiscat,false); // Get the Category object by the id of current category
$parentcat = $catobject->term_id; // the id of the parent category
$child = get_category_children( $thiscat, $before = '', $after = ',',  $visited = array() );
$num_cats  = wp_count_terms('category');
$num_parent_cats=count(get_categories('parent=0&hide_empty=0'));
$num_child_cats = $num_cats-$num_parent_cats;
if($child > $parentcat){
?>


    <div class="categories">

        <?php foreach (get_categories() as $cat) : ?>
        <?php if($cat->parent == $thiscat){ ?>
        <div class="main-subcat" style="display:inline-block">  
            <div class="thumb category-thumb" style="width:180px; display:inline-block;">
                <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />    
                <a class ="clip-link" href="<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->cat_name; ?></a>
            </div>
            <div class="data">
                <h2 class="entry-title">
                    <a class ="clip-link" href="<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->cat_name; ?></a>
                </h2>
                <h4 class="entry-meta">
                    <?php echo $cat->category_description; ?>
                </h4>
            </div>
        </div>  
        <?php } ?>
        <?php endforeach; ?>    
    </div>

<?php   
}

0 个答案:

没有答案