【问题标题】:Pass query string from one page to another in wordpress在wordpress中将查询字符串从一页传递到另一页
【发布时间】:2016-11-11 12:55:09
【问题描述】:

我在 wordpress 中有一个名为“batches.php”的自定义模板页面,其中包含以下代码

echo '<a href="'.get_template_directory_uri().'/view-batches.php?bid=58233b48dbc43" >View</a>';

上面的代码将 bid=58233b48dbc43 发送到“view-batches.php”。

查看-batches.php:

<?php 
/* Template name:View Batches */
echo "Batch id=".$_GET["bid"];
get_header();
get_footer();
?>

此代码打印出价,即 58233b48dbc43,但也显示 致命错误:调用未定义函数 get_header()

此问题的任何解决方案以及如何在 wordpress 中将数据从一页传递到另一页

【问题讨论】:

标签: php wordpress


【解决方案1】:

此函数位于wp-includes/general-template.php。 因此,您只需包含上述文件或确保它包含在您的主题核心文件中

【讨论】:

    猜你喜欢
    • 2010-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多