Home Forums Add-ons Repeater Field Make (Sub_Field) Link to Post? Reply To: Make (Sub_Field) Link to Post?

  • okay, i set DEBUG_MODE to ‘TRUE’….and I do not get any Error or Debugging information on the page.

    Just so you know the Data results that I created in ACF are displaying & linking properly…but my page template loses its Sidebar, Footer, and the WordPress Admin Bar at the Top disappears (only on this specific page) — when I select Post_Object as the Field Type…it seems to only happen when I select Post_Object.

    Below is the code I used — I dont think this code is the issue, because even when I remove the entire code, it still doesnt show the sidebar, widget, and WP Admin bar….it only seems to happen when I select Post_Object in the sub field ACF settings: (in my case, “game_name” is set as Post_Object)

    <?php if(get_field('list_of_games')): ?>
      <?php while(has_sub_field('list_of_games')):?>
          $post_object = get_sub_field('game_name');
          if( $post_object ): 
          // override $post
          $post = $post_object;
          setup_postdata( $post ); 
           <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a</li>
              <span><?php the_sub_field('list_of_games'); ?></span>
            <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
        <?php endif; ?>
      <?php endwhile; ?>         
    <?php endif; ?>

    Any ideas?… :-/

    I appreciate your help. Thanks.