admin管理员组文章数量:1287790
Good day, everyone:
I want to make wordpress to add the user's id number behind the ref's link string, so that, for example
<div class="toolsbutton">
<a href="">go this page</a>
</div>
above code will be turning in to a link if the user id is 113 who clicked it, the address will become:
<a href="">go this page</a>
Or, if you know an alternative to do so, please also let me know.
Generally, the purpose will be that a user will be directed to a page that with unified address but there will be a number equal to his id attached behind. every time, someone click the same link, in same page, will have the same effect on each user. When a user click it, will be the CURRENT USER, who is a registered user.
If anyone could tell me if I could create the page at the same time (if not exist), will be terrific!
Thank You
Good day, everyone:
I want to make wordpress to add the user's id number behind the ref's link string, so that, for example
<div class="toolsbutton">
<a href="http://mysite/mysite/page-">go this page</a>
</div>
above code will be turning in to a link if the user id is 113 who clicked it, the address will become:
<a href="http://mysite/mysite/page-113">go this page</a>
Or, if you know an alternative to do so, please also let me know.
Generally, the purpose will be that a user will be directed to a page that with unified address but there will be a number equal to his id attached behind. every time, someone click the same link, in same page, will have the same effect on each user. When a user click it, will be the CURRENT USER, who is a registered user.
If anyone could tell me if I could create the page at the same time (if not exist), will be terrific!
Thank You
Share Improve this question edited Mar 6, 2013 at 22:39 Adam asked Mar 6, 2013 at 22:21 AdamAdam 1634 silver badges12 bronze badges 1- I resolved it by using a php snippet plugin with Joshc's method – Adam Commented Mar 7, 2013 at 15:37
1 Answer
Reset to default 2I guess maybe wp_get_current_user();
is what your looking for.
Something like this...
<?php $current_user = wp_get_current_user(); ?>
<a href="http://mysite/mysite/page-<?php echo $current_user->ID; ?>">go this page</a>
http://codex.wordpress/Function_Reference/wp_get_current_user
--
Actually I just re-read the question and maybe your not after the current user? You might want to elaborate the question more so we know the aim better.
本文标签: postsAdding a user39s ID behind the ltagt tag ref link address
版权声明:本文标题:posts - Adding a user's ID behind the <a> tag ref link address 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741324863a2372415.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论