• 解決済 iguigu

    (@iguigu)


    必要な箇所だけ抜粋してます。
    advanced custom tools の repeaterをつかった下記のコードをループされる形でカテゴリテンプレ内に記載してます。
    記事ごとにタブが入っておりますので、一覧で各記事のタブが動くようにしたいのですが、現状の書き方ですと1番目しか動きません。

    どのように記述を変えれば一覧ページで記事ごとのタブが動くのでしょうか?

    自分で調べた限り eachを使うのではないかと思ったのですが、書き方がわかりません。。。
    初心者な質問ですいません。
    よろしくおねがいします。

    <!-- カテゴリテンプレ内 -->
     <div id="horizontalTab">
                <ul class="resp-tabs-list">
                <?php if( have_rows('tourdetail_depature') ): ?>
    		<?php while( have_rows('tourdetail_depature') ): the_row();
    			$tourdetail_depmidashi = get_sub_field('tourdetail_depmidashi');
    			$tourdetail_deptxt = get_sub_field('tourdetail_deptxt');
    			$tourdetail_title = get_sub_field('tourdetail_title');
    		?>
                    <li><?php echo $tourdetail_title; ?></li>
                    	<?php endwhile; ?>
    					<?php endif; ?>
    
                </ul>
                <div class="resp-tabs-container">
                <?php if( have_rows('tourdetail_depature') ): ?>
    		<?php while( have_rows('tourdetail_depature') ): the_row();
    			$tourdetail_depmidashi = get_sub_field('tourdetail_depmidashi');
    			$tourdetail_deptxt = get_sub_field('tourdetail_deptxt');
    			$tourdetail_title = get_sub_field('tourdetail_title');
    		?>
                    <div>
    
    	                <div class="selfRep">
    				  <div class="selfRepInner clear">
    					<div class="secLeft">	
    
    						<h4><?php echo $tourdetail_depmidashi; ?></h4>
    						<p><?php echo $tourdetail_deptxt; ?></p>
    
    										</div>
    
    						<div class="news_img">
    						<?php $tourimg = wp_get_attachment_image_src(get_sub_field('tourdetail_depimg'), 'news_img'); ?>
                    <img src="<?php echo $tourimg[0]; ?>" />
    	</div>
    
    									  </div><!--/.selfRepInner-->
    									</div><!--/.selfRep-->
    
                    </div>
                   	<?php endwhile; ?>
    					<?php endif; ?>
                </div>
            </div>
    
    <!-- ここからfooterの記述 -->
    <script src="<?php bloginfo( 'template_url' ); ?>/tabs/easyResponsiveTabs.js" /></script>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo( 'template_url' ); ?>/tabs/easy-responsive-tabs.css" />
    <script type="text/javascript">
    $(document).ready(function () {
    $('#horizontalTab').easyResponsiveTabs({
    type: 'default', //Types: default, vertical, accordion
    width: 'auto', //auto or any width like 600px
    fit: true, // 100% fit in a container
    closed: 'accordion', // Start closed if in accordion view
    });
    
    });
    </script>
1件の返信を表示中 - 1 - 1件目 (全1件中)
1件の返信を表示中 - 1 - 1件目 (全1件中)

トピック「easyResponsiveTabs の使い方」には新たに返信することはできません。