如何在自定义 wordpress 主题中为导航栏创建静态页面
How to Create static Page for navigation bar in custom wordpress theme
我的自定义 wordpress 页面中有一个主页(index.php)。在主页中,我有一个水平导航栏,其中有一个 "contact us" 部分,因为我是 wordpress 开发的新手,我不知道如何在 wordpress 中创建联系我们。
我联系我们页面的代码是
<?php/* This is contact page of SampleTheme */
?>
<?php
get_header();
?>
<div class="EventCalender"> <?php echo do_shortcode(' [do_widget id=spider_calendar-2]'); ?> <br>
<p class="EventCalenderPara"> There are 13 Planed events!! We all hope<br>
to see you and your family there! </p></div>
<?php get_footer(); /?>
当我通过 运行ing url "localhost/wordpress/contact.php" 运行 此页面时,我收到 404 错误。我的自定义 wordpress 主题中只有索引、页眉、页脚、功能、联系页面
"localhost/wordpress/contact.php" -- 错了。你可以创建一个新的联系页面然后 运行 这个 url "localhost/wordpress/contact" 如果你的联系页面名称是 "contact"
如果您想创建自定义页面,请按照此操作
使用您 contact.php 页面的顶部
<?php
/* Template Name:Contact*/
?>
然后转到仪表板 -> 页面 -> 编辑 联系人页面(如果不存在则创建一个新页面) -> 从右侧栏中单击模板名称并选择联系人。保存并 运行
我的自定义 wordpress 页面中有一个主页(index.php)。在主页中,我有一个水平导航栏,其中有一个 "contact us" 部分,因为我是 wordpress 开发的新手,我不知道如何在 wordpress 中创建联系我们。
我联系我们页面的代码是
<?php/* This is contact page of SampleTheme */
?>
<?php
get_header();
?>
<div class="EventCalender"> <?php echo do_shortcode(' [do_widget id=spider_calendar-2]'); ?> <br>
<p class="EventCalenderPara"> There are 13 Planed events!! We all hope<br>
to see you and your family there! </p></div>
<?php get_footer(); /?>
当我通过 运行ing url "localhost/wordpress/contact.php" 运行 此页面时,我收到 404 错误。我的自定义 wordpress 主题中只有索引、页眉、页脚、功能、联系页面
"localhost/wordpress/contact.php" -- 错了。你可以创建一个新的联系页面然后 运行 这个 url "localhost/wordpress/contact" 如果你的联系页面名称是 "contact" 如果您想创建自定义页面,请按照此操作 使用您 contact.php 页面的顶部
<?php
/* Template Name:Contact*/
?>
然后转到仪表板 -> 页面 -> 编辑 联系人页面(如果不存在则创建一个新页面) -> 从右侧栏中单击模板名称并选择联系人。保存并 运行