大家都知道,页面里太多外链是不太好的,但是链接总不能不上吧,那么内链转外链就是最佳选择!
以前也曾介绍过一些,这次呢,代码版,还挺好看的!
废话就不说了,直接把下面的代码保存到主题就好了!当然,你也可以修改一下,保存到根目录等,一些自己选择咯!(这不是废话吗?)
<?php
/*
Template Name: 链接跳转
*/
$guodu = get_post_meta($post->ID,"guodu", $single=true);
$false='false';
if ($guodu==$false){
$url = $_GET['url'];
Header("Location:$url");
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php $time=get_post_meta($post->ID,"time", $single=true); ?>
<meta http-equiv="refresh" content="2;url='<?php echo $_GET['url'];; ?>';">
<title>页面跳转ing - <?php bloginfo('name'); ?></title>
<style>
body{background:#000}.loading{-webkit-animation:fadein 2s;-moz-animation:fadein 2s;-o-animation:fadein 2s;animation:fadein 2s}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-o-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}.spinner-wrapper{position:absolute;top:0;left:0;z-index:300;height:100%;min-width:100%;min-height:100%;background:rgba(255,255,255,0.93)}.spinner-text{position:absolute;top:41.5%;left:47%;margin:16px 0 0 35px;color:#BBB;letter-spacing:1px;font-weight:700;font-size:9px;font-family:Arial}.spinner{position:absolute;top:40%;left:45%;display:block;margin:0;width:1px;height:1px;border:25px solid rgba(100,100,100,0.2);-webkit-border-radius:50px;-moz-border-radius:50px;border-radius:50px;border-left-color:transparent;border-right-color:transparent;-webkit-animation:spin 1.5s infinite;-moz-animation:spin 1.5s infinite;animation:spin 1.5s infinite}@-webkit-keyframes spin{0%,100%{-webkit-transform:rotate(0deg) scale(1)}50%{-webkit-transform:rotate(720deg) scale(0.6)}}@-moz-keyframes spin{0%,100%{-moz-transform:rotate(0deg) scale(1)}50%{-moz-transform:rotate(720deg) scale(0.6)}}@-o-keyframes spin{0%,100%{-o-transform:rotate(0deg) scale(1)}50%{-o-transform:rotate(720deg) scale(0.6)}}@keyframes spin{0%,100%{transform:rotate(0deg) scale(1)}50%{transform:rotate(720deg) scale(0.6)}}
</style>
</head>
<body>
<div class="loading">
<div class="spinner-wrapper">
<span class="spinner-text">LOADING...</span>
<span class="spinner"></span>
</div>
</div>
</body>
</html>
保存好了,添加一个页面就好了!使用方法就是地址后面加get数据 ?url=
猴赛雷。。。
2015年4月7日 20:10为毛审查元素都看不到你的文章内容?使用方法给个例子嘛。
2015年4月4日 16:52表示自己看的到……
2015年4月4日 16:57本人目前使用的是一款名叫anylink的插件,全自动转换,包裹之前的文章,个人觉得比代码方便。
2015年4月4日 12:38其实你可以直接function中设置,链接全都加上跳转
2015年4月4日 16:30那当然
2015年4月1日 16:01
2015年4月2日 12:48不错
2015年4月1日 09:36那当然
2015年4月1日 12:27哎呦,不错哦
2015年3月31日 21:00那当然
2015年4月1日 12:27不错!!!
2015年3月31日 09:57那当然
2015年4月1日 12:27这个挺不错的
2015年3月30日 18:41那当然
2015年4月1日 12:27这个已经用了
2015年3月30日 15:35你呢里很少看到外链
2015年4月1日 12:27嘿嘿
2015年4月1日 17:57这个方法挺好的,不过如果能够什么都不添加就更好了
2015年3月29日 23:06添加个php文件就好咯
2015年3月30日 12:51