给WordPress添加mini flash播放器|给下载链接添加图片

本文涉及操作一劳永逸,所以超赞! 林木木 同学曾今介绍过短代码插入的文章,很好的借鉴。
这个播放器我找了N就终于在外国淘到,大家享用吧,此播放器支持 调节音量,定位时间轴等。
添加播放器:

首先:下载flash播放:

然后:上传到 wp-content/theme/主题目录/

最后:在Wordpress 在用主题functions.php 中间位置 添加如下函数:

/**添加 flash player */
    function myplayer($atts, $content=null){
    extract(shortcode_atts(array("auto"=>'no',"loop"=>'no'),$atts));
    return '<embed src="'.get_bloginfo("template_url").'/player.swf?soundFile='.$content.'&bg=0xeeeeee&leftbg=0x357dce&lefticon=0xFFFFFF&rightbg=0xf06a51&rightbghover=0xaf2910&righticon=0xFFFFFF&righticonhover=0xffffff&text=0x666666&slider=0x666666&track=0xFFFFFF&border=0x666666&loader=0x9FFFB8&loop='.$loop.'&autostart='.$auto.'" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" width="290" height="30">';
}
add_shortcode('music','myplayer');
写作时调用代码:[mu sic]音乐绝对地址---我用的微软sky网盘[/m usic] 去掉空格

效果:MP3《bleed it out》–linkin park :

添加下载图片:

步骤相同,只是添加如下代码

 /**紫色部分就是下载链接的图片 */
function download($atts, $content = null) {
     return '<a href="'.$content.'" rel="external nofollow" target="_blank" title="download-下载地址">
<img src="http://zlz.im/up/download.gif" border="0" /></a>';}
add_shortcode("download", "download");
写作时调用代码:[downloa d]  下载链接 或 页面  [/d  ownload] 去掉空格

效果:Flash播放器下载地址:

—————-到此,折腾完了,以后好的音乐我会放上来分享的,放心。。。。我会选择 自动播放 来QJ大家耳朵的,嘎嘎!

版权所有© HzlzH | 本文采用 BY-NC-SA 进行授权
转载需注明 转自: 《给WordPress添加mini flash播放器|给下载链接添加图片

相关文章

{ Leave a Reply ? }

  1. 荒野无灯 China Mozilla Firefox Windows

    :mrgreen: 不错啊,wp的shortcode就是神奇啊

  2. 万戈 China Mozilla Firefox Windows

    短代码耶,不错,还没怎么用过

  3. 秦大少 China Google Chrome Windows

    看起来很不错啊,而且教程很详细,赞一个!

  4. xionmo Macau Internet Explorer Windows

    博主,您推荐的这个可否支持在首页中侧栏显示视频呢?如何实现呢

  5. 小辉网 China Internet Explorer Windows

    这个很个性啊。 :wink:

  6. zwwooooo China Google Chrome Windows

    我用的是代码方式的auto player

  7. 午夜兰花手札 China Internet Explorer Windows

    哼,也不顺手捎上一段MP3,,对此,我们强烈不满!

  8. 海天无影 China Mozilla Firefox Windows

    短代码我喜欢
    博主可以自定义歌曲名字,或者自定义是否循环或自动启动呢
    比如在music时,加上不是必须的可手动填写的title、auto、loop标签呢? :-D

      • 海天无影 China Mozilla Firefox Windows

        @HzlzH, 直接传就可以吗?不需要在代码上修改什么吗? :?:
        能不能自定义标签啊 有点长呢……怕要用的时候还要翻一下

      • 海天无影 China Mozilla Firefox Windows

        @HzlzH,为什么我加上去不能用啊?
        [music]地址[/music]还是显示的代码……

          • 海天无影 China Mozilla Firefox Windows

            @HzlzH, 这个是我用audioplayer的……

          • 海天无影 China Mozilla Firefox Windows

            @HzlzH, 你看这个文章里的http://blog.haitianhome.com/tody-41.html

              • 海天无影 China Mozilla Firefox Windows

                @HzlzH, 额 还是不行
                我现在用的是你这篇文章里那首歌。
                我那段代码是加在functions.php文件里,你文中所说的fucton.php文件应该是指functions.php文件吧。
                swf文件我是上传到皮肤文件夹下的
                编辑文章我就直接[music]地址[/music]
                这就就对吧?

  9. 海天无影 China Mozilla Firefox Windows

    呵呵 感谢在HzlzH的帮助弄出了正确用法:
    [music loop="yes" auto="yes"]歌曲地址[/music]这样就可以直接在写文章时设置是否循环和自动播放了。如果不加那两个参数默认都是no
    如果想要歌曲名字的话,那就加titles参数了,还要修改HzlzH的函数
    将其中相应的改成如下:
    extract(shortcode_atts(array(“auto”=>’no’,”loop”=>’no’,”titles”=>’music’),$atts));
    return ”;

    嘿嘿这样就好了,可以丢掉audioplayer了哦~

    • 海天无影 China Mozilla Firefox Windows

      @海天无影, 额 因为防盗链 下面那段函数没出来
      就是在$auto.’的后面加上&titles=’.$titles.’

  10. xiao3 United States Mozilla Firefox Windows

    这样的话以后换主题时都要添加短代码啦!

  11. xena China Internet Explorer Windows

    博主,请教一下,我输入[music]—[/music]显示的也是代码,看不到player。整了一下午弄不出来。有可能是什么原因呢。谢谢!

    • xena China Internet Explorer Windows

      @xena, 我加在最后了,中间不知道往哪里放比较好。

    • xena China Internet Explorer Windows

      @xena, 是不是加在“// Here we handle upgrading our ”像这样任意的一个句子前面都可以。之前是这样加的,但是效果也是显示代码。

    • xena China Internet Explorer Windows

      好的,发到gmail了~

    • xena China Internet Explorer Windows

      现在好了,谢谢博主。

  12. India Google Chrome Windows

    代码 get_bloginfo(” template_url”).’/player.swf?这段中(” temp中间有个空格 不去掉的时候死活 显示空白 :!:

  13. 小杰博客 China Mozilla Firefox Windows

    我也能用了,谢谢。好简洁的一个播放器,很喜欢

  14. 午夜客 China Internet Explorer Windows

    一般不喜欢在非音乐站听音乐! :mrgreen:

  15. samwon China Internet Explorer Windows

    你好!请问为什么插入视频不能显示?请问怎样设置?在网上找了好多方法都不行

  16. 闲云野鹤 China Google Chrome Windows

    嘿嘿,用上了,不过你的这个不符合W3C里面flash的,我修改了下,嘿嘿!

  17. love02xp United States Maxthon Windows

    哈哈,使用了,3Q…

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)

Pingback & Trackback

  1. I Play W.O.W Music Video | WoWlog.info United States WordPress Unknow Os - Pingback on 2010/03/31/ 03:17
  2. 给Wordpress添加mini flash播放器|给下载链接添加图片 | 一灯可以破暗空 China WordPress Unknow Os - Pingback on 2010/05/30/ 17:16
  3. 给wordpress添加mini flash播放器及skydive 外链 | 小楼昨夜又东风 Lithuania WordPress Unknow Os - Pingback on 2012/04/25/ 20:06