dongzou9047 2012-06-06 11:03
浏览 53
已采纳

如何在wordpress中连接jquery,连接脚本,在管理员面板中连接,在wordpress上连接

how to connect jquery in wordpress, the scripts connected and in the administrator a panel, and on page 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>"; */

if to whom it will be interesting, here is how I solved a problem

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' );
  • 写回答

1条回答 默认 最新

  • dongmei8071 2012-06-06 11:11
    关注

    Mmmm

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

    Before the header no? I always used this

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?