dongtun3328 2012-06-18 00:25
浏览 46

WordPress:自定义查询

I have a custom query that uses an array merge so I can list articles and custom post type posts in one list, showing 5 at a time. Pagination below allows the user to see the rest of the results. I keep getting pagination errors, but I've tried virtually every variation of the $paged variable in my query to get pagination to work and it doesn't. I know it's me, and probably a simple syntax thing...but I'm stumped. Any ideas? (Note: this page has multiple, other custom queries above the one in question)

Here's my code:

<?php
$loop1 = array_merge( $wp_query->query, 
                      array( 'post_type' => array('post','podcasts', 'cat' => $cat_ID ), 
                             'paged' => ( get_query_var('page') ? get_query_var('page') : 1 ), 
                             'posts_per_page' => 5 ) ); 
query_posts( $loop1 );
while (have_posts()) : the_post(); ?>
  • 写回答

1条回答 默认 最新

  • dongzheng8463 2012-06-18 16:04
    关注

    have you tried?

    'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), 
    
    评论

报告相同问题?

悬赏问题

  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致