Custom Field Suite 関連ポスト

SOLでイベントレポートなどに関連商品を出す方法

フィールドで関連ポストを作成。

入力の際ポスト選択

カスタムポストもできるようだ。

ループ方法

まずフォーチで出すのが基本らしいが

■ サンプル
<?php
$r_posts = $cfs->get('related_post');
if ($r_posts) :
  echo '<ul>'.PHP_EOL;
  foreach ($r_posts as $post_id) :
    $post_obj = get_post($post_id);
?>
    <li><?php echo esc_html($post_obj->post_title); ?></li>
<?php
  endforeach;
  echo '</ul>'.PHP_EOL;
endif;
?>

welcartのため
すでにごちゃごちゃと
フォーチを書いて さらにhave postで出力するのが基本なため
usces_the_item();のセット方法がふぉーちで未定 わからないまだ

なので

$r_posts = $cfs->get('kanren');

から投稿IDを抜き出す。

それを
post__inに代入 の方法でクリア

<?php
$r_posts = $cfs->get('kanren');
if ($r_posts) :
?>

    
<div class="top_titol" style="font-size:24px;">関連商品</div>

    <div class="top_new_item_all">



<?php
endif;
?>

<?php
 query_posts(array('post__in' => array($r_posts[0],$r_posts[1],$r_posts[2],$r_posts[3],$r_posts[4],$r_posts[5],$r_posts[6],$r_posts[7],$r_posts[8],$r_posts[9],$r_posts[10]
 ),'orderby' => 'title', 'order' => 'ASC')); ?>
<?php
if ( have_posts () ) :
    while ( have_posts() ) :
        the_post();
		 usces_the_item();
?>

   <?php if ( usces_is_item() ) : ?> 
     
     <!--ITEM_box-->  
    <a href="<?php the_permalink(); ?>"><div class="top_new_item_box">
      <div class="top_new_item_sam">
      
      <?php
//商品画像
usces_the_itemImage(0, 180, 275); ?>
      </div>
      
      <div class="top_item_name"><?php the_title(); ?></div>
      <?php usces_have_skus(); ?>
      <div class="top_item_disp"><?php usces_the_itemPrice(); ?>円</span><span class="tax"><?php usces_guid_tax(); ?></span></div>
    </div></a>
  <!--/ITEM_box-->      
 <?php endif; ?> 
   
  <?php
    endwhile;?> 
     <br clear="all" />
 </div>
<?php
endif;
?> 

 <?php wp_reset_query(); ?>

最初はカンマ区切りのポストIDを入力しゲットポストめたで代入したが
コンマ区切りは1個目しか入らないようだった。
色々試行錯誤したが
上記以外に使用するのは無理だった、現在。