0

如何在wordpress中连接jquery,连接的脚本和管理员面板,以及wordpress php wp_deregister_script('jquery'); wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false); wp_enqueue_script('jquery');

 function admintuts_scripts_with_jquery1(){
 wp_deregister_script('jquery');
 wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"),   
  false);
 wp_enqueue_script('jquery');
}
add_action( 'admin_enqueue_scripts', 'admintuts_scripts_with_jquery1' );
add_action( 'admin_enqueue_scripts', wp_enqueue_script ("JQuery") );


function admintuts_scripts_with_jquery(){
wp_register_script( 'vote', plugins_url( '/js/vote.js', __FILE__ ), array( 'jquery' ) );
wp_register_script( 'vote', get_template_directory_uri() . '/js/vote.js', array( 'jquery' ) );
wp_enqueue_script( 'vote' );
}
add_action( 'admin_enqueue_scripts', 'admintuts_scripts_with_jquery' );

function wptuts_scripts_with_jquery(){
wp_register_script( 'formtest', plugins_url( '/www/js/formtest.js', __FILE__ ), array( 'jquery' ) );
    wp_register_script( 'formtest', get_template_directory_uri() . '/www/js/formtest.js', array( 'jquery' ) );
wp_enqueue_script( 'formtest' );
}
add_action( 'wp_enqueue_scripts', 'wptuts_scripts_with_jquery' );

/* echo "
<script type=\"text/javascript\" src=\"../wp-content/plugins/votefe/js/jquery.js\"></script>"; */

如果对谁感兴趣,这就是我解决问题的方法

php

function wptuts_scripts_with_jquery(){
  wp_deregister_script('jquery');
  wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"),   false);
  wp_enqueue_script('jquery');

  wp_register_script( 'formtest', plugins_url( '/www/js/formtest.js', __FILE__ ), array( 'jquery' ) );
  wp_register_script( 'formtest', get_template_directory_uri() . '/www/js/formtest.js', array( 'jquery' ) );
  wp_enqueue_script( 'formtest' );
}
add_action( 'wp_enqueue_scripts', 'wptuts_scripts_with_jquery' );


function votefe_load_style_css()
{   
  /*jquery for admin panel*/
  wp_deregister_script('jquery');
  wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false);
  wp_enqueue_script('jquery');
  if to whom it will be interesting, here is how I solved a problem


  /*js-script for admin panel*/
  wp_register_script( 'vote', plugins_url( '/js/vote.js', __FILE__ ), array( 'jquery' ) );      
  wp_register_script( 'vote', get_template_directory_uri() . '/js/vote.js', array( 'jquery' ) );    
  wp_enqueue_script( 'vote' );

  /*css-style for admin panel*/
  wp_register_style( 'styleforvote', plugins_url( '/css/styleforvote.css', __FILE__ ), array(), 'all' );
  wp_register_style( 'styleforvote', get_template_directory_uri() . '/css/styleforvote.css', array(), 'all' );
  wp_enqueue_style( 'styleforvote' );
}
add_action( 'admin_enqueue_scripts', 'votefe_load_style_css' );
4

1 回答 1

2

嗯嗯

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'>

在标题之前没有?我一直用这个

于 2012-06-06T11:11:20.560 回答