如何在WordPress中连接jQuery,脚本已连接,并在管理员面板中以及页面上的WordPress上


how to connect jquery in wordpress, the scripts connected and in the administrator a panel, and on page wordpress

如何在WordPress中连接jQuery,脚本已连接,并在管理员面板中以及页面上的WordPress.php wp_deregister_script('jquery'); wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), 假); 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' );

Mmmm

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

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