问题描述
我刚刚创建了一个使用 wordpress 和自定义主题的网站.这是我的主题目录
/themes/customtheme/-index.php-header.php-footer.php-blog.php....
index.php
包括header、footer、显示在我网站上的信息以及指向我的博客页面的链接.>
博客文件看起来和普通博客网站一样.
我可以知道如何在主题目录下的index.php
中写一个超链接(a href),以便在点击时提示blog.php
?
如果我很清楚您的问题,您需要使用您的 blog.php
文件创建一个新的页面模板.只需在文件开头添加以下代码:
然后在backed中创建一个新页面并将其关联到新创建的模板.
在此处阅读有关页面模板的更多信息.
I've just created a website using wordpress and a custom theme for it. This is my theme directory
/themes/customtheme/
-index.php
-header.php
-footer.php
-blog.php
....
The
index.php
includes header,footer,information to shown on my website, and a link to my blog page.
Blog file will looks same as normal blog site.
May i know how to write a hyperlink(a href) in
index.php
under theme directory so that it can prompt to the blog.php
when click?
解决方案
If I understand well your question you need to create a new page template using your
blog.php
file. Just add the following code at the beginning of the file:
<?php
/*
Template Name: My Blog Page
*/
And then create in the backed a new page and associate it to the newly created template.
Read more about page templates here.
这篇关于如何在 Wordpress 主题中加载自定义 php 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!