【问题标题】:error Call to undefined function get_header() in错误调用未定义的函数get_header()
【发布时间】:2014-09-25 08:52:38
【问题描述】:

我刚刚下载了一个新模板,当我想尝试它时,我收到了一个致命错误:

Fatal error: Call to undefined function get_header()

这是我的 index.php

<?php 
global $SMTheme;

get_header(); 

get_template_part('theloop');

get_template_part('navigation');

get_footer();

?> 

【问题讨论】:

  • 尝试将变量添加到函数中?即$SMTheme-&gt;get_header();

标签: php wordpress templates


【解决方案1】:

正如我在 cmets 中所说,我将假设 get_header() 等的函数在 $SMTheme 定义的类中的某个位置。

因此,鉴于此,您应该像这样调用函数:

$SMTheme->get_header(); 

$SMTheme->get_template_part('theloop');

$SMTheme->get_template_part('navigation');

$SMTheme->get_footer();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-21
    • 1970-01-01
    • 2012-04-21
    • 2011-04-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多