修改您的wpb_total_posts
功能如下:
function wpb_total_posts() {
$total = wp_count_posts()->publish;
if($total == 1){
echo \'We found\', "<strong>" . $total . "</strong>", \'job\';
}elseif($total > 1){
echo \'We found\', "<strong>" . $total . "</strong>", \'jobs\';
}else{
echo \'No posts found \';
}
}
在这里,我首先检查帖子总量是否为1或更多,并相应地处理单数/复数。最后,如果没有post then渲染;“未找到帖子”;