WordPress.org

Ready to get started?Download WordPress

Forums

The_content script (1 post)

  1. Arevico
    Member
    Posted 2 years ago #

    How can i include a script(which depend on jquery) in the_content action in a proper way?

    This is the code in the action hook the_content. (i need to have it in the content, because i only want to include this script if a specific text is in the_content

    ....
    $x = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
    	if (!wp_script_is("jquery")) {
    		wp_register_script("jquery",$x. "jquery.js");
    		wp_print_scripts('jquery');
    }
    	wp_register_style('lb_stl', $x . 'thickbox.css' );
    	wp_print_styles('lb_stl');
    
    	wp_register_script('lb_thk', $x . 'thickbox.php' );
    	wp_localize_script( 'lb_thk', 'options', $options );
    
    	wp_print_scripts('lb_thk');
    ....

Topic Closed

This topic has been closed to new replies.

About this Topic