简体   繁体   English

设置wordpress“静态博客页面”的样式

[英]Styling the wordpress 'Static Blog Page'

I'm having a bit of trouble with Wordpress, I want my blog posts to show on the news page, so I selected that page in the settings tab. 我在使用Wordpress时遇到了一些麻烦,我希望博客文章显示在新闻页面上,因此我在“设置”标签中选择了该页面。

The blog posts show but I want to change the page template, I created a new template which works on all other pages but when I select it from the page template list within the 'news' page it doesn't change but instead just stays the same. 显示了博客文章,但我想更改页面模板,我创建了一个适用于所有其他页面的新模板,但是当我从“新闻”页面内的页面模板列表中选择它时,它不会改变,而是保持不变。相同。

There is no blog.php file, I've even tried changing the standard page.php expecting it to be falling back onto that but it is not! 没有blog.php文件,我什至尝试过更改标准的page.php,希望它重新出现在该文件上,但事实并非如此! I've tried changing the archives page too but nothing seems to change it! 我也尝试过更改存档页面,但似乎没有任何更改!

Any ideas? 有任何想法吗?

It won't be page.php which shows a single page view and you're right, there is no blog.php. 不会是显示单个页面视图的page.php,您是对的,没有blog.php。 Wordpress uses a template hierarchy for displaying lists of blog posts. Wordpress使用模板层次结构来显示博客文章列表。

As you can see from this diagram - Wordpress template hierarchy 从该图中可以看到-Wordpress模板层次结构

For archives like your News blog page you are looking at category.php, archive.php and then index.php (depending on your theme and which template files you've got). 对于新闻博客页面之类的档案,您需要查看category.php,archive.php和index.php(取决于主题和所拥有的模板文件)。

Rather handily your problem is exactly the same as the working example used as a demonstration in the Codex link I've given above, so this should help explain things more. 方便地,您的问题与上面在Codex链接中用作演示的工作示例完全相同,因此这应该有助于进一步解释问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM