Pobranie kategorii z acf Taxonomy field

<?php $term = get_sub_field('seasonal'); ?>
<?php if( $term ): ?>
	<span><?php echo $term->name; ?></span>
<?php endif; ?>

							<?php $term = get_sub_field('seasonal'); ?>
							<?php
							//	global $post;
								$args = array(
									'numberposts'   => 6,
									'category'      => $term->term_id,
								);
								$myposts = get_posts( $args );
								foreach($myposts as $post) : setup_postdata($post);
							?>

								<?php
									if (has_post_thumbnail( get_the_ID()) ):
			 							$image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'home-post' );
			 						endif;
			 					?>

								<a href="<?php the_permalink(); ?>" class="post">
									<figure style="background-image:url(<?php echo $image[0]; ?>)">
										<figcaption>
											<img src="<?php echo get_bloginfo('template_directory'); ?>/images/plus-ico.svg" alt="<?php _e('Read more', 'ZephyrPoint')?>" class="ico-more">
											<h5><?php echo $term->name; ?></h5>
											<div class="content-text">
												<h2><?php echo limit_words(get_the_title(), '4'); ?></h2>
												<p><?php echo limit_words(get_the_excerpt(), '8'); ?></p>
											</div><!-- /.text -->
										</figcaption>
									</figure>
								</a>
							<?php endforeach; wp_reset_query(); ?>

Agnieszka Trefler

Agnieszka Trefler (Ruda) - freelancer, web developer, specjalistka od WordPressa z Wrocławia. Z pasją budowania stron, blogowania i fotografowania. Twórca Inspiracji fotograficznych.