Support » Plugins » Echoing Text in Footer via Plugin

  • fool4Christ


    On my own blog, I am trying to put together a little plugin that would so some fancy dynamic stuff and then output the the resulting variable via the wp_footer() hook. Essentially, the plugin looks like this:

    function get_my_custom_variable() {
    	// *clip function contents*
    	echo $resulting_variable;
    // hook to WordPress footer
    add_action( 'wp_footer', 'get_my_custom_variable', 10 );

    What happens when I activate the plugin is that my blog ceases to load — no errors, no warnings, just a blank page w/ no outputted HTML.

    If I comment out the last add_action() call and simply call the function itself, it works just fine when I access the plugin file directly via my browser. It seems to cause WordPress to choke, however.

    Any tips on how I can debug this? It seems so simple!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Use this

    add_action( ‘wp_footer’, ‘get_my_custom_variable’);

    instead of

    add_action( ‘wp_footer’, ‘get_my_custom_variable’, 10 );

    Let me know how it goes.




    I tried that first, actually, adding the “10” when I saw that “priority” variable mentioned on the Codex. I added it thinking it might make a difference.

    It didn’t. Neither works.

    You can check out my currently used code here:

    Still doesn’t work. :\

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Echoing Text in Footer via Plugin’ is closed to new replies.