日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > php >内容正文

php

wordpress PHP合并js,如何在WordPress中添加外部JavaScript

發(fā)布時(shí)間:2024/9/19 php 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 wordpress PHP合并js,如何在WordPress中添加外部JavaScript 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

我想在WordPress中插入放置在該文件夾中的外部JavaScript.

如果我使用腳本標(biāo)記包含它顯示“

下面是我的代碼

global $wpdb;

include("/asset/php/chart4php/inc/chartphp_dist.php");

$p = new chartphp();

$p->data_sql = $wpdb->get_results("select t2.name, count(t1.id) as score from custom_status as t2 left join wpsp_ticket as t1 on t2.name = t1.status group by t2.name");

$p->chart_type = "bar";

// Common Options

$p->title = "Category Sales";

$p->xlabel = "Category";

$p->ylabel = "Sales";

$color = array("#1AAF5D","#F2C500","#F45B00","#8E0000","#0E948C");

$p->color = $color[rand(0,4)];

$out = $p->render('c1');

嘗試包括js文件

wp_enqueue_script( 'jquery' );

wp_enqueue_script( 'ajax_search' );

wp_register_script( 'chartphp', plugins_url('/asset/php/chart4php/chartphp.js', __FILE__), array('jquery'));

wp_enqueue_script(‘chartphp’);

另外我想要包含3個(gè)移動(dòng)文件

解決方法:

在WordPress中包含腳本的正確方法是使用wp_enqueue_script().

如果您以前注冊(cè)過(guò)腳本,則只需引用它:

You could either link a script with a handle previously registered using the 07001 function, or provide this function with all the parameters necessary to link a script.

請(qǐng)注意,如果在dependencies參數(shù)中包含jQuery等默認(rèn)腳本,則無(wú)需單獨(dú)注冊(cè)和/或?qū)⑺鼈兣湃腙?duì)列.

標(biāo)簽:jquery,wordpress,php,javascript,charts

來(lái)源: https://codeday.me/bug/20190627/1308258.html

總結(jié)

以上是生活随笔為你收集整理的wordpress PHP合并js,如何在WordPress中添加外部JavaScript的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。