Support

Account

Home Forums General Issues Notice: Trying to get property of non-object Relationship field Reply To: Notice: Trying to get property of non-object Relationship field

  • Sure this is my templates’s Code.
    Thanks for taking the time to look at this.

    <div class="content__home content_page">
    
    	<div class="header__slider flexslider">
    		<ul class="slides">
    		<?php if(get_field('home_page_carousel_rep')): ?>
    			<?php while(has_sub_field('home_page_carousel_rep')): ?>
    			<li>
    			
    			<?php if(get_sub_field('home_page_carousel_link')): ?>
    				<a href="<?php echo get_sub_field('home_page_carousel_link'); ?>">
    			<?php endif; ?>
    			<?php if(get_sub_field('home_page_carousel_image')): ?>
    			<?php $image = get_sub_field('home_page_carousel_image'); ?>
    			<img src="<?php echo $image['url'] ; ?>" alt="<?php echo $image['alt'] ; ?>" title="<?php echo $image['title'] ; ?>" />
    			<?php endif; ?>
    			<?php if(get_sub_field('home_page_carousel_link')): ?>
    				</a>
    			<?php endif; ?>
    			
    			</li>
    			<?php endwhile; ?>
    		<?php endif; ?>
    		</ul>
    
    	</div>
    	<div class="internal__pages grid">
    	
    	<?php 
    	
    	$page_chooser = get_field('home_page_chooser_rep');
     
    	if( $page_chooser ): 
    
    	foreach( $page_chooser as $post): ?><?php setup_postdata($post); ?><div class="internal__pages__item grid__item one-quarter">
    			<a href="<?php the_permalink(); ?>">
    			<?php if ( has_post_thumbnail() ) : ?>
    			  <?php the_post_thumbnail(); ?> 
    			<?php endif; ?></a>
    		</div><!--
    		
    		--><?php endforeach; ?>
    	
    	<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    	
    	<?php endif; ?>
    
    	</div>
    	<hr />
    	<div class="grid two__col">
    	
    	<?php 
    	
    	$home_page_quick_links = get_field('home_page_quick_links');
     
    	if( $home_page_quick_links ): 
    
    	foreach( $home_page_quick_links as $post): ?><?php setup_postdata($post); ?><div class="grid__item one-half palm-one-whole">
    				<a href="<?php the_permalink(); ?>">
    			<?php if ( has_post_thumbnail() ) : ?>
    			  <?php the_post_thumbnail(); ?> 
    			<?php endif; ?></a>
    				<h2 class="single__title"><?php the_title(); ?></h2>
    			</div><!--
    	
    		--><?php endforeach; ?>
    	
    	<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    	
    	<?php endif; ?>
    		</div>
    	
    	<hr />
    
    	<?php while (have_posts()) : the_post(); ?>
    	  <?php the_content(); ?>
    	  <?php wp_link_pages(array('before' => '<nav class="pagination">', 'after' => '</nav>')); ?>
    	<?php endwhile; ?>
    </div>