Home › Forums › Backend Issues (wp-admin) › Post Object is showing random Posts, not the selected Post › Reply To: Post Object is showing random Posts, not the selected Post
Hi @jrstaatsiii
Thanks for the link. I can’t see any issues with your code, but perhaps the setup_postdata is not working correctly for some unknown reason.
Can you modify the code to not use the setup_postdata like so:
<?php if ( get_field('ssm_featured_course', 'options') ) { ?>
<?php $p = get_field('ssm_featured_course', 'options'); ?>
<div id="featured-course">
<div class="wrap">
<small>Featured Course</small>
<p class="faux-title"><a href="<?php echo get_permalink( $p->ID ); ?>"><?php echo get_the_title( $p->ID ); ?></a></p>
<?php if ( get_field('ssm_course_description', $p->ID) ) { ?>
<div class="course-description">
<?php the_field('ssm_course_description', $p->ID); ?>
</div>
<!-- end .course-description-->
<?php } ?>
<a class="button red" href="<?php echo get_permalink( $p->ID ); ?>">View Course</a>
</div>
<!-- end .wrap -->
</div>
<!-- end #featured-course -->
<?php } ?>
Does this work?
Thanks
E
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.