如何仅显示对应于wordpress页面作者的ID的div框? [英] How can I display a div box with ID only for the corresponding author of the wordpress page?
问题描述
如何显示仅具有对应于wordpress页面作者的ID的div框?
How can I display a div box with ID only for the corresponding author of the wordpress page?
例如
当测试用户登录时,他应该看到一个id为"author"的div框.在他的帖子中(post/test2/).
when testuser is logged in he should see a div box with id="author" inside his post (post/test2/).
但是
如果另一个用户登录,则他不应看到id ="author"的div框.在帖子中(post/test2/).
if another user is logged in he should not see the div box with id="author" within the post (post/test2/).
有可能吗?不幸的是,我是一个初学者,不知道如何最好地解决问题.
Is there a possibility? Unfortunately I'm a beginner and don't know how best to approach the problem.
推荐答案
我是为管理员创建的,但我希望ID仅对帖子的作者可见.
i made it for the admin but i want the id to be visible only to the author of the post.
示例:
如果作者登录,他应该看到id = author的内容.
if the author is logged in he should see the content with the id=author.
但是
如果另一个用户登录,他应该看不到带有ID的内容.
if another user is logged in he should not see the content with the id.
/* hide role-specific div */
#author {
display: none;
}
body.logged-in.admin-bar #author {
/* Admin is logged in*/
display: flex;
}
这篇关于如何仅显示对应于wordpress页面作者的ID的div框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!