duanpan7011 2019-02-04 16:45
浏览 39

如何使用我的类别过滤器向我的category.php添加更多帖子

I have created a filter category with ajax in category.php and I want to limit the posts to 10 and add a button to show more posts in every category inside the loop.

I used the post_per_page but my category filter is not working and shows all the posts randomly not categorize

<ul class="categories-filters">
    <?php if (is_category()) { $cat=g et_query_var( 'cat'); $this_category=g et_category($cat); $this_category=w p_list_categories( 'hide_empty=0&hierarchical=false&order=ASC&orderby=title&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID."&echo=0"); if($this_category !='
    <li>No categories</li>') { echo '
    <ul class="ul-menu">'.$this_category.'</ul>'; } } ?></ul>?></ul>
<?php if(have_posts() ) { ?>
<div id="main-content">
    <div id="inside">
        <?php $i=0 ; ?>
        <?php while (have_posts()) : the_post(); // modified to work with 3 columns // output an open <div>if($i % 3 == 0) { ?>
        <div class="row ng-row">
            <?php } ?>
            <div class="col-md-4 col-sm-12 col-xs-12 half">
                <a href="<?php the_permalink();?>">
                    <div class="img-holder">
                        <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } else { echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/assets/img/thumbnail-default-rev.jpg" />'; } ?>
                        <h2 class="project-title"><?php the_title() ?></h2>
                        <small>see more ></small>
                    </div>
                </a>
            </div>
            <?php $i++; if($i !=0 && $i % 3==0 ) { ?>
        </div>
        <!--/.row-->
        <div class="clearfix"></div>
        <?php } ?>
        <?php endwhile; } wp_reset_query(); ?>

Is there any way to add some arguments like post_per_page without breaking my ajax category filter and add a button which is show more posts respective to my categories?

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?