WP-PostURL

 

[ 中文 ]

[ Description ]

 

This plugin allows you to insert a user specific text at the beginning and/or ending of all your posts. The text can be a copyright declaration,
advertisement codes, etc. HTML codes are allowed.
You can select which pages (home/single/feed/category/tag/archive page) to display the specific text. You also can decide which posts display the text.

It accepts following macros in user specific text:

  • %site_url% – the URI of your site
  • %site_name% – the name of your site
  • %post_url% – the URI of the post where the text is displayed
  • %post_title% – the title of the post where the text is displayed

If the header text is not empty, it will be inserted to the head of your posts; otherwise no head text will be inserted.

If the footer text is not empty, it will be inserted to the foot of your posts; otherwise no footer text will be inserted.

You can choose which pages to display the header text and/or footer text. It includes:

  • Blog Home – the header/footer text will be displayed on blog home
  • Page – the header/footer text will be displayed on pages
  • Category – the header/footer text will be displayed on category
  • Tag – the header/footer text will be displayed on tags
  • Archive – the header/footer text will be displayed on archives
  • Single – the header/footer text will be displayed on single
  • Feed – the header/footer text will be displayed in feed

When you add a new post, you can decide whether or not to add the header text and/or footer text to this post. You do this by selecting “Add Post URL?” option in the editor page. This option is saved as a Custom Field, named “posturl_add_url”.

For posts without this Custom Field (i.e., the existed posts before you use WP-PostURL 2.1.0 plugin), you can define the default behavior. If you select “Add Header and/or Footer For Old Posts”, then all posts without this Custom Field will be added the header text and/or footer text; otherwise those posts will not be added the header text and/or footer text.

If you don’t want to help promote WP-PostURL plugin, you can uncheck this checkbox. The credit of WP-PostURL will not be displayed.

I want to thinks Lester “GaMerZ” Chan, the author of WP-PageNavi. Most codes of this plugin are derived from his WP-PageNavi plugin.

I also want to thanks QingFeng, he implement the first version of post url control in his post (zh_CN).

 

[ Installation ]

 

Goto WordPress.org to download WP-PostURL.

  1. Upload whole wp-posturl directory to the /wp-content/plugins/ directory;
  2. Activate the plugin through the ‘Plugins’ menu in WordPress;
  3. Goto “Setting –> Add Post URL” page to define your user specific text and other options. The default setting is suitable for most of the usage;
  4. When you new a post, you can change “Add Post URL?” option in the editor to decide whehter or not adding the header/footer text for this post.

You can completely uninstall WP-PostURL plugin. It will remove all the option settings created by this plugin, and deactive this plugin at the same time.

 

[ Screenshot ]

 

Post Example When WP-PostURL Works
Post Example When WP-PostURL Works

WP-PostURL Option Page (Part 1)
WP-PostURL Option Page (Part 1)

WP-PostURL Option Page (Part 2)
WP-PostURL Option Page (Part 2)

Add Post URL Option When New/Edit Post
Add Post URL Option When New/Edit Post

Frequently Asked Questions

Why my setting changes when I re-install/re-activate the plugin

In release 2.1.0, the “Add Header and/or Footer Text For Old Posts” option
will always be enabled when you re-install/re-activate the plugin. The reason
is to fix the issue in release 2.0.x series. In release 2.0.x, this option is
not defined because of WordPress behavior changes for plugin updating.

Why WP-PostURL Does Not Add Text To My Posts

  • In a word, please check if you select “Add Header and/or Footer Text For Old Posts” option. If not, select it then have a look.
  • Please check “Add Post URL?” option for posts you want the text to be added.
  • If it still not work, make sure regenerate the cache if you use a WordPress
  • Cache Plugin (such as WP Super Cache), then have a look.

Here are some detail information for “Add Header and/or Footer Text For Old
Posts” option:

In release 2.0 and above, I add a new feature: allow user decide which posts
display the header and/or footer text. This will add a Custom Field, named
“posturl_add_url”, for each new created post.

