Wordpress Plugin: Custom URL Shorter
本人写的第一个Wordpress的插件——Custom URL Shorter诞生了![]()
- 起因:最近突然一些原因要在自己的风云阁添加短地址链接,因此就萌生了写这个插件的想法。今天在工作的休息时间写了这个插件的第一个版本。
- 版本号:0.3.4。
- 功能:
- 可以在多个短地址服务中选取自己喜欢的服务进行使用,也可以选择列表中没有的服务
- 可以对链接文字进行设置
- 可以发布日志或者页面的时候通过
[cus]
来实现短域名链接生成
- 可以通过直接修改模板添加
<?php custom_url_shorter(); ?>
来实现短地址链接的生成
- 安装与使用
- 下载Custom URL shorter。
- 上传Custom URL shorter文件夹到你的插件目录下。
- 在WordPress后台插件菜单下激活Custom URL shorter。
- 转到Setting => Custom URL shorter,进行设置。
- 创建 WordPress 页面模板,在该模板中加入下面函数:
<?php custom_url_shorter(); ?>
或者创建新日志或者页面时,在内容中添加
[cus]
- 备注
- 本插件现在刚开始,有任何问题等,请与我联系。
目前插件正在向Wordpress.org提交中,提交完成后,下载链接将转至Wordpress.org的空间。
已提交Wordpress- 插件中提及到的adf.ly调用API是需要注册的,插件中使用的是本人的帐号所对用的API地址。如用户觉得不便的话,可以自行去注册后,在插件设置界面的自定义区,输入你的API地址来进行使用
- 下载:Custom URL shorter
- Changlog
= 0.3.3 =
* Confirmed compatibility with 3.0.1
Thanks to Den(denicocc@gmail.com)
Push








Hi, how i can Create a page template with function custom_url_shorter()?
Sorry i dont know how, you can helpme, please?
You can add the function called “custom_url_shorter” into the .php files of your wordpress template.
Hi and with this i redirecting to adf.ly?
@gpt
Ya! This plugin can create adf.ly short links of your posts.
@gpt
Click the “Skip ad” on the top-right corner!
i get this when trying to access wp-admin/options-general.php?page=CustomURLShorter
You do not have sufficient permissions to access this page.
can you help me.?
@QByte
Try “wp-admin/options-general.php?page=Custom%20URL%20Shorter”
@Iron_Feet
what is this file ?
@anonim
The files of your wordpress template.
I tried adding in index.php and singlepost.php of my template near the top of each file, but links aren’t changing.
Also added my own adf.ly api in the other url shortner spot, and didn’t work either.
Not sure how to get it working.
@Breck
This plugin will not change the link of your pages.
It just generate a short URL of your pages.
Hi, I got WP error trying to access the plugin setting page-’You do not have sufficient permissions to access this page’.
@Den
Hey there, sorry for my question regarding the page error. I got it solved just after I posted it. I edited your plugin to make it work for WP 3.01.
@Den
Oh~ Can you send me the patch file to show me the modification?
I hope I can commit it and add your name into acknowledgement list.
Thanks~
sure thing…after WP 3.0 the slug parameter is being changed from spaces to dashes. Wordpress get_plugin_page_hookname will remove all spaces on your slug parameter instead of leaving it.
so the parameter at line 161:
function cus_admin_actions()
;
{
add_options_page(“Custom URL Shorter”, “Custom URL Shorter”, 1, “Custom URL Shorter”, “cus_control”
}
changed to
function cus_admin_actions()
;
{
add_options_page(“Custom-URL-Shorter”, “Custom URL Shorter”, 1, “Custom-URL-Shorter”, “cus_control”
}
@Den
Thank you very much~
so when will you be releasing 3.0.1 version. i need it.
@x
This weekend~