wordpress添加文章短代码 按钮和彩色提醒框

把下面的代码复制后添加到functions.php文件

/*绿色提醒框*/
function toz($atts, $content=null){
return ‘<div id=”sc_notice”>’.$content.'</div>’;
}
add_shortcode(‘v_notice’,’toz’);
/*红色提醒框*/
function toa($atts, $content=null){
return ‘<div id=”sc_error”>’.$content.'</div>’;
}
add_shortcode(‘v_error’,’toa’);
/*黄色提醒框*/
function toc($atts, $content=null){
return ‘<div id=”sc_warn”>’.$content.'</div>’;
}
add_shortcode(‘v_warn’,’toc’);
/*灰色提醒框*/
function tob($atts, $content=null){
return ‘<div id=”sc_tips”>’.$content.'</div>’;
}
add_shortcode(‘v_tips’,’tob’);
/*蓝色提醒框*/
function tod($atts, $content=null){
return ‘<div id=”sc_blue”>’.$content.'</div>’;
}
add_shortcode(‘v_blue’,’tod’);
/*蓝边文本框*/
function toe($atts, $content=null){
return ‘<div class=”sc_act”>’.$content.'</div>’;
}
add_shortcode(‘v_act’,’toe’);
/*橙色文本框*/
function tof($atts, $content=null){
return ‘<div id=”sc_organge”>’.$content.'</div>’;
}
add_shortcode(‘v_organge’,’tof’);
/*青色文本框*/
function tog($atts, $content=null){
return ‘<div id=”sc_qing”>’.$content.'</div>’;
}
add_shortcode(‘v_qing’,’tog’);
/*粉色文本框*/
function toh($atts, $content=null){
return ‘<div id=”sc_pink”>’.$content.'</div>’;
}
add_shortcode(‘v_pink’,’toh’);
/*绿色按钮*/
function toi($atts, $content=null) {
extract(shortcode_atts(array(“href” => ‘http://’), $atts));
return ‘<a class=”greenbtn” href=”‘.$href.'” target=”_blank” rel=”nofollow”>’.$content.'</a>’;
}
add_shortcode(‘gb’ , ‘toi’ );
/*蓝色按钮*/
function toj($atts, $content=null) {
extract(shortcode_atts(array(“href” => ‘http://’), $atts));
return ‘<a class=”bluebtn” href=”‘.$href.'” target=”_blank” rel=”nofollow”>’.$content.'</a>’;
}
add_shortcode(‘bb’ , ‘toj’ );
/*黄色按钮*/
function tok($atts, $content=null) {
extract(shortcode_atts(array(“href” => ‘http://’), $atts));
return ‘<a class=”yellowbtn” href=”‘.$href.'” target=”_blank” rel=”nofollow”>’.$content.'</a>’;
}
add_shortcode(‘yb’ , ‘tok’ );
/*添加音乐按钮*/
function tol($atts, $content=null){
return ‘<audio style=”width:100%;max-height:40px;” src=”‘.$content.'” controls preload loop>您的浏览器不支持HTML5的 audio 标签,无法为您播放!</audio>’;
}
add_shortcode(‘music’,’tol’);

 

http://xzh.i3geek.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,请不要用于商业用途及非法用途,否则后果自负!
3. 如果你也有好源码或者教程,可以到审核区发布,分享有金币奖励和额外收入!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,默认解压密码为"qq301.com",如遇到无法解压的请联系管理员!
资源客是一个优秀的分享资源站,本站资源均为各位友友分享而来,特殊原创会标明如有侵犯版权等可联系删除

资源客 » wordpress添加文章短代码 按钮和彩色提醒框