'post',
'paged' => $paged,
'meta_query' => array(
array(
'key' => '_is_featured', // Custom field key for featured posts
'value' => '1', // Value to indicate a featured post
'compare' => '=', // Compare for equality
'type' => 'NUMERIC' // Ensure numeric comparison
)
)
);
// Check if it's the first page
$is_first_page = ($paged == 1);
// If it's the first page, fetch featured posts and display carousel
if ($is_first_page) {
$query = new WP_Query($query_args);
// Check if there are any featured posts
if ($query->have_posts()) :
?>
have_posts()) : $query->the_post();
$featured_image = get_the_post_thumbnail_url(get_the_ID(), 'full');
// Use default image if featured image is empty
$image_url = !empty($featured_image) ? $featured_image : $default_image_url;
?>
No featured posts found.';
endif;
// Reset post data
wp_reset_postdata();
}
// Fetch regular posts for the current page
$query = new WP_Query($query_args);
// Display regular posts
?>
have_posts()) :
while ($query->have_posts()) : $query->the_post();
?>