首页 > CMS建站 > Wordpress > 正文

wodpress博客的评论外链加上跳转的方法

2020-06-10 12:53:10
字体:
来源:转载
供稿:网友

wodpress博客的评论外链已经是许多博主不可接受的一种程度了,我们下面来给各位介绍一篇把外连通过修改成跳转的连接了,这样不会影响到网站权重了.

昨天的时候修改了一下博客的评论里的外链,有外链转内链,折腾了一下博客,看看效果还行,下面分享一下.

模板function.php添加下面的代码:

  1. /**博客的评论里的外链转内链**/ 
  2. add_filter('get_comment_author_link','add_redirect_comment_link', 5); 
  3. add_filter('comment_text''add_redirect_comment_link', 99); 
  4. function add_redirect_comment_link($text''){ 
  5.   $text=str_replace('href="','href="'.get_option('home').'/goto.php?url='$text); 
  6.   $text=str_replace("href='","href='".get_option('home')."/goto.php?url="$text); //Cuoxin.com 
  7.   return$text

上面的代码其实就是把页面显示的链接都修改成http://www.Cuoxin.com/goto.php?url=【网站链接】

新建goto.php,放到跟目录下.

  1. <!doctype html> 
  2. <html lang="en"> 
  3. <head> 
  4. <meta charset="UTF-8"> 
  5. <meta name="Author" content=""> 
  6. <meta name="Keywords" content=""> 
  7. <meta name="Description" content=""> 
  8. <meta name="robots"content="noindex,nofollow"> 
  9.  
  10. <meta http-equiv="refresh"content="3;url=<?php $url=$_GET['url']; echo htmlspecialchars($url);?>"> 
  11. <title>跳转页面</title> 
  12. <style> 
  13. .spinner { 
  14. margin: 100px auto 0; 
  15. width: 150px; 
  16. text-align: center; 
  17.  
  18. .spinner > div { 
  19. width: 30px; 
  20. height: 30px; 
  21.  
  22.  
  23. border-radius: 100%; 
  24. display: inline-block; 
  25. -webkit-animation: bouncedelay 1.4s infinite ease-in-out; 
  26. animation: bouncedelay 1.4s infinite ease-in-out; 
  27. /* Prevent first frame from flickering when animation starts */ 
  28. -webkit-animation-fill-mode: both; 
  29. animation-fill-mode: both; 
  30.  
  31. .spinner .bounce1 { 
  32. -webkit-animation-delay: -0.32s; 
  33. animation-delay: -0.32s; 
  34. background-color: #428bca; 
  35.  
  36. .spinner .bounce2 { 
  37. -webkit-animation-delay: -0.16s; 
  38. animation-delay: -0.16s; 
  39. background-color: #Dd534F; 
  40.  
  41. .spinner .bounce3 { 
  42. -webkit-animation-delay: -0.01s; 
  43. animation-delay: -0.01s; 
  44. background-color: #67CF22; 
  45.  
  46. @-webkit-keyframes bouncedelay { 
  47. 0%, 80%, 100% { -webkit-transform: scale(0.0) } 
  48. 40% { -webkit-transform: scale(1.0) } 
  49.  
  50. @keyframes bouncedelay { 
  51. 0%, 80%, 100% { 
  52. transform: scale(0.0); 
  53. -webkit-transform: scale(0.0); 
  54. } 40% { 
  55. transform: scale(1.0); 
  56. -webkit-transform: scale(1.0); 
  57. </style> 
  58. </head> 
  59. <body> 
  60. <div class="spinner"> 
  61. <div class="bounce1"></div> 
  62. <div class="bounce2"></div> 
  63. <div class="bounce3"></div> 
  64. </div> 
  65. </body> 
  66. </html> 

搞定了,有问题请留言.

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选