基本上,我正在尋找可能的最簡單代碼來解決此問題。當爲iframe src填充自定義字段時,我有一個填充的iframe。如果存在自定義字段,則顯示代碼/元素
基本上,我想如果自定義字段沒有填寫,iframe代碼完全消失。
這是這樣我就可以在彈出page.php文件的代碼和iframe,只顯示,如果自定義字段被填充。
<?php
$iframe_src = get_post_meta(get_the_ID(), 'iframe_src', true);
$iframe_height = get_post_meta(get_the_ID(), 'iframe_height', true);
$height = ($iframe_height == "" || !$iframe_height) ? 2650 : $iframe_height;
?>
<iframe SRC="<?php echo $iframe_src; ?>" WIDTH="100%" HEIGHT="<?php echo $height; ?>" frameborder="0" scrolling="no" name="content"></iframe>
'如果($ iframe_src = ''!){...}'? – putvande
對不起,我很新,我在哪裏放? – user3181828