wordpress通过指定ID调用连续的文章内容-WordPress主题

摘要:在使用wordpress建站中,如果我们需要在固定的某一个列表或是模块中调用固定文章,我可以通过wordpress自带的…

在使用wordpress建站中,如果我们需要在固定的某一个列表或是模块中调用固定文章,我可以通过wordpress自带的文章ID进行文章内容的调用,需要注意的是showposts为文章数据P为文章ID调用,且只能调用单一文章内容无法连续;

那如何使用指定的文章ID连续调用文章内容呢,下面给大家举例说明一下。比如,调用指定文章ID为2,4,6的文章,可以通过以下代码实现我的内容调用:

同时如果我们想排除指定ID的文章,可以将 post__in 改成 post__not_in 。另外如果只想显示置顶文章,那么可以将array(2,4,6)改成get_option(‘sticky_posts’),这段代码会自动给你填充所有置顶文章的ID。

来源:http://www.wazhuti.com/1952.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_12973.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?