Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

garciasanchezdani on "wp enqueue scripts don't work"

$
0
0

Hi all, I'm using it in a single post, like this:

add_action( 'wp_enqueue_scripts', 'wp_add_unit_scripts' );
function wp_add_unit_scripts() {

    global $post;

    wp_register_script('unit_more_widgets_scripts', WP_PLUGIN_DIR.'/js/funcionalidad.js', array( 'jquery' ));

    if($post->post_author == ID_USUARIO){
        wp_enqueue_script('unit_more_widgets_scripts');
    }
}

I'm calling it just after get_header ... but I'm debugging and the code inside the function isn't executed...

What I try is to add some javascript in one single post, only if this post has been created by determined user...

Thanks, Daniel


Viewing all articles
Browse latest Browse all 8245

Trending Articles