在 Wordpress 中带有变量的 iframe?
Iframe with variable in Wordpress?
基本上我的 Wordpress 设置中的每个用户都在他们的个人资料中插入了一个 spotify 用户 link。
我需要在个人资料中用关注按钮显示他们的关注者(当然是前端)。
Spotify 有这个 iframe 可以插入关注按钮+关注者:
<iframe src="https://open.spotify.com/follow/1/?uri=spotify:artist:40Ojab0UtVQFjA76qXr8Ot?si=yL4xVXNtQSau6bHS5ACU7g&size=detail&theme=light" width="300" height="56" scrolling="no" frameborder="0" style="border:none; overflow:hidden;" allowtransparency="true"></iframe>
现在,此处的变量将是“40Ojab0UtVQFjA76qXr8Ot?si=yL4xVXNtQSau6bHS5ACU7g”,即用户在其个人资料(后端)中插入的 artist/user ID。
如何自动实现?
一个为每个用户更改此变量(艺术家 ID)的 iframe,从用户配置文件的字段中获取它?
提前致谢
我知道您可以在 iframe 中获取要更改的字符串。
<iframe src="https://open.spotify.com/follow/1/?uri=spotify:artist:".<?php echo $userId?>."&size=detail&theme=light" width="300" height="56" scrolling="no" frameborder="0" style="border:none; overflow:hidden;" allowtransparency="true"></iframe>
如果 $userID
变量没有保存的值...您需要从数据库中获取它。
$stringQuery = "here goes your query for getting the value limit 1";
$row = $wpdb -> get_results($stringQuery);
$userId -> $row -> Column;
然后显示你的 iframe
基本上我的 Wordpress 设置中的每个用户都在他们的个人资料中插入了一个 spotify 用户 link。
我需要在个人资料中用关注按钮显示他们的关注者(当然是前端)。
Spotify 有这个 iframe 可以插入关注按钮+关注者:
<iframe src="https://open.spotify.com/follow/1/?uri=spotify:artist:40Ojab0UtVQFjA76qXr8Ot?si=yL4xVXNtQSau6bHS5ACU7g&size=detail&theme=light" width="300" height="56" scrolling="no" frameborder="0" style="border:none; overflow:hidden;" allowtransparency="true"></iframe>
现在,此处的变量将是“40Ojab0UtVQFjA76qXr8Ot?si=yL4xVXNtQSau6bHS5ACU7g”,即用户在其个人资料(后端)中插入的 artist/user ID。
如何自动实现? 一个为每个用户更改此变量(艺术家 ID)的 iframe,从用户配置文件的字段中获取它? 提前致谢
我知道您可以在 iframe 中获取要更改的字符串。
<iframe src="https://open.spotify.com/follow/1/?uri=spotify:artist:".<?php echo $userId?>."&size=detail&theme=light" width="300" height="56" scrolling="no" frameborder="0" style="border:none; overflow:hidden;" allowtransparency="true"></iframe>
如果 $userID
变量没有保存的值...您需要从数据库中获取它。
$stringQuery = "here goes your query for getting the value limit 1";
$row = $wpdb -> get_results($stringQuery);
$userId -> $row -> Column;
然后显示你的 iframe