如何在iframe中放入简码?

问题描述 投票:0回答:1

我有一个拼图的简码,但是对于我的wordpress文本区域来说太宽了。我想将简码放入可滚动或在新窗口中打开的iframe中(因此可能不需要iframe)。我不知道该怎么做。我试过在iframe的src =部分中使用do_shortcode('[h5p id =“ 4”]')和仅使用[[h5p id =“ 4”]',但我一直收到404错误。简码可以独立工作。感谢您的帮助。

wordpress iframe shortcode
1个回答
0
投票

您不必将其放在iframe中,将其包装在类上并设置其样式:

<div class="puzzle-wrapper">
  <?php echo do_shortcode( '[h5p id="4"]' ); ?>
</div>

并且在style.css中添加类似以下内容:

.puzzle-wrapper{
   min-width: 500px;
   max-width: 100%;
   overflow: scroll;
   height: 500px;
}
© www.soinside.com 2019 - 2024. All rights reserved.