【发布时间】:2023-02-24 03:13:29
【问题描述】:
如果没有不可用的帖子,我将面临自定义帖子类型的问题,然后需要显示自定义消息。所以我试过下面的代码但是
<div class="industry_item_grid">
<div class="industry_item_head">
<h3 class="industry_title">Telecom</h3>
<a href="<?php echo site_url('/category/telecom')?>" class="casestudy_viewall">View all</a>
</div>
<div class="industry_item_row">
<?php
$paged = (get_query_var( 'paged' )) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'category_name' => 'Telecom',
'posts_per_page' => 3,
'cat' => 23,
'paged' => $paged,
);
$arr_posts = new WP_Query( $args );
$totalpost = $arr_posts->found_posts;
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
$arr_posts->the_post();
?>
//the_content();
<?php
endwhile;
endif;
?>
</div>
</div>
【问题讨论】: