admin管理员组文章数量:1279246
I'm using the wp_footer hook into the plugin and it doesn't work, but when I copy the code to the "functions.php" file of the active theme it does work, what is the possible problem in this situation ?
function mixpanel_footer(){
echo '<a style="margin-left:45%;" href=""><img src="//cdn.mxpnl/site_media/images/partner/badge_white.png" alt="Mobile Analytics" /></a>';
}
add_action( 'wp_footer', 'mixpanel_footer' );
I'm using the wp_footer hook into the plugin and it doesn't work, but when I copy the code to the "functions.php" file of the active theme it does work, what is the possible problem in this situation ?
function mixpanel_footer(){
echo '<a style="margin-left:45%;" href="https://mixpanel/f/partner"><img src="//cdn.mxpnl/site_media/images/partner/badge_white.png" alt="Mobile Analytics" /></a>';
}
add_action( 'wp_footer', 'mixpanel_footer' );
Share
Improve this question
edited Aug 3, 2013 at 9:02
Waseem Abu Senjer
asked Aug 3, 2013 at 2:51
Waseem Abu SenjerWaseem Abu Senjer
2433 silver badges10 bronze badges
3
|
3 Answers
Reset to default 1Firstly, remove the margin-left
CSS property from your html and then try if it works. May be your html is being hidden behind any other html.
Or better try this first -
Remove the current code from your function and just write any non html thing. Then put a die()
or exit()
and see if it's being rendered properly. Then you can do further debugging.
Try adding priority to hook as following:
function mixpanel_footer(){
echo '<a style="margin-left:45%;" href="https://mixpanel/f/partner"><img src="//cdn.mxpnl/site_media/images/partner/badge_white.png" alt="Mobile Analytics" /></a>';
}
add_action( 'wp_footer', 'mixpanel_footer', 5 );
For more information on adding priority to wp_footer hook visit this page.
Can you please use this code? I think it will work properly.
function your_function(){
do_action( 'your_action' );
}
add_action( 'wp_footer', 'your_function' );
本文标签: using wpfooter hook in a plugin
版权声明:本文标题:using wp_footer hook in a plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741265784a2368436.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
functions.php
? if not maybe your theme doesn't havewp_footer
in thefooter.php
Without code that's my first guess. – Brooke. Commented Aug 3, 2013 at 4:40wp_footer
infooter.php
, that's why it's working when I put the code infunctions.php
– Waseem Abu Senjer Commented Aug 3, 2013 at 9:03