我是wordpress新手,在这里,我正在获取post type=Organization的缩略图,请检查我的$args数组是否有问题,我在这里应用分页,但wp查询不起作用,这是我的代码,请给我一个解决方案。
$paged = ( get_query_var( \'paged\' ) ) ? absint( get_query_var( \'paged\' ) ) : 1;
$args = array(
\'posts_per_page\' => 5,
\'post_type\' => \'organisation\',
\'paged\' => $paged,
\'meta_query\' => array(
array(
\'key\' => \'title\',
\'value\' => \'a\',
\'compare\' => \'LIKE\',
),
),
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
foreach ( $query as $post )
{
setup_postdata ( $post );
?>
<div class="col-md-4 org-logo" style="text-align:center;">
<div class="pr_image">
<?php
if ( has_post_thumbnail($post->ID))
{
$thumbnail = get_the_post_thumbnail($postid, array( 80, 80));
echo \'<a href=\'.get_permalink( $postid ).\' title="\'.get_the_title().\'">\'.$thumbnail.\'</a>\';
}
?>
</div>
<?php
$shortname = get_post_meta($post->ID,\'short_name\',true);
$title = get_the_title();
if(!empty($shortname))
{
echo \'<span>\' .$shortname. \'</span>\';
}
else
{
echo \'<span>\' .$title. \'</span>\';
}
?>
</div>
<?php
}
}
else
{
?>
<div class="alert">Sorry, No organisation found.</div>
<?php
}
?>
<?php
$big = 99999; // need an unlikely integer
echo paginate_links( array(
\'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ) ) ),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, get_query_var(\'paged\') ),
\'total\' => $the_query->max_num_pages
) );
?>