我创建了一个名为"Blog" 当单击"Blog" 标题中的菜单我想显示来自默认帖子而非自定义帖子类型的帖子如何操作?
如何使用index.php文件创建博客页面,但这不是主页
2 个回复
SO网友:Przemek Maczewski
将静态页面设置为帖子页面怎么样?
Settings -> Reading -> Front Page displays
SO网友:grandcoder
以下代码为您提供默认帖子。(相应地进行更改,但确保post\\U类型为“post”)
<?php $args = array(
\'posts_per_page\' => 5,
\'offset\' => 0,
\'category\' => \'\',
\'category_name\' => \'\',
\'orderby\' => \'post_date\',
\'order\' => \'DESC\',
\'include\' => \'\',
\'exclude\' => \'\',
\'meta_key\' => \'\',
\'meta_value\' => \'\',
\'post_type\' => \'post\',
\'post_mime_type\' => \'\',
\'post_parent\' => \'\',
\'post_status\' => \'publish\',
\'suppress_filters\' => true
);
$posts_array = get_posts( $args ); ?>
要在您的博客页面上获取此信息,请另存为您的页面。php作为博客。php并在博客上使用上述代码(根据主题结构)。php。结束