WordPress用户特定的iframe块

发布于 2025-02-02 19:43:00 字数 71 浏览 2 评论 0原文

我想构建一个网站,每个用户都有不同的iframe代码。因此,我想要一个页面,其中将显示不同的用户不同代码。是否可以? 提前致谢。

I want to build a website where for each user there will be different iframe code. So I want a page where for different user different code will be shown. Is it possible?
Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞陪衬 2025-02-09 19:43:00

是的,这是可能的。您检查用户是否已登录。如果登录,您将获得用户的ID。如果ID是一定值,请显示特定的iframe。

if ( is_user_logged_in() ):
    $current_user_id = get_current_user_id();
    if ( $current_user_id == 3 ):
        // iframe for user with id 3
    elseif ( $current_user_id == 4 ):
        // iframe for user with id 4
    else:
       // default view
    endif;
else:
    echo 'You need to be logged in';
endif;

Yes it is possible. You check if the user is logged in. If logged in, you get the ID of the user. If the ID is some value, display the specific iframe.

if ( is_user_logged_in() ):
    $current_user_id = get_current_user_id();
    if ( $current_user_id == 3 ):
        // iframe for user with id 3
    elseif ( $current_user_id == 4 ):
        // iframe for user with id 4
    else:
       // default view
    endif;
else:
    echo 'You need to be logged in';
endif;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文