0

teSoマジックフィールドを介して複製グループからテキストと画像フィールドを出力しようとしています。テキストフィールドにはさまざまな複製が表示されますが、画像フィールドには最初の画像へのURLが繰り返し表示されます。誰かが私が間違っていることを教えてもらえますか?

<?php
$articlephotos="&amp;w=728&amp;h=560&amp;q=95&amp;zc=1&amp;iar=0&amp;far=0";
?>

<?php $myContents = get_group('contents'); // use the Custom Group name
  foreach($myContents as $contents){ ?>

<?php  if( get('contents_text', true) ) { ?>
<div class="contents"><?php echo $contents['contents_text'][1]; ?></div>
<?php } ?>

<?php  if( get('contents_image', true) ) { ?>
<div class="post_container" style="padding-bottom: 24px;">
<div class="photo_outside">
<div class="photo_inside">
<img src="<?php bloginfo('stylesheet_directory'); ?>/phpThumb/phpThumb.php?src=<?php echo get_image('contents_image',$contents,$contents,0); ?><?php echo $articlephotos ?>" title="<?php echo get_the_title($ID) ?>" alt="<?php echo get_the_title($ID) ?>">
</div><!-- end photos_inside -->
</div><!-- end photos_outside -->
</div>
<?php } ?>

<?php } ?>

前もって感謝します!

編集:Var Dump出力:

array(2){[1] => array(2){["contents_text"] => array(1){[1] => string(1085) "

テキスト01

"} [" contents_image "] => array(1){[1] => array(2){["original "] => string(122)" http://www.mysite.com/image01.jpg " ["thumb"] => string(122) "http://www.mysite.com/image01.jpg"}}} [2] => array(2){["contents_text"] => array(1) {[1] => string(1380) "

テキスト02

"} [" contents_image "] => array(1){[1] => array(2){["original "] => string(119)" http://www.mysite.com/image01.jpg " ["thumb"] => string(119) "http://www.mysite.com/image01.jpg"}}}}

テキストと画像のURLの内容を省略しました。

4

1 に答える 1

1

プラグインのグループから解決策を見つけました。助けてくれてありがとう!

<?php $elements = get_group('contents');
foreach($elements as $key => $element){                                      

if( get('contents_text', true) ) {
    echo '<div class="contents">';
    echo $element['contents_text'][1];
    echo '</div>'; 
}

$images = get_order_field('contents_text',$key);
foreach($images as $image){

if( get('contents_image', $key ,$image = true) ) {
    echo '<div class="photo_outside"><div class="photo_inside">';
    echo '<img src="' . get('contents_image', $key ,$image) .'">';
    echo '</div></div>';
    }

} } ?>
于 2012-10-12T19:27:35.493 に答える