开发者

How can showing text in a post only for the author

In Wordpress , I w开发者_StackOverflow中文版ant when the author of the post reading his post showing text like' Delete Post , Edit Post , .... etc" only for the author not for all users.

First: I want to know the id of user login Second: I want to know the id of author .. Then:

if($user_id_login == $id_author){
echo 'Delete Post , Edit Post ... etc';
}

but from where do I get the $user_id_login and $id_author values?


Something like this:

if ( is_user_logged_in() ){
    global $current_user;
    get_currentuserinfo();
    if( $current_user->ID == $post->post_author ){
        echo "<a href='#'>edit</a>";
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