Quantcast
Channel: 半瓶墨水 - 任中方 » wordpress
Viewing all articles
Browse latest Browse all 25

文章前加入作者名和本文链接

$
0
0

考虑到文章会被转载,在原创文章前面加入了作者和本文链接声明:

在代码(index.php):

<?php the_content(__('Read more'));?>

前面加入了

<?php $thetitle=the_title('', '', false) ?>
 
<?php if (strpos($thetitle, '转贴') === false) { ?>
    
<?php if (strpos($thetitle, '转载') === false) { ?>
      
<?php if (strpos($thetitle, 'zz') === false) { ?>
        
<?php if (strpos($thetitle, 'zt') === false) { ?>
          
<font color=#cccccc>
              作者:兔毛猫(2maomao.com)  链接:
<?php the_permalink() ?>
          
</font>
        
<?php } ?>
      
<?php } ?>
    
<?php } ?>
 
<?php } ?>

其中的条件判断提供了在转贴别人的文章时,不加入作者和本文链接声明的方法:
发表文章时在标题中加入’转贴’,”转载”,’zz’或者’zt都会自动去除该声明。

目前存在的问题:
1. 不会RSS中显示
这个做起来不难,修改rss.php应该就可以实现,但是还是算了,因为订阅RSS的用户,转载的时候都应该知道加原始链接吧。
而且订阅RSS本身就是为了方便,何必加个链接污染视野呢。

2. 有可能不是在标题开头出现转载,并且是原创帖
懒得改了,可以改成前两个字加冒号等等等等,这都不严重,而且很少见

Tags:[tag]转载, 转贴, zz, zt, 声明[/tag]


Viewing all articles
Browse latest Browse all 25

Latest Images

Trending Articles





Latest Images