在首页上的不同区域显示前6个帖子WordPress?

我想在首页中显示”业务”类别的前6个帖子, 如下所示。 [请看图片]

是否可以查询” for”循环中的帖子?


#1


你当然可以这样做。但是, 如果首先将它们存储在某个数组变量中, 然后将其放置到所需的任何复杂网格中, 将会更加容易。

F.e.

<?php
$business=get_posts("cat=222&posts_per_page=6");

//now put it anywhere you want
?>
<div><?php echo $business[0]->post_title; ?> </div>
...
<div><?php echo $business[5]->post_title; ?> </div>

来源:

https://www.srcmini02.com/64996.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37359.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?