Support

Account

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?