#精品
将彩色边框代码添加到WordPress文章编辑器中

2021-08-01 0 1,287

将彩色边框代码添加到WordPress文章编辑器中

代码部署:

  • 编辑 WordPress 主题目录下的 functions.php 文件,添加如下代码:
  1. /*短代码信息框 开始*/
  2. function toz($atts, $content=null){
  3. return ‘<div id=”sc_notice”>’.$content.‘</div>’;
  4. }
  5. add_shortcode(‘v_notice’,‘toz’);
  6. function toa($atts, $content=null){
  7. return ‘<div id=”sc_error”>’.$content.‘</div>’;
  8. }
  9. add_shortcode(‘v_error’,‘toa’);
  10. function toc($atts, $content=null){
  11. return ‘<div id=”sc_warn”>’.$content.‘</div>’;
  12. }
  13. add_shortcode(‘v_warn’,‘toc’);
  14. function tob($atts, $content=null){
  15. return ‘<div id=”sc_tips”>’.$content.‘</div>’;
  16. }
  17. add_shortcode(‘v_tips’,‘tob’);
  18. function tod($atts, $content=null){
  19. return ‘<div id=”sc_blue”>’.$content.‘</div>’;
  20. }
  21. add_shortcode(‘v_blue’,‘tod’);
  22. function toe($atts, $content=null){
  23. return ‘<div id=”sc_black”>’.$content.‘</div>’;
  24. }
  25. add_shortcode(‘v_black’,‘toe’);
  26. function tof($atts, $content=null){
  27. return ‘<div id=”sc_xuk”>’.$content.‘</div>’;
  28. }
  29. add_shortcode(‘v_xuk’,‘tof’);
  30. function tog($atts, $content=null){
  31. return ‘<div id=”sc_lvb”>’.$content.‘</div>’;
  32. }
  33. add_shortcode(‘v_lvb’,‘tog’);
  34. function toh($atts, $content=null){
  35. return ‘<div id=”sc_redb”>’.$content.‘</div>’;
  36. }
  37. add_shortcode(‘v_redb’,‘toh’);
  38. function toi($atts, $content=null){
  39. return ‘<div id=”sc_orange”>’.$content.‘</div>’;
  40. }
  41. add_shortcode(‘v_orange’,‘toi’);
  42. /* 短代码信息框 完毕*/

使用方法

  • 在文章编辑时插入以下代码即可,注意”{“修改为”[“,”}”修改为”]”。
  1. {v_notice]绿色提示框[/v_notice}
  2. {v_error]红色提示框[/v_error}
  3. {v_warn]黄色提示框[/v_warn}
  4. {v_tips]灰色提示框[/v_tips}
  5. {v_blue]蓝色提示框[/v_blue}
  6. {v_black]黑色提示框[/v_black}
  7. {v_xuk]虚线提示框[/v_xuk}
  8. {v_lvb]绿边提示框[/v_lvb}
  9. {v_redb]红边提示框[/v_redb}
  10. {v_orange]橙边提示框[/v_orange}
  • 如不想每次都手动赶写代码也可为
收藏 (0)

微信支付 微信扫一扫

支付宝支付 支付宝扫一扫

打赏二维码
点赞 (0)

站长资源下载中心-找源码上汇站

常见问题
  • 如果付款后没有弹出下载页面,多刷新几下,有问题联系客服!
查看详情
  • 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
查看详情

相关文章

联系官方客服

为您解决烦忧 - 24小时在线 专业服务