其实真的不知道这个功能有什么用途,但是看到很多人提出来了,我想到这么个方法:
修改所使用的主题目录下的index.php文件,
找到这句,
复制内容到剪贴板
代码:
<h1 id="post-<?php the_ID(); ?>"><a href="<?php
the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php
the_title(); ?>"><?php the_title(); ?></a></h1>替换成,
复制内容到剪贴板
代码:
<?php
$id = intval($post->ID);
$link_to = $wpdb->get_var("SELECT meta_value FROM wp_postmeta WHERE meta_key = 'linkto' and post_id = $id");
?>
<?php if ($link_to) : ?>
<h1 id="post-<?php the_ID(); ?>"><a href="<?php echo $link_to; ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
<?php else : ?>
<h1 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
<?php endif; ?> 在写 文章时添加一个自定义字段,字段名写linkto,字段值写要跳转的网址(要写完整网址,即加http://的),就ok了。