2016-05-26 30 views
0

我想將meta box字段拖入簡碼,但似乎無法獲得以下內容以將任何內容輸出到屏幕。有什麼建議麼?基本上我有一個圖庫ID的元框,客戶端只能輸入一個數字。我需要接下來將要投入gallery_ids這個數字=將Meta Box信息插入短代碼

<?php 
$galleryid = ''; 
if (have_posts()) : while (have_posts()) : the_post(); 
$galleryid = get_post_meta($post ->ID, '_cd_gallery_ID', true); 
endwhile; 
echo do_shortcode('[ngg_images gallery_ids=$galleryid display_type=photocrati nextgen_pro_horizontal_filmstrip)'); 
else: 
endif; ?> 

回答

0

我使其更難那麼它需要的是 - 下面的代碼工作完美..

<?php echo do_shortcode('[ngg_images gallery_ids="'.get_post_meta($post->ID, '_cd_gallery_ID', true).'" display_type="photocrati-nextgen_pro_horizontal_filmstrip"]'); ?>