功能介绍

感觉每次进入自己站点都对鼠标指针不满意,想换成二次元图片?炫酷图标?或者自定义成自己喜欢的模样,那就试试集成以下这个功能吧!

配置教程

首先利用宝塔或则FTP打开/inc/options下的admin-options.php文件把下面代码放在20行左右

  1. array(
  2. ‘id’ => ‘is_diy_mouse’,
  3. ‘type’ => ‘switcher’,
  4. ‘title’ => ‘鼠标指针美化’,
  5. ‘label’ => ‘启用后可自定义鼠标样式’,
  6. ‘default’ => false,
  7. ),
  8. array(
  9. “id” => “body_mouse_img”,
  10. “type” => “upload”,
  11. “title” => “普通指针图片”,
  12. ‘placeholder’ => ‘http://’,
  13. ‘button_title’ => ‘上传’,
  14. ‘remove_title’ => ‘删除’,
  15. “dependency” =>
  16. array(“is_diy_mouse”, “==”, ‘true’,)
  17. ),
  18. array(
  19. “id” => “hover_mouse_img”,
  20. “type” => “upload”,
  21. “title” => “链接指针图片”,
  22. ‘placeholder’ => ‘http://’,
  23. ‘button_title’ => ‘上传’,
  24. ‘remove_title’ => ‘删除’,
  25. “dependency” =>
  26. array(“is_diy_mouse”, “==”, ‘true’,)
  27. ),

最后在主题根目录下打开functions.php将以下代码放在最后即可

  1. //+———————————————————————-
  2. //| 鼠标指针美化
  3. //+———————————————————————-
  4. if (_cao(‘is_diy_mouse’)){
  5. add_action(‘wp_footer’, function () {
  6. $body_mouse_img=_cao(‘body_mouse_img’);
  7. $hover_mouse_img=_cao(‘hover_mouse_img’);
  8. echo <<<EOT
  9. <style>
  10. body {cursor: url($body_mouse_img), default;}
  11. a:hover{cursor:url($hover_mouse_img), pointer;}
  12. </style>
  13. EOT;
  14. }, 100);
  15. }