-1

私はこのように達成しようとしています..投稿オブジェクトを2つのネストされたリピーターフィールド内のリピーターとして表示しようとしています..このリピーターと投稿オブジェクトを page-bagels.php というページテンプレートで使用しています。これらの 2 つのリピーターは、期待どおりの出力として 2 行を示しています。しかし、投稿オブジェクトは表示されていないか、値を返していません。むしろ、ページの値を返しています。私が使用したのと同じように、ページのタイトルを返し、投稿オブジェクトのタイトルを返しません。私のコードは以下の通りです

    <?php while ( have_posts() ) : the_post(); ?>

    <div class="main-content">
        <div class="main-wrap">


            <div class="col-sm-12">
                <div class="breadcrumbs">
                    <?php if(function_exists('bcn_display'))
                {
                    bcn_display();
                }?>
                  </div>  <!-- breadcrambs ends here -->

            </div><!-- col-sm-12 ends here -->


            <?php 

                // check for rows (parent repeater)
                if( have_rows('product_page') ): ?>

            <div class="col-lg-12 row product-row">

                <?php 

                    // loop through rows (parent repeater)
                    while( have_rows('product_page') ): the_row(); ?>

                <div class="col-sm-12">
                            <div class="marque">
                                <span class="brand-lg"><img src="<?php the_sub_field('brand_image'); ?>" /></span>
                            </div>
                        </div>


                <?php 

                            // check for rows (sub repeater)
                            if( have_rows('post_repeater') ): ?>




                <div class="col-sm-12 product-item-row">

                <?php 
                        // loop through rows (sub repeater)
                    while( have_rows('post_repeater') ): the_row();?>

                <div class="col-sm-3 product-item">


                     <?php
                        $postobject = get_sub_field('product_post'); ?>  

                    <a href="<?php $postURL = get_permalink($postobject->ID);?>">
                        <img class="product-img" src="<?php bloginfo('template_directory');?>/images/product-images/321600_moelleux_blanc_trepais.png" width="100%" />
                        <p class="product-name"><?php the_title();?></p>
                        <p class="product-seemore">See More</p>
                    </a>



                </div><!-- col ends here -->

                 <?php endwhile; ?>

                </div><!-- col Product Items row here -->

                <?php endif; //if( get_sub_field('items') ): ?>

                <?php endwhile; // while( has_sub_field('to-do_lists') ): ?>

            </div><!-- col lg 12 ends here or row ends here -->


            <?php endif; // if( get_field('to-do_lists') ): ?>

            <?php endwhile; // end of the loop. ?>  





                <div class="lnk-top">
    <a href="#"><span class="icon-arrow-up up-arrow"></span><br>Top</a>
</div>


        </div><!-- main wrap ends here -->

        <div class="clr"></div>

    </div><!-- main content ends here -->

したがって、このコードでは、投稿オブジェクトもリピーターであることがわかります。つまり、3 つのリピーターを使用していることを意味します。コードを見れば分かる

ここに私が得ている出力がありますhttp://ahsanurrahman.com/myprojects/cms/wp/gadoua/en/bagels/

そのため、どんな助けでも大歓迎です。

4

1 に答える 1