Latest news from category

Hello!

This may be a premium support question. If so, I understand completely. I’m trying to only display posts from a specific category in the “Latest News” section. I know it has something to do with the post loop in the front_page_lates_news.php page, but I can’t seem to figure out exactly how to make the modification. Here is the code:


<?php $counter = 0; ?>
						<?php while ( $post_query->have_posts() ): ?>
							<?php $post_query->the_post(); ?>
							<?php $post_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'illdy-front-page-latest-news' ); ?>
							<a href="<?php the_permalink(); ?>">
							<div class="illdy-blog-post col-md-4 col-sm-6 col-xs-12">
								<div class="post" style="<?php if ( ! $post_thumbnail ): echo 'padding-top: 40px;'; endif; ?>">
									<?php if ( $post_thumbnail ): ?>
										<div class="post-image" style="background-image: url('<?php echo esc_url( $post_thumbnail[0] ); ?>');"></div>
									<?php endif; ?></a>
									<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="post-title"><?php the_title(); ?></a>
									<div class="post-entry">
										<?php the_excerpt(); ?>
									</div><!--/.post-entry-->
									<a href="<?php the_permalink(); ?>" title="<?php _e( 'Read more', 'illdy' ); ?>" class="post-button"><i class="fa fa-chevron-circle-right"></i><?php _e( 'Read more', 'illdy' ); ?>
									</a>
								</div><!--/.post-->
							</div><!--/.col-sm-4-->
							<?php $counter ++; ?>
							<?php if ( $counter % 3 == 0 ) { ?>
								<div class="clearfix"></div>
							<?php } ?>
						<?php endwhile; ?>

Thanks!
Brent

Hello Brent,

Before anything else, please have a look over here, it seems that there are quite some methods to get the information from some specific categories:

https://codex.wordpress.org/The_Loop

Let me know if the above got you sorted alright or you’d want me to do some further research about it.

Best regards