久久机这里只有精品,国产69精品一区二区亚洲孕妇,91精品国产综合久久婷婷香蕉,午夜久久久久久电影

最新活動:電腦PC端+手機(jī)端+微網(wǎng)站+自適應(yīng)網(wǎng)頁多模板選擇-建站388元起價!!!
當(dāng)前位置:主頁 > 網(wǎng)站建設(shè) > 制作widget小工具| 整合Aplayer.js音樂播放器到小工

制作widget小工具| 整合Aplayer.js音樂播放器到小工

時間:2023-05-28 19:05:28 閱讀: 文章分類: 網(wǎng)站建設(shè) 作者: 網(wǎng)站編輯員

導(dǎo)讀:建站文章建站文章????function widgetaplayer() {$widget_ops = array('classname' = 'widget-aplayer'網(wǎng)站推廣優(yōu)化seoseo網(wǎng)站優(yōu)化培訓(xùn)。

網(wǎng)站推廣優(yōu)化seoseo網(wǎng)站優(yōu)化培訓(xùn)

Aplayer的音樂播放器界面確實好看,所以決定也弄一個,最終整合到側(cè)邊欄的小工具上,這樣方便在不同的地方調(diào)用不同的音樂

先看看效果圖:

制作widget小工具| 整合Aplayer.js音樂播放器到小工具–愛CSS-每多學(xué)一點知識就少寫一行代碼

 

 

 

 

 

 

 

Aplayer.js

以下是制作widget小工具的全部代碼,把以下代碼存為:widget-aplayer.php

以下是制作widget小工具的全部代碼,把以下代碼存為:widget-aplayer.php

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 <?php add_action('widgets_init', 'widgetaplayerInit'); function widgetaplayerInit() { ????register_widget('widgetaplayer'); } class widgetaplayer extends WP_Widget { ????/** ???? * widgetProfile setup ???? */ ????function widgetaplayer() { ????????$widget_ops = array('classname' => 'widget-aplayer', 'description' => '添加Aplayer播放器'); ????????// init widgetProfile ????????parent::__construct('widget-aplayer', "Aplayer播放器", $widget_ops); ????} ????/** ???? * How to display the widgetProfile on the screen. ???? */ ????function widget( $args, $instance ) { ????????extract( $args ); ????????/* Our variables from the widget settings. *企業(yè)網(wǎng)站建設(shè)/ ????????$title = apply_filters('widget_name', $instance['title'] ); ????????$type = $instance['type']; ????????$gs = $instance['gs']; ????????$auto = $instance['auto']; ????????$auto = $instance['auto']; ????????$url = $instance['url']; ????????$pic = $instance['pic']; ????????$word = $instance['word']; ????????echo $before_widget; ????????echo $this->showWidget($title,$type,$gs, $auto, $url, $pic,$word); ????????echo $after_widget; ????} ????/** ???? * Update the widget settings. ???? */ ????function update( $new_instance, $old_instance ) { ????????$instance = $old_instance; ????????/* Strip tags for title and name to remove HTML (important for text inputs). */ ????????$instance['title'] = strip_tags( $new_instance['title'] ); ????????$instance['type'] = strip_tags( $new_instance['type'] ); ????????$instance['gs'] = strip_tags( $new_instance['gs'] ); ????????$instance['auto'] = strip_tags( $new_instance['auto'] ); ????????$instance['url'] = strip_tags( $new_instance['url'] ); ????????$instance['pic'] = strip_tags( $new_instance['pic'] ); ????????$instance['word'] = strip_tags( $new_instance['word'] ); ????????return $instance; ????} ????/** ???? * Displays the widget settings controls on the widget panel. ???? * Make use of the get_field_id() and get_field_name() function ???? * when creating your form elements. This handles the confusing stuff. ???? */ ????function form( $instance ) { ????????/* Set up some default widget settings. */ ????????$defaults = array( ????????????'title' => '', ????????????'type' => 'true', ????????????'gs' => 'true', ????????????'auto'??=> '', ????????????'url'?? => '', ????????????'pic'?? => '', ????????????'word'??=> '' ????????); ????????$instance = wp_parse_args( (array) $instance, $defaults ); ?> ????????<!-- widget title: --> ????????<p> ????????????<label for="<?php echo $this->get_field_id( 'title' ); ?>">顯示標(biāo)題</label> ????????????<input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> ????????</p> ????????<p> ????????????<label for="<?php echo $this->get_field_id( 'type' ); ?>">自動播放</label> ????????????<select id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>" class="widefat" style="width:100%;"> ????????????????<option value="true" <?php if ( 'true' == $instance['type'] ) echo 'selected="selected"'; ?>>開啟</option> ????????????????<option value="false" <?php if ( 'false' == $instance['type'] ) echo 'selected="selected"'; ?>>關(guān)閉</option> ????????????</select> ????????</p> ????????<p> ????????????<label for="<?php echo $this->get_field_id( 'gs' );?>">開啟歌詞</label> ????????????<select id="<?php echo $this->get_field_id( 'gs' ); ?>" name="<?php echo $this->get_field_name( 'gs' ); ?>" class="widefat" style="width:100%;"> ????????????????<option value="true" <?php if ( 'true' == $instance['gs'] ) echo 'selected="selected"'; ?>>開啟</option> ????????????????<option value="false" <?php if ( 'false' == $instance['gs'] ) echo 'selected="selected"'; ?>>關(guān)閉</option> ????????????</select> ????????</p> ????????<p> ????????????<label for="<?php echo $this->get_field_id( 'auto' ); ?>">歌唱者</label> ????????????<input type="text" id="<?php echo $this->get_field_id( 'auto' ); ?>" name="<?php echo $this->get_field_name( 'auto' ); ?>" value="<?php echo $instance['auto']; ?>" style="width:100%;" /> ????????</p> ????????<p> ????????????<label for="<?php echo $this->get_field_id( 'url' ); ?>">歌曲URL</label> ????????????<input type="text" id="<?php echo $this->get_field_id( 'url' ); ?>" name="<?php echo $this->get_field_name( 'url' ); ?>" value="<?php echo $instance['url']; ?>" style="width:100%;" /> ????????</p> ????????<p> ????????????<label for="<?php echo $this->get_field_id( 'pic' ); ?>">歌曲封面</label> ????????????<input type="text" id="<?php echo $this->get_field_id( 'pic' ); ?>" name="<?php echo $this->get_field_name( 'pic' ); ?>" value="<?php echo $instance['pic']; ?>" style="width:100%;" /> ????????</p> ????????<p> ????????????<label for="<?php echo $this->get_field_id( 'word' ); ?>">歌詞</label> ????????????<input type="text" id="<?php echo $this->get_field_id( 'word' ); ?>" name="<?php echo $this->get_field_name( 'word' ); ?>" style="width:100%;" value="<?php echo $instance['word']; ?>" /> ????????</p> ????????<?php ????} ????function showWidget($title,$type,$gs, $auto, $url, $pic, $word) { ?????????> ????<link href="<?php echo get_template_directory_uri().'/aplayer/APlayer.min.css'?>" rel="stylesheet"> ????<script src="<?php echo get_template_directory_uri().'/aplayer/APlayer.min.js'?>"></script> ????<div class="widget-title"><?php echo $title ?></div> ????????<div網(wǎng)站推廣優(yōu)化seo id="player1"> ????????????<pre class="aplayer-lrc-content"> ????????????????<?php echo $word ?> ????????????</pre> ????????</div> ????<script> ????????var ap = new APlayer ????????????????({ ????????????????????element: document.getElementById('player1'), ????????????????????narrow: false, ????????????????????autoplay: <?php echo $type ?>, ????????????????????showlrc: <?php echo $gs ?>, ????????????????????mu建設(shè)網(wǎng)站sic: { ????????????????????????????title: '<?php echo $title ?>', ????????????????????????????author: '<?php echo $auto ?>', ????????????????????????????url: '<?php echo $url ?>', ????????????????????????????pic: '<?php echo $pic ?>' ????????????????????????????} ????????????????}); ????????ap.init(); ????</script> ????<?php } }?>

關(guān)鍵詞標(biāo)簽: 小工具 widget 音樂播放器

聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-05-28 ,文章制作widget小工具| 整合Aplayer.js音樂播放器到小工主要講述widget,小工具,音樂播放器網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請保留鏈接: http://www.bifwcx.com/article/web_11592.html

我的IDC 網(wǎng)站建設(shè)技術(shù)SEOUC.COM
專注網(wǎng)站建設(shè),SEO優(yōu)化,小程序設(shè)計制作搭建開發(fā)定制網(wǎng)站等,數(shù)千家網(wǎng)站定制開發(fā)案例,網(wǎng)站推廣技術(shù)服務(wù)。
  • 5000+合作客服
  • 8年從業(yè)經(jīng)驗
  • 150+覆蓋行業(yè)
  • 最新熱門源碼技術(shù)文章

    主站蜘蛛池模板: 赤壁市| 清远市| 元氏县| 池州市| 乌鲁木齐市| 景洪市| 郓城县| 岳阳市| 松阳县| 郁南县| 高安市| 永德县| 永州市| 叶城县| 望江县| 三江| 万年县| 河间市| 恩施市| 尤溪县| 商南县| 靖安县| 尚志市| 临泽县| 普定县| 视频| 额济纳旗| 攀枝花市| 台中县| 青河县| 广元市| 方城县| 临漳县| 岗巴县| 军事| 澄江县| 临夏县| 涟水县| 朔州市| 高州市| 澄迈县|