wordpress主题优化之-给wordpress增加翻页以及版权声明/修正版

现在说的是版权声明的增加方法,这个是基于象牙塔兄弟的文章修改而来,其实我用的是另外的源码,嘿嘿!
象牙塔说的是:编辑主题文件single.php,在<?php the_content(); ?>后面添加代码!
我的方法继续上面的定位法,因为我的主题找不到这个函数,额,也许我近视没看到,至少我搜素不到额,我用了上一篇文章wordpress主题优化之-给wordpress增加个性签名显示所说的定位法加上编辑器可视化效果的双重定位法定位了所在位置,我这里给出两个注释之间的代码仅供参考

<!-- entrymeta -->
<div class="entrymeta">
<div class="authorbio">
<div class="author_pic">
<?php echo get_avatar( get_the_author_email(), '48' ); ?>
</div>
<div class="clear"></div>
<div class="author_text">
<h4>作者: <span><?php the_author_posts_link('namefl'); ?></span></h4>
</div>
</div>
<span class="spostinfo">
<?php $custom_fields = get_post_custom_keys($post_id);
if (!in_array ('copyright', $custom_fields)) : ?>
<p><strong> 原创文章转载请注明出处: </strong>: <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_permalink() ?> | <?php bloginfo('name');?></a></p>
<?php else: ?>
<?php $custom = get_post_custom($post_id);
$custom_value = $custom['copyright']; ?>
<p><strong> 声明: </strong> 本文由<a href="<?php bloginfo('home'); ?>"> <?php the_author(); ?> </a>转自互联网:<a rel="nofollow" target="_blank" href="<?php echo $custom_value[0] ?>">原文地址</a>┃<a href="#" onclick="copy_code('<?php the_permalink() ?>'); return false;">复制本文链接</a></p>
<?php endif; ?>
<span class="content_tag"><?php the_tags('关键字: ', ', ', ''); ?><br />个性签名:<?php the_author_description(); ?></span>
</span>
<i class="lt"></i>
<i class="rt"></i>
<div class="clear"></div>
</div>
<div class="entry_sb">
<i class="lb"></i>
<i class="rb"></i>
</div>
<!-- end: entrymeta -->

加上代码之后,在编辑文章的时候,用自定义栏目,写上copyright,右边填写地址,如下图!

wordpress主题优化之-给wordpress增加翻页以及版权声明/修正版

然后发布出去就可以看效果咯!自定义栏目如果没有显示,在编辑文章页面点击右上角的显示选项,然后点击自定义栏目即可
大家这里可以做下修改,这里只是我希望的样式,象牙塔提供的源码如下

<?php $custom_fields = get_post_custom_keys($post_id);
if (!in_array ('copyright', $custom_fields)) : ?>
<p><strong> 原创文章转载请注明出处: </strong>: <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_permalink() ?> | <?php bloginfo('name');?></a></p>
<?php else: ?>
<?php $custom = get_post_custom($post_id);
$custom_value = $custom['copyright']; ?>
<p><strong> 声明: </strong> 本文参考自 <a rel="nofollow" target="_blank" href="/go.php?url=<?php echo $custom_value[0] ?>"><?php echo $custom_value[0] ?></a> ,由(<a href="<?php bloginfo('home'); ?>"> <?php the_author(); ?> </a>) 整编。</p>
<p>本文固定链接: <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_permalink() ?> | <?php bloginfo('name');?></a></p>
<?php endif; ?>

呵呵,具体你们可以参考这个文章WordPress自定义个性化文章版权声明
好了,如果还有不懂的可以提问,我尽量解答,我再次再次的声明,PHP我不懂,我只会对比修改!

wordpress主题优化之-给wordpress增加翻页以及版权声明/修正版

您可以选择一种方式赞助本站

支付宝扫一扫赞助

微信钱包扫描赞助

目前评论:3   其中:访客  0   博主  0

  1. avatar yumanutong 5

    图片太小的话自己点击放大,呵呵

  2. avatar 大雄 0

    知更鸟底部的Copyright ©版权什么在那个文件修改?

    • avatar yumanutong 5

      @大雄 主题后台设置,SEO设置里面,或者自己写死foot.php

评论加载中...

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

图片 表情