But for the posts you published before use WP-PostURL 2.0+, they do not have
Custom Field “posturl_add_url”. For those posts, you need configure “Add
Header and/or Footer Text For Old Posts” option. If you check this option,
all existed posts will be added the header and/or footer text; otherwise those
posts will not be added the header text and/or footer text. If some of those
posts are against with this default behavior, you need to re-edit this post to
set “Add Post URL?” option for those special posts.

Changelog

2.1.0

The following change list is against version 1.1:

  • Fix: Set “Add Header and/or Footer For Old Posts” to true by default, to fix no header/footer in release 2.0.x. If you uncheck this option but re-install or re-activate this plugin, you need configure it again. The problem in 2.0.x is because of a WordPress behavior changes. Link: Plugin activation hooks no longer fire for updates
  • New: Add single post control function, allow user control which posts display the user specific text.
  • New: Add default post control behavior for old posts.
  • New: Keep compatible with QingFeng’s origin change of post control function.

2.0.2

  • (This version is obsolete)

2.0.1

  • (This version is obsolete)

2.0

  • (This version is obsolete)

1.1

  • New: Allow user select which pages display the user specific texts.
  • New: Allow user define the header text or footer text, or both.
  • Fix: Fix configuration data lost when deactivated then activated again

1.0

  • New: The basic function

[ English ]

 

[ 插件描述 ]

 

本插件允许你在所有文章的开头和结尾处插入一段自定义的文字。这段文字可以是你的版权声明,也可以是广告,或者其它文字。你可以在指定页面中显示这段文字。也可以指定哪些文章显示或不显示这段文字。

安装完插件后,你可以自由编辑你的用户自定义字符串。自定义字符串允许使用HTML语句,请参考插件提供的缺省字符串。另外,你还可以在自定义字符串中使用下面的变量:

  • %site_url% – 站点的URL链接
  • %site_name% – 站点的名字
  • %post_url% – 显示这段内容的文章的URL链接
  • %post_title% – 显示这段内容的文章的标题

如果”header文本”不为空,那么这段文字将被插入到文章的开头;否则不在文章开头处插入。

如果”Footer文本”不为空,那么这段文字将被插入到文章的结尾;否则不在文章结尾处插入文字。

你可以选择在哪些页面中显示你自己定义的文字,这些页面可以是:

  • 博客首页 – 你的自定义文字会在博客首页中显示
  • Page页面 – 你的自定义文字会在类型为”Page”的文章中显示
  • 分类页面 – 你的自定义文字会在分类页面中显示
  • 标签页面 – 你的自定义文字会在标签页面中显示
  • 归档页面 – 你的自定义文字会在归档页面中显示
  • 单篇文章 – 你的自定义文字会在单篇文章中显示
  • Feed – 你的自定义文字会在所输出的Feed中显示

在你新建或编辑文章时,你可以决定这篇文章是否显示你自定义的文字。这可以通过编辑页面中的“添加文章链接?”选项来控制。此选项将为你的文章增加一个名为“posturl_add_url”自定义字段。

对于那些没有这个自定义字段的文章(这些文章可能是在你使用WP-PostURL 2.1.0插件前发表的),你可以定义缺省是否为这些文章显示你自定义的文字。如果你选择了“给以前发表的文章添加自定义文本”,那么将会为这些文章显示你自定义的文字;反之,则缺省不显示。如果某些文章和此缺省定义不符,你需要重新编辑这些文章,设置其“添加文章链接?”选项,来选择是否为该文章显示这段文字。

如果你不想帮助推广WP-PostURL插件,你可以不选择这一项,这样就不会显示WP-PostURL插件的信息了。

使用中还有什么疑问,请在此页留言。

在此,我要感谢Lester “GaMerZ” ChanWP-PageNavi的作者。本插件的大部分代码都源自于他的WP-PageNavi。这就是开源的好处,你不用从头开始实现你的作品。

我也要感谢晴枫,他在他的文章中实现了文章控制选项的一个简易版本,尽管我没有采用他的代码,但还是要感谢他的努力。在版本2.0.1中,WP-PostURL也兼容了晴枫的修改。

 

[ 安装方法 ]

 

