【发布时间】:2012-09-21 17:27:52
【问题描述】:
我的代码第 3 行出现了某种错误,我似乎无法弄清楚。以下是它输出的错误以及我的代码。
致命错误:在第 3 行调用非对象上的成员函数 the_meta()
<?php $meta = $custom_metabox->the_meta('description', TRUE);
if (!empty($meta)):
echo '<p class="description">'.$meta['description'].'</p>'; ?>
<?php endif; ?>
<br>
<ul id="process"><span>Process: </span></ul>
<br>
<ul class="credits">
<?php if(the_meta()) { the_meta(); } ?>
<li class="shorturl"><span>Short Url: </span>
<div id="d_clip_container">
<input id="fe_text" onChange="clip.setText(this.value)" type="text" value="<?php echo bitly(); ?>" />
<div id="d_clip_button" class="my_clip_button"></div>
</div>
</li>
<li class="save"><span>Save: </span> <a class="gimmebar" href="#">Gimme Bar</a></li>
</ul>
</div> <!-- End Info -->
<?php get_search_form(); ?>
这是第 3 行
<?php $meta = $custom_metabox->the_meta('description', TRUE);
【问题讨论】:
-
答案就在错误信息中——
$custom_metabox不是一个对象。它是在哪里定义的? -
确保包含/加载了 $meta 引用的类或对象
-
这是我正在使用的插件,它只在我在搜索页面上时抛出错误。否则它工作正常。
-
你把这个放在哪个wordpress模板文件里了?
-
我正在为我的自定义元框使用 WPAlchemy。该插件位于主题文件夹(/wp-content/wpalchemy)之前的目录中。
标签: php wordpress fatal-error