WordPress 帖子除了无法与主题框架正常工作之外

发布于 2024-10-04 20:07:31 字数 389 浏览 0 评论 0原文

在父主题的支持论坛中遇到与此人相同的问题...... http://themeshaper.com/forums /topic/excerpt-on-front-page-childtheme_override_content_init-never- Called#post-16836

我在这里问是因为似乎没有人能够帮助他。

如果有人非常了解 WordPress,并且以前处理过主题框架,我们将不胜感激您的帮助。

提前致谢。

Getting the same problem as this guy in the support forum for the parent theme...
http://themeshaper.com/forums/topic/excerpt-on-front-page-childtheme_override_content_init-never-called#post-16836

I ask here because no one seemed to be able to help him.

If anyone understands wordpress quite well, and has dealt with the thematic theme framework before, your help would be appreciated.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

箜明 2024-10-11 20:07:31

如果 childtheme_override_content_init() 已存在于其他位置,则您无法“覆盖”它。

您可以通过在 single.php 中添加以下代码行来检查该函数是否存在:

echo print_r(function_exists('childtheme_override_content_init()'))

如果打印 TRUE 则该函数存在,则它将不起作用。在这种情况下,您有 2 个选择。删除原始函数或将其更改为您期望的行为。

检查框架是否有任何可用于修改函数行为的 Hook,这样您就不必更改或删除原始函数。

If a childtheme_override_content_init() already exists in some other place, you can't 'override' it.

You can check if the function exists by adding this line of code in your single.php:

echo print_r(function_exists('childtheme_override_content_init()'))

If it prints TRUE the function exists, it won't work. In this case you have 2 options. Delete the original function or change it to behave as you expect.

Check out if the framework have any Hooks that can be used to modify the behavior of the function so you don't have to change or delete the original function.

爱的故事 2024-10-11 20:07:31

经过几个小时的工作解决了这个问题。我不认为仅仅因为我已经花了几个小时在这上面并询问了堆栈,我就应该放弃尝试。

引用问题中提供的链接中我的帖子...

经过相当长时间的研究后
而,缺少的是你需要的
添加操作...

add_action('thematic_abovepost','childtheme_override_content_init');

我知道你似乎不应该
必须这样做,因为在 801 线上
add_action 函数被调用...

add_action('thematic_abovepost','thematic_content_init');

但是这是在 elseif 内部
语句,并且仅在子项运行时运行
覆盖函数不存在。

虽然我的修复有效,但我建议
“add_action”行被移出
右大括号。

Solved this after many hours working. I don't believe just because I have already spent hours on it and asked on stack, that I should simply give up trying.

Quote from my post at the link provided in the question...

After working on this for quite a
while, what was missing was you needed
to add the action...

add_action('thematic_abovepost','childtheme_override_content_init');

I know it seems like you shouldn't
have to do this because on line 801
the add_action function is called...

add_action('thematic_abovepost','thematic_content_init');

However this is INSIDE the elseif
statment, and is only run if the child
override function does not exist.

While my fix works, I propose that the
"add_action" line be moved outside of
the closing brace.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文