Support

Account

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