我使用了211作为我的主题,并在其下创建了一个名为results的PHP页面。结果中的php。php以下是我的代码:
<?php
get_header(); ?>
<?php get_footer(); ?>
从我的索引。php:get_header(); ?>
<a href="wp-content/themes/twentyeleven/result.php">Main</a>
<?php get_footer(); ?>
我使用了211作为我的主题,并在其下创建了一个名为results的PHP页面。结果中的php。php以下是我的代码:
<?php
get_header(); ?>
<?php get_footer(); ?>
从我的索引。php:get_header(); ?>
<a href="wp-content/themes/twentyeleven/result.php">Main</a>
<?php get_footer(); ?>
你得到undefined function
因为你指向的是结果。直接使用php。这样WordPress就不会加载。
如果需要包括结果。php在特定位置使用get_template_part 甚至更好locate_template
没有开口<?php
标记第二个(index.php)代码块。
应该是这样的,
<?php get_header(); ?>
<a href="wp-content/themes/twentyeleven/result.php">Main</a>
<?php get_footer(); ?>
安瓿,然后重试<a href="<?php get_the_permalink();?>/result/">Main</a>
在的顶部result.php
, 将其更改为:<?php
/*
Template Name: Result Template
*/
get_header();
?>
//do your results stuff here... or get regular page loop.
<?php get_footer(); ?>
在仪表板中,转到Pages, Add New 然后输入一个名为Result.然后从右侧Page Attributes 元框,选择您的Result Template 然后发布页面。
当您访问时http://www.yoursite.com/result/
使用result.php
已创建并分配页面模板。
有时,通过oEmbed嵌入项目是不可能的,例如,当YouTube视频已禁用嵌入时。The oEmbed service will return a 401 Unauthorized, 并且不会转换代码。有没有办法通知用户这一点?当前的工作流是非直观的(至少对我来说),我更喜欢在WordPress页面上,或者更好的是,在编辑器中显示一条消息,说明对象无法嵌入。