Home › Forums › Front-end Issues › Displaying a category ID › Reply To: Displaying a category ID
Hi @Debatewise
2 mian issues.
1. You are setting the variable $post_objects twice. Why?
2. I can’t see in your code where you are loading the category for.
The issue is this part right?
<!-- If the promo box is showing latest news or reports -->
<?php if(get_field('latest_news_or_reports', $post_object->ID) == "news"): ?>
<?php query_posts( array ('posts_per_page' => 5, 'order'=> 'DESC', 'orderby' => 'date', 'category__in' => '' ) ); ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<li class="title"><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
<?php endif; wp_reset_query(); ?>
<?php endif; ?><!-- News/Reports promoBox ENDS -->
If not, please correct me.
You have set
'category__in' => ''
Which I’m guessing you want to populate with a custom field value?
What is the name of the custom field that contains the category name?
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.