• Resolved florent71

    (@florent71)


    Hi Antoine,
    I want to customize the “do_countdown” javascript function.
    To do this, I use footballpool_post_init hook to add this line :
    Football_Pool_Utils::include_js( "pool_child.js", 'js-pool', null, false, WP_PLUGIN_DIR . "/football-pool-child/assets/" );

    But it’s not working, my javascript function is not loaded 🙁

    Any idea ?

    Thanks in advance,
    -Florent

    https://wordpress.org/plugins/football-pool/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author AntoineH

    (@antoineh)

    I’ll look into it next week. I’m on holiday at the moment and not able to check the code.

    Plugin Author AntoineH

    (@antoineh)

    Seems like my function is only useable for scripts within the plugin root. Because your file is in its own directory, I recommend just using WP’s own functions for registering the script, e.g.

    $handle = 'js-pool-child';
    wp_register_script( $handle, WP_PLUGIN_URL . '/football-pool-child/assets/pool_child.js', 'pool-js', FOOTBALLPOOL_DB_VERSION );
    wp_enqueue_script( $handle );

    Also, make sure your script gets its own handle and – if needed – use the $deps parameter (as in my example) to make sure it loads after my script is loaded.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Customize javascript function’ is closed to new replies.