slug;
}
$blog_reflection_home_one_what_new_bottom_cat_or_latest = get_theme_mod('home_one_what_new_bottom_cat_or_latest', 'latest');
if ($blog_reflection_home_one_what_new_bottom_cat_or_latest == 'latest') {
// The Query for what's new
$what_new_post_args = array(
'post_status' => 'publish',
'posts_per_page' => 6,
'order' => 'desc',
'orderby' => 'date',
'ignore_sticky_posts' => 1,
);
$what_new_post_query = new WP_Query($what_new_post_args);
} else {
$what_new_post_args = array(
'post_status' => 'publish',
'post_type' => 'post',
'posts_per_page' => 6,
'order' => $blog_reflection_what_new_post_order,
'orderby' => $blog_reflection_what_new_post_order_by,
'category_name' => $blog_reflection_what_new_post_category_slug,
'ignore_sticky_posts' => 1,
);
$what_new_post_query = new WP_Query($what_new_post_args);
}
if ($what_new_post_query->have_posts()) {
while ($what_new_post_query->have_posts()) {
$what_new_post_query->the_post();
// Get the category of specific post
$what_new_post_category = get_the_category();
$blog_reflection_what_new_post_category_link = get_term_link($what_new_post_category[0]);
// Get random color of post tag
$tag_colors = array(
'style-dark-green',
'style-red',
'style-blue'
); // Example colors, adjust as needed
$random_color = $tag_colors[array_rand($tag_colors)];
// Get post image URL
$what_new_post_img = (get_the_post_thumbnail_url(null, 'large')) ? get_the_post_thumbnail_url(null, 'large') : get_template_directory_uri() . '/assets/images/no-image.jpg';
$blog_reflection_post_thumbnail_id = get_post_thumbnail_id(get_the_ID());
if (get_the_post_thumbnail_url()) {
$blog_reflection_what_new_image_alt_text = get_post_meta($blog_reflection_post_thumbnail_id, '_wp_attachment_image_alt', true);
} else {
$blog_reflection_what_new_image_alt_text = 'No Image';
}
if (strlen(get_the_title()) > 5) {
// Trim to the first 5 characters and add ellipsis
$blog_reflection_what_new_bottom_post_title = substr(get_the_title(), 0, 20) . '...';
} else {
// If the title is less than or equal to 5 characters, display it as is
$blog_reflection_what_new_bottom_post_title = get_the_title();
}
?>