WordPress.org

Ready to get started?Download WordPress

Forums

Echoing Text in Footer via Plugin (3 posts)

  1. fool4Christ
    Member
    Posted 6 years ago #

    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!

  2. Sudar
    Member
    Posted 6 years ago #

    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.

    Cheers,
    Sudar

  3. fool4Christ
    Member
    Posted 6 years ago #

    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:
    http://rickbeckman.org/wp-content/plugins/php-linkifier.phps

    Still doesn't work. :\

Topic Closed

This topic has been closed to new replies.

About this Topic