WordPress.org

Support

Support » Plugins and Hacks » The_content script

The_content script

  • Arevico

    @arevico

    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');
    ....
  • The topic ‘The_content script’ is closed to new replies.