0
我在循環之外,想調用自定義值「featvideo」並顯示它。如果沒有「featvideo」,則打印圖像...WordPress的自定義值如果/ ElseIf - 不起作用
視頻顯示,但是當沒有視頻時顯示空白框。你可以看到這裏的問題:http//wgl.buildthesis.com
(是的,$圖像中的functions.php和作品中定義的函數)
<?php
$feat_catbox_1 = new WP_Query("cat=$tt_feat_id&showposts=$tt_feat_postcount");
while ($feat_catbox_1->have_posts()) : $feat_catbox_1->the_post();
$key = 'featvideo';
$video_url = get_post_custom_values($key);
$featuredvideo = $video_url[0];
?>
<div class="contentdiv">
<div id="featured-thumb">
<?php if ($key=="featvideo")
echo $featuredvideo;
elseif ($key=="")
echo $images('1', '390', '244', 'alignleft', true); ?>
</div>
</div>
我跟着你。我刪除了$ key ='featvideo'; 並用您的代碼替換。請參閱:http://wgl.buildthesis.com 現在我得到一個空白屏幕。我知道我們很接近! – Greg 2009-12-12 03:13:53
格雷格對不起,刪除'$ key ='featvideo''並不像你測試它那麼重要,但從來沒有改變它。保持所有原始代碼相同,只需使用我的'if'語句而不是原來的代碼。 – 2009-12-12 03:17:06
明白了,只好把'echo $ images ...'改爲'echo images ...' 謝謝你的幫忙! – Greg 2009-12-12 03:23:38