繁体   English   中英

我正在为 WordPress 创建自定义主题,如何显示我创建的“WordPress 页面”?

[英]I'm creating a custom theme for WordPress, how can I show a “WordPress page” that I created?

I created a custom theme for WordPress, and the folder only has the header, footer, index (which calls for the header and footer) and page PHP files until now.

我想要做的是显示我自己网站的另一个 WordPress 页面(我们在/wp-admin/post-new.php?post_type=page创建的页面),它有一个 ZE6B391A8D2C4D4557B03Z38B656A2。

我尝试使用的代码如下。

我在浏览器上被正确重定向到我想要的页面( http://localhost/wordpress/test-page/ ),但该页面没有显示我在 WordPress 页面上写的文本。 我错过了什么吗?

索引.php:

<?php get_header(); ?>

<a href="http://localhost/wordpress/test-page/">This is the WordPress Page URL</a></br>

<?php get_footer(); ?>

page.php:

<?php get_header(); ?>

<!-- Some code to show the WordPress Page -->

<?php get_footer(); ?>

我希望使用我创建的 header 和页脚 styles 显示 WordPress 页面内容。

编辑:刚刚上传了新图片来说明我的意思。 这些使用 WordPress 标准主题。 我正在尝试在我的自定义主题中显示该“测试”页面。 但是当我通过 URL 访问该页面时,它不会显示“测试页面”内容。

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

刚刚发现我的page.php文件需要一些功能来显示我创建的 WordPress 页面,如下例所示:

<?php get_header(); ?>

<?php

// Title
single_post_title();

// Content
the_post();
the_content();

?>

<?php get_footer(); ?>

暂无
暂无

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

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