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 use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.