Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Wordpress博客中显示静态信息_Wordpress - Fatal编程技术网

在Wordpress博客中显示静态信息

在Wordpress博客中显示静态信息,wordpress,Wordpress,我想为Wordpress博客创建一个包含静态信息和博客帖子的首页: [Static Information 1] [Static Information 2] [Static Information 3] [Excerpt from latest Blog post from Category 1] [Excerpt from latest Blog post from Category 2] 静态部分将包含文本、链接和图像,管理员可以使用Wordpress的WYSIWYG编辑器进行修改,而不

我想为Wordpress博客创建一个包含静态信息和博客帖子的首页:

[Static Information 1]
[Static Information 2]
[Static Information 3]
[Excerpt from latest Blog post from Category 1]
[Excerpt from latest Blog post from Category 2]
静态部分将包含文本、链接和图像,管理员可以使用Wordpress的WYSIWYG编辑器进行修改,而不是文本小部件。 静态部分将应用不同的样式,因此我不希望它们与博客文章一起出现在循环中

实现这一目标的最佳方式是什么

我应该为每个静态部分创建单独的页面吗。如果是这样,我如何将页面嵌入到首页并防止其出现在菜单中


小部件是更好的解决方案吗?

您可以在主题中创建一个自定义模板,用于首页,或者使用现有的index.php。您可以在wordpress中创建新页面,以管理页面管理器中保持静态的信息。收集每页的ID号。这些是您想要用于新主题文件的页面。使用get_posts函数检索主题模板的帖子:

它有一个名为include的参数,您可以在其中直接传递id号:

$static = get_posts('include=10,11,12,13');
if($static){
    foreach($static as $post){
        //output some html here
    }
}
然后,查找在主题中使用wp_list_pages函数的位置。该函数有一个名为exclude的参数,您可以在其中以与在get_posts中传递post id相同的方式传递post id

wp_list_pages('exclude=10,11,12,13');