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')):?> <?php $post_object = get_sub_field('game_name'); if( $post_object ): // override $post $post = $post_object; setup_postdata( $post ); ?> <div> <ul> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a</li> </ul> <span><?php the_sub_field('list_of_games'); ?></span> </div> <?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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.