可以使用挂接函数进入网站页脚如下:任何方式将功能挂钩到WordPress的后期页脚(而不是wp_footer)?
function to_footer() {
$content = 'I am in the footer';
echo $content;
}
add_action('wp_footer', 'to_footer');
但有一个类似的方法在单一页面访问量增加后的页脚(未网站页脚)内的功能?
可以使用挂接函数进入网站页脚如下:任何方式将功能挂钩到WordPress的后期页脚(而不是wp_footer)?
function to_footer() {
$content = 'I am in the footer';
echo $content;
}
add_action('wp_footer', 'to_footer');
但有一个类似的方法在单一页面访问量增加后的页脚(未网站页脚)内的功能?
你可以得到的最接近的(不改变模板文件)是这个
function to_footer($content)
{
return $content . 'I am in the footer';
}
add_action('the_content', 'to_footer');
这将帖子内容后加上你的事
如果你不介意编辑模板,请尝试以下
function alt_footer()
{
do_action('alt_footer');
}
在functions.php
你的主题。然后在您需要的模板中拨打alt_footer()
,然后
function to_footer()
{
echo 'I am in the footer';
}
add_action('alt_footer', 'to_footer');
AFAIK一个帖子没有页脚。它确实有一个标题和一个元。这可能是插件或主题相关 - “帖子页脚”是什么? – Kenney
可能性在你的自定义页脚调用apply_filter('some function')',然后在你的'functions.php'' add_filter(相同函数)'中。我不知道深入的文字新闻,但可能是这样的方法 –