WordPress.org上下载WP-PostURL插件。

  1. 上传整个wp-posturl目录到/wp-content/plugins/目录
  2. 到WordPress后台管理页面中激活插件,插件的名字是Add Post URL
  3. 设置-->添加文章链接页对插件进行配置。缺省配置已经可以满足大多数需求。
  4. 在发表或编辑文章时,通过更改“添加文章链接?”选项,控制此文章是否显示自定义的文字。

如果你想完全卸载本插件,也需要在设置-->添加文章链接选择卸载,这会完全删除WP-PostURL插件所添加的配置选项,并自动停用此插件。

 

 

[ 屏幕抓图 ]

点击这里

常见问题

为什么重新安装/重新激活插件时配置会改变

在2.1.0版本中,”给以前发表的文章添加自定义文本”选项在你重新安装或激活插件时会始终处于使能状态。这样做是为了解决在2.0.x系列版本中此选项没有被默认选中的问题。

为什么插件没有给我的文章添加自定义文本

  • 首先,请检查“给以前发表的文章添加自定义文本”是否选中,如果没选中,请选中再试。
  • 另外请检查此文章的“为文章添加链接?”选项是否为“是”。
  • 如果你使用了WordPress的缓存插件(例如,WP Super Cache),请重新生成缓存。

修订日志

2.1.0

下列修改是跟1.1版本相比较的修改:

  • 修正: 缺省使能”给以前发表的文章添加自定义文本”。这个选项会在你重新安装或重新激活插件时自动使能,所以如果你想禁止此选项,请重新配置。这样做的目的是为了解决在2.0.x系列中该选项没有缺省值所导致的问题。在最新的WordPress版本中,升级插件时不会自动调用”Activation”回调函数,导致此问题。关于WordPress的修改,请见 Plugin activation hooks no longer fire for updates
  • 新增: 允许用户控制单篇文章是否显示用户的自定义文本
  • 新增: 允许用户选择是否为所有的旧文章添加自定义文本
  • 新增: 兼容晴枫对插件的修改

2.0.2

  • (不要用此版本)

2.0.1

  • (不要用此版本)

2.0

  • (不要用此版本)

1.1

  • 新增: 允许用户选择在哪些页面上显示用户的自定义文本
  • 新增: 允许用户定义header文本,或footer文本,或两者都定义
  • 修正: 解决重新激活插件时配置丢失的问题

1.0

  • 新增: 基本功能

“WP-PostURL”的84个回复

  1. 大哥,这个插件安装后并没有设置的按键 请问怎样能做到http://witmax.cn/wordpress-add-post-url.html他这个效果

  2. 非常好用!非常感谢!!以前试着插代码,总是不显示,找了好多款插件也有错误提示,只有你这款是最棒的!
    再次拜谢!

  3. 前不久一直在找这种插件,都不知道该用什么词搜,居然不小心在别人的博客上看到有人用这个插件,才发现这个好东东

  4. hi,这个非常非常实用,除了添加版权声明外,我还把它用来控制页面广告位。但是Header部分广告位会低于文章内容一行,如何解决?

  5. 很好用的插件,比那些加入代码的强多了。非常感谢。想请教如何修改文字,我想添加一些文字,我的博客还做不到篇篇都是原创,转载的就不能标注了。谢谢

  6. 新版WP-PostURL插件有一个小小的bug。
    如果wordpress没有安装在根目录,而是安装在一个指定的目录,则站点地址会显示错误。比如站点为www.fengbook.cn,wordpress安装地址为/wordpress目录,激活插件后会发现站点显示的地址是www.fengbook.cn/wordpress,而不是www.fengbook.cn。
    ——当然,WP后台设置的“WordPress 地址(URL)地址”为http://www.fengbook.cn/wordpress,“站点地址(URL)为:http://www.fengbook.cn

  7. 我也有和 @知然 一样的需求,需要获得文章作者昵称、在没昵称的情况下获得 注册名 的变量参数。
    虽然 网上有很多方法和插件 在文章中插入 作者信息的的功能,但是似乎都没有 文章控制选项 ,这样会大量出现 管理员发布的转载内容也出现管理员信息

  8. @Paul
    Hi Paul, I’ll add a new feature in future release which allow you select if adding post URL for a specific post. Current you can not do this if you don’t modify the plugin by yourself.

  9. Your plugin works really well. I am trying to use it to automate adding a ‘call to action’ at the bottom of posts as many of them are guest posts. My problem is that where I have placed it manually previously it ends up doubling up. Is there any way to only add footers to future posts and not ones written in the past?

  10. 你好,我用了你插件有一段时间了,很喜欢这个插件。
    有一个问题一直困扰我,请教一下如何实现:
    我的文章栏目有8个,其中2个栏目的文章是我原创的,我希望标记为原创的版权声明。另外六个是转载的,我需要一个另外的版权声明,说不说是原创的。
    不知道这样的功能如何实现?
    我不懂PHP,CSS等,自己猜测可能可以修改代码用if判断分类的id来实现,可是自己写不来,如果你方便的话,可否指导一下。
    谢谢!

  11. 你好,我在用着你设计的add-post-url这个插件,觉得很喜欢很方便。

    最近我将腾讯微博【一键转发】的代码放进去的时候,却发现到会有少许的bug。
    一键转发的代码在 http://open.t.qq.com/apps/share/explain.php

    你可以自行测试一下,那就是:在IE下可以成功一键转发,但是在谷歌浏览器底下,链接、图片等设置都消失了,原因是:

    我发现到,原来问题就出在:你的插件将这一句
    http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic;

    改成
    http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic;

    然后IE在解析的时候似乎自动将多出来的这些代码【#038;】去掉了,所以能够正常转发到微博去,但是谷歌浏览器却因为这些冗余的代码而出错

    请看看能不能解决这个问题,谢谢你

  12. 峄峰 :虽然一般都是采用 cc 协议授权,但有时候一些博文还是想要保留版权的,我建议增加一个功能,允许在每篇文章发表时设定是否显示预设的内容,就像 Sociable 有一个 Disable Sociable 选项一样,你可以参考下,谢谢了!

    期待这个功能,博客有很多共享的文章,总不能也注明自己的版权吧!

  13. 虽然一般都是采用 cc 协议授权,但有时候一些博文还是想要保留版权的,我建议增加一个功能,允许在每篇文章发表时设定是否显示预设的内容,就像 Sociable 有一个 Disable Sociable 选项一样,你可以参考下,谢谢了!

  14. 谢谢作者,在WordPress跟着链接过来的,请问下这个插件能不能做成按照不同的category的post添加不同的文字的功能的,我不是用这个插件来增加版权信息,我是用来推广,如果能在不同的category的情况下发布不同的文字,对我来说更容易进行产品推广,也有利于seo,个人的一点建议。
    谢谢!

  15. 怎么用不了??
    下载,启用了。但是在后台设置
    第3步的时候。到设置–>添加文章链接页对插件进行配置。
    就该页无法显示~~~晕~~~~

  16. @Chuck G
    Hi Chuck,

    You can modify file wp-posturl.php, in “function wp-posturl”, change the line:

    if (is_single()) {

    to

    if (is_single() || is_home() || is_feed()) {

    Then the URL will be output on main index page and feed. Please don’t hesitate to tell me if you have any problem.

  17. Great plug-in! It would be helpful to include the same url in the “main index” template of WP, not just in the “single post.” Is there an easy way to do this with your plug-in?

    Thanks,

    Chuck

  18. 感谢你的插件,呵呵。。

    不过你的英语部分一个词错了,你说感谢的时候用了”Thinks”,应该是“Thanks”。。。呵呵。。

  19. Hi this plug-in is great. Thank you very much for making it available to all bloggers.

    One suggestion, it would be most useful to have two blocks of text to be inserted. Use case is that the first block being inserted in the beginning, e.g. bio of author; and the copyright and contact at the end.

  20. @流星
    一般情况下,不建议在文章中间插入版权信息,因为会使用户体验不好。
    另外,如何在文章中间插入也是个问题。
    如果完全由插件自动插入,有可能插入到语句中间,文章变得难读。
    如果由作者在文章中使用特殊字符来插入版权信息倒是可以,比如,在准备插入版权信息的地方,加上%wp-posturl-copyright%。不过在输出feed时,也需要处理这个特殊标记。
    我先调查一下有这种需求的人多不多,如果很多人需要,就把它加进来。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注