空の領域

又一个坑爹的神站 大人說:要清爽 要低調

0%

给Wordpress若干短代码教程

本次主题完善活动应该也基本要告一段落了,主要的折腾对象应该就是这些吧,短代码这种众所周知的坑爹货,本来不是很喜欢的因为觉得不大合适,但用过之后才发现挺好的啦其实=w=

嘛如果有闲心的话还可以折腾更多点的不过目前在下觉得这么点已经用不过来了=x=||||

Chat这种扒皮成果当然不在本文里(他的地位高高在上好吗)

[task]=w=[/task]

\[noway\]=w=\[/noway\]

[buy]=w=[/buy]

[warning]=w=[/warning]

[Downlink href=http://xsky.me]download xxx.zip[/Downlink]

在收费主题方面,这货应该是标配才对吧,标配必然有标配的理由,能让你的博客颜色更鲜艳<(=→_→=)>(虽然也有变成黑白的冲动不过算了吧= =偶尔来点亮点也是好的)

嘛出处From:http://www.jianhui.org/add-a-short-code-form-for-your-wordpress-theme.html

首先毫无疑问的放进function.php里吧作为久经沙场的老将你懂的!

'; $return .= $content; $return .= '
'; return $return; } add\_shortcode('warning' , 'warningbox' ); //禁止 function nowaybox($atts, $content=null, $code="") { $return = '
'; $return .= $content; $return .= '
'; return $return; } add\_shortcode('noway' , 'nowaybox' ); //购买 function buybox($atts, $content=null, $code="") { $return = '
'; $return .= $content; $return .= '
'; return $return; } add\_shortcode('buy' , 'buybox' ); //项目版 function taskbox($atts, $content=null, $code="") { $return = '
'; $return .= $content; $return .= '
'; return $return; } add\_shortcode('task' , 'taskbox' ); //音乐播放器 function doubanplayer($atts, $content=null){ extract(shortcode\_atts(array("auto"=>'0'),$atts)); return ''; } add\_shortcode('music','doubanplayer'); //下载链接 function downlink($atts,$content=null){ extract(shortcode\_atts(array("href"=>'http://'),$atts)); return ''; } add\_shortcode('Downlink','downlink'); //flv播放器 function flvlink($atts,$content=null){ extract(shortcode\_atts(array("auto"=>'0'),$atts)); return''; } add\_shortcode('flv','flvlink'); //mp3专用播放器 function mp3link($atts, $content=null){ extract(shortcode\_atts(array("auto"=>'0',"replay"=>'0',),$atts)); return ''; } add\_shortcode('mp3','mp3link'); //在线视频 /\* 20120616 修复WP 3.4 官方中文版 的问题 function wp\_embed\_handler\_youku( $matches, $attr, $url, $rawattr ) { return apply\_filters( 'embed\_youku', '', $matches, $attr, $url, $rawattr ); } wp\_embed\_register\_handler( 'youku', '#http://v.youku.com/v\_show/id\_(.\*?).html#i', 'wp\_embed\_handler\_youku' ); function wp\_embed\_handler\_tudou( $matches, $attr, $url, $rawattr ) { return apply\_filters( 'embed\_tudou', '', $matches, $attr, $url, $rawattr );} wp\_embed\_register\_handler( 'tudou', '#http://www.tudou.com/programs/view/(.\*?)/#i', 'wp\_embed\_handler\_tudou' ); \*/ function wp\_embed\_handler\_ku6( $matches, $attr, $url, $rawattr ) { return apply\_filters( 'embed\_ku6', '', $matches, $attr, $url, $rawattr ); } wp\_embed\_register\_handler( 'ku6', '#http://v.ku6.com/show/(.\*?).html#i', 'wp\_embed\_handler\_ku6' ); function wp\_embed\_handler\_youtube( $matches, $attr, $url, $rawattr ) { return apply\_filters( 'embed\_youtube', '', $matches, $attr, $url, $rawattr ); } wp\_embed\_register\_handler( 'youtube', '#http://youtu.be/(.\*?)/#i', 'wp\_embed\_handler\_youtube' ); function wp\_embed\_handler\_56 ($matches, $attr, $url, $rawattr ) { return apply\_filters( 'embed\_56', '', $matches, $attr, $url, $rawattr ); } wp\_embed\_register\_handler( '56', '#http://player.56.com/v\_(.\*?).swf#i', 'wp\_embed\_handler\_56' ); function wp\_embed\_handler\_sohu( $matches, $attr, $url, $rawattr ) { return apply\_filters( 'embed\_sohu', '', $matches, $attr, $url, $rawattr ); } wp\_embed\_register\_handler( 'sohu', '#http://share.vrs.sohu.com/(.\*?)/v.swf#i', 'wp\_embed\_handler\_sohu' ); function wp\_embed\_handler\_6cn( $matches, $attr, $url, $rawattr ) { return apply\_filters( 'embed\_6cn', '', $matches, $attr, $url, $rawattr ); } wp\_embed\_register\_handler( '6cn', '#http://6.cn/p/(.\*?).swf#i', 'wp\_embed\_handler\_6cn' ); function wp\_embed\_handler\_letv( $matches, $attr, $url, $rawattr ) { return apply\_filters( 'embed\_letv', '', $matches, $attr, $url, $rawattr ); } wp\_embed\_register\_handler( 'letv', '#http://www.letv.com/player/(.\*?).swf#i', 'wp\_embed\_handler\_letv' ); function wp\_embed\_handler\_sina( $matches, $attr, $url, $rawattr ) { return apply\_filters( 'embed\_sina', '', $matches, $attr, $url, $rawattr ); } wp\_embed\_register\_handler( 'sina', '#http://you.video.sina.com.cn/api/sinawebApi/outplayrefer.php/vid=(.\*?)/s.swf#i', 'wp\_embed\_handler\_sina' ); ?>

然后下载图片素材,如果你不更改下面的css请放在主题目录/shortcode 内

[Downlink href=”https://img.codesky.me/download/shortcode.rar"\]素材pack\[/Downlink\]

然后css:

/*—Shortcode—*/
.shortcodestyle{margin:20px 0px;padding: 15px 15px 15px 80px;position: relative;-moz-box-shadow:0px 1px 2px rgba(0, 0, 0, 0.2); -webkit-box-shadow:0px 1px 2px rgba(0, 0, 0, 0.2); box-shadow:0px 1px 2px rgba(0, 0, 0, 0.2);border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-khtml-border-radius:5px;}
.shortcodestyle a{padding:0px;}
.shortcodestyle a:hover{background:none;border-radius:0px;-webkit-border-radius:0px;-moz-border-radius:0px;-khtml-border-radius:0px;}
.warning{background: url(shortcode/shortcode/bell.png) no-repeat scroll 15px 15px #FFEA97;border: 1px solid #E1B400;color: #9F6F26;}
.warning a{ color:#A84A1E;border-bottom:1px dotted #A84A1E;}
.warning a:hover{color:#A84A1E;border-bottom:1px solid #A84A1E; }
.noway{background: url(shortcode/shortcode/noway.png) no-repeat scroll 15px 15px #EFCEC9;border: 1px solid #BE1F1F;color: #820B0B;}
.noway a{ color: #F60;border-bottom:1px dotted #F60;}
.noway a:hover{color:#F60;border-bottom:1px solid #F60; }
.buy{background: url(shortcode/shortcode/buy.png) no-repeat scroll 15px 15px #EFF4D4; border: 1px solid #8FAD3D;color: #779B39;}
.buy a{color: #2b2b2b;border-bottom:1px dotted #2b2b2b;}
.buy a:hover{color:#2b2b2b;border-bottom:1px solid #2b2b2b; }
.task{background: url(shortcode/shortcode/clipboard.png) no-repeat scroll 15px 15px #E7E7E7; border: 1px solid #aaa;color: #333;}
.task a{ color: #4B7126;border-bottom:1px dotted #4B7126;}
.task a:hover{color:#4B7126;border-bottom:1px solid #4B7126; }
.shortcodestyle,.warning,.noway,.buy,.task p{text-indent: 0;}
.but_down { margin:10px 0}
.but_down a{float:left;display:block;background:transparent url(shortcode/shortcode/dlbutton.png) no-repeat left top;border:none;padding:0 0 0 60px;height:33px;font-family: ‘Century Gothic’,”Microsoft YaHei”, Trebuchet MS, Arial, Tahoma, sans-serif;color:#046BB0;text-decoration:none;text-shadow:0 1px 1px #fff;}
.but_down a span{float:left;display:block;background:transparent url(shortcode/shortcode/dlbutton.png) no-repeat right top;padding:0 10px 0 0;line-height:33px;cursor:pointer;}
.but_down a:hover{color:#E23A0A;text-shadow:0 1px 1px #fff;background:transparent url(shortcode/shortcode/dlbutton.png) no-repeat left top;border-radius:0px;-webkit-border-radius:0px;-moz-border-radius:0px;-khtml-border-radius:0px;}

这样就OK了,其他要修改添加仿制全都按照这个来就行了 PS:短代码根据个人需求添加就行了不必加太多东西


使用的时候在文章中插入类似于:

2013-02-02_130839

就行了=w=(啊喂节操)


然后接下来是全部的短代码如何插入的那啥和那啥:

(出了一点小小的问题,只好传送至:https://img.codesky.me/download/shortcode.txt


哈勒无法添加?——人品问题吧兼容性理论来说很好了= =|||

最后:下载面板请注意href内不要再创建超链接否则就挂了,嘛就是这样

欢迎关注我的其它发布渠道