Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.com/f/partner"><img src="//cdn.mxpnl.com/site_media/images/partner/badge_white.png" alt="Mobile Analytics" /></a>';

     } 
    add_action( 'wp_footer', 'mixpanel_footer' );
share|improve this question
1  
Please post the code you're using so we can have a better idea of what you're trying to do. –  morganestes Aug 3 '13 at 4:14
    
are you hooking the code when you put it into functions.php? if not maybe your theme doesn't have wp_footer in the footer.php Without code that's my first guess. –  BandonRandon Aug 3 '13 at 4:40
    
I updated the question, Yes I'm pretty sure that the theme has wp_footer in footer.php, that's why it's working when I put the code in functions.php –  Waseem Abu Senjer Aug 3 '13 at 9:03
add comment

1 Answer

Try adding priority to hook as following:

function mixpanel_footer(){

echo '<a style="margin-left:45%;" href="https://mixpanel.com/f/partner"><img src="//cdn.mxpnl.com/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.

share|improve this answer
    
I tried it before but it didn't work either. –  Waseem Abu Senjer Aug 3 '13 at 10:30
    
Is other functionality of plugin working well? –  Vinod Dalvi Aug 3 '13 at 10:40
    
I have added this code in the plugin file hello.php of Hello Dolly plugin and it worked well. Is there anything wrong in your plugin code? –  Vinod Dalvi Aug 3 '13 at 10:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.