ACF – Post Object

<ul id="widgets">
	<?php	
	global $post;
	$term_name = get_post($post) -> slug;
	
	$args = array( 
		'posts_per_page' => -1, 
		'post_type' => 'page'
	);
	
	$widgets = get_posts( $args );
		
	foreach ( $widgets as $post ) : setup_postdata($post);
	
	$widget_content = get_post_meta($post->ID,'widget_page_display',true); // must be inside loop -- this is the Post Content field
	
	if ($widget_content != '') { // If there is Post Content data relative to the post being displayed; show the post
		
	?>
		<li>
			<a href="<?php the_permalink(); ?>">
				<div class="widget_outline">
					<img src="<?php bloginfo('stylesheet_directory'); ?>/img/bar_left.png" class="bar_left" />
					<?php the_post_thumbnail(); ?>
					<div class="widget_content">
						<h3><?php the_title(); ?></h3>
						<?php echo the_field('widget_content'); ?>
					</div>
					<img src="<?php bloginfo('stylesheet_directory'); ?>/img/bar_right.png" class="bar_right" />
				</div>
			</a>
		</li>
	<?php } endforeach; wp_reset_postdata(); ?>	
</ul>

 

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.