wordpress自定义查询,两列内容,如何获得两个分页功能?

时间:2017-08-03 05:09:14

标签: wordpress

有很多页面,但如何获得分页?

两列内容有两个分页。

我需要分页两列内容。

怎么做?

如果你能告诉我如何添加评论的功能,我会更加感谢你。

看看这个:

https://stackoverflow.com/a/45451489/1266305

            $args = array(
                'post_type' => 'post',
                'post_status' => 'publish',
                'posts_per_page' => -1,
                'orderby' => 'ID',
                'order' => 'desc');

            $blank_posts = array();
            $content_post =array();

            $posts = new WP_Query( $args );

            if ( $posts->have_posts() ) : 
                while ( $posts->have_posts() ) : $posts->the_post();
                global $post;
                   $content = get_the_content();
                    if(empty($content)) { 
                        array_push( $blank_posts, $post);
                    }else{
                        array_push( $content_post, $post);
                    }
                endwhile;
            endif;

/* blank content posts */    /* loop */
            if(!empty($blank_posts)){
                foreach ($blank_posts as $pst) {
                    echo "<pre>"; print_r($blank_posts);
                    echo $pst->post_title;
                }
            };
/* have content posts */
            if(!empty($content_post)){
                foreach ($content_post as $pst) {
                    echo '<a href='. $pst->guid .'>' .$pst->post_title. '</a> ';
                }
            }

0 个答案:

没有答案