开发者

wordpress plugin help

I have created a plugin where I am passing a variable through the url. The variable is the id of an item from the database. In the database I have a stored search engine friendly field that I could use to set the url but am lost as to how to do it. Example of the db:

id     sef           name
1      dogs-name     Dog's Name

Now when I am passing the variable in the url I am passing it by doing:

<a href="current-url/?id=<?php echo $id;?>">Link</a>

What I would like to do is something like this:

<a href="current-url/<?php echo $sef;?>">Link</a>

This would make for a much nicer url. However when I do that it doesnt work because wordpre开发者_运维技巧ss is sending me to the 404 page. Does anyone know if this is possible and can give me an example of how to do it? I looked into the pretty permalinks stuff but only found how to rewrite the urls made in wordpress and not coming from a plugin that is created. Is there a way to possibly add a variable for replacement through wordpress to be rewritten?

Any help is appreciated.


Do these links help?

http://wordpress.org/support/topic/using-an-extra-parameter-in-an-url

http://youngdutchdesign.com/rewrite-multiple-get-variables-for-wordpress-plugins

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