'date', 'order' => 'desc', 'number' => $top_category_display_number, ]); } else { $top_categories = get_categories([ 'include' => $top_selected_categories, 'orderby' => 'include', 'number' => $top_category_display_number, ]); } // If no categories are found, fetch random categories if (empty($top_categories)) { $top_categories = get_categories([ 'orderby' => 'rand', 'number' => $top_category_display_number, ]); } // Display the categories foreach ($top_categories as $top_category) { $icon_url = get_term_meta($top_category->term_id, 'icon_for_category', true); ?> <?php echo esc_attr($top_category->name); ?> <?php echo esc_attr($top_category->name); ?> name);?>

'post', 'orderby' => $latest_post_orderby, // Order by post count 'order' => $latest_post_order, // Descending order 'posts_per_page' => $latest_post_display_number, // Adjust the number of posts to show 'ignore_sticky_posts' => 1, ]; if (!empty($latest_post_category)) { $latest_post_query_args['category_name'] = $latest_post_category; } $latest_posts_query = new WP_Query($latest_post_query_args); if ($latest_posts_query->have_posts()) { while ($latest_posts_query->have_posts()) { $latest_posts_query->the_post(); $latest_post_random_color_array = array_rand($brighter_blog_tag_color, 1); // Get the post thumbnail or fallback image $latest_post_image = (has_post_thumbnail()) ? get_the_post_thumbnail_url(get_the_ID(), 'large') : get_template_directory_uri() . '/assets/images/no-image.jpg'; $brighter_blog_post_thumbnail_id = get_post_thumbnail_id(get_the_ID()); if (get_the_post_thumbnail_url()) { $brighter_blog_latest_post_image_alt_text = get_post_meta($brighter_blog_post_thumbnail_id, '_wp_attachment_image_alt', true); } else { $brighter_blog_latest_post_image_alt_text = 'No Image'; } if (strlen(get_the_title()) > 5) { // Trim to the first 5 characters and add ellipsis $brighter_blog_latest_post_title = substr(get_the_title(), 0, 35) . '...'; } else { // If the title is less than or equal to 5 characters, display it as is $brighter_blog_latest_post_title = get_the_title(); } ?>
<?php echo esc_attr($brighter_blog_latest_post_image_alt_text); ?>

'post', 'order' => $editor_pick_order, 'orderby' => $editor_pick_orderby, 'posts_per_page' => $editor_pick_display_number, // Fetch a single post 'ignore_sticky_posts' => 1, ]; if (!empty($editor_pick_post_category)) { $editor_pick_query_args['category_name'] = $editor_pick_post_category; } $editor_pick_post_query = new WP_Query($editor_pick_query_args); if ($editor_pick_post_query->have_posts()) { while ($editor_pick_post_query->have_posts()) { $editor_pick_post_query->the_post(); $editor_pick_random_color_array = array_rand($brighter_blog_tag_color, 1); // Get post thumbnail or fallback image $editor_pick_post_image = (has_post_thumbnail()) ? get_the_post_thumbnail_url(get_the_ID(), 'large') : get_template_directory_uri() . '/assets/images/no-image.jpg'; $brighter_blog_post_thumbnail_id = get_post_thumbnail_id(get_the_ID()); if (get_the_post_thumbnail_url()) { $brighter_blog_editor_pick_post_image_alt_text = get_post_meta($brighter_blog_post_thumbnail_id, '_wp_attachment_image_alt', true); } else { $brighter_blog_editor_pick_post_image_alt_text = 'No Image'; } if (strlen(get_the_title()) > 5) { // Trim to the first 5 characters and add ellipsis $brighter_blog_editor_pick_post_title = substr(get_the_title(), 0, 35) . '...'; } else { // If the title is less than or equal to 5 characters, display it as is $brighter_blog_editor_pick_post_title = get_the_title(); } ?>
<?php echo esc_attr($brighter_blog_editor_pick_post_image_alt_text); ?>

'post', 'order' => $trending_post_order, 'orderby' => $trending_post_orderby, 'posts_per_page' => $trending_post_display_number, // Fetch a single post 'ignore_sticky_posts' => 1, ]; if (!empty($trending_post_category)) { $trending_post_query_args['category_name'] = $trending_post_category; } $trending_post_query = new WP_Query($trending_post_query_args); if ($trending_post_query->have_posts()) { while ($trending_post_query->have_posts()) { $trending_post_query->the_post(); $trending_post_random_color_array = array_rand($brighter_blog_tag_color, 1); // Get post thumbnail or fallback image $trending_post_image = (has_post_thumbnail()) ? get_the_post_thumbnail_url(get_the_ID(), 'large') : get_template_directory_uri() . '/assets/images/no-image.jpg'; if (strlen(get_the_title()) > 5) { // Trim to the first 5 characters and add ellipsis $brighter_blog_trending_post_title = substr(get_the_title(), 0, 35) . '...'; } else { // If the title is less than or equal to 5 characters, display it as is $brighter_blog_trending_post_title = get_the_title(); } ?>


array(array('key' => 'video_url', 'compare' => 'EXISTS',),), 'category__in' => $brighter_blog_video_post_category, 'order' => $brighter_blog_video_order, 'orderby' => $brighter_blog_video_orderby, 'posts_per_page' => $brighter_blog_video_post_number,); $brighter_blog_video_post_query = new WP_Query($brighter_blog_video_post_args); ?>
have_posts()) : while ($brighter_blog_video_post_query->have_posts()) : $brighter_blog_video_post_query->the_post(); $brighter_blog_get_video_url = get_post_meta(get_the_ID(), 'video_url', true); $brighter_blog_video_post_category = get_the_category(); $cat_url = get_category_link($brighter_blog_video_post_category[0]->term_id); $brighter_blog_tag_color = array('style-dark-green', 'style-red', 'style-blue'); // Example colors, adjust as needed // Get the categories of the specific post if (!empty($brighter_blog_video_post_category)) { $custom_field_cat_color = get_term_meta($brighter_blog_video_post_category[0]->term_id, 'term_color', true); $random_color = $brighter_blog_tag_color[array_rand($brighter_blog_tag_color)]; } else { $custom_field_cat_color = ''; } $brighter_blog_video_post_img = (get_the_post_thumbnail_url()) ? get_the_post_thumbnail_url() : get_template_directory_uri() . '/assets/images/no-image.jpg'; $brighter_blog_get_video_icon = get_template_directory_uri() . '/assets/images/wave.svg'; // Get the post thumbnail ID $video_post_image_thumbnail_id = get_post_thumbnail_id(get_the_ID()); if(get_the_post_thumbnail_url()){ $video_post_image_alt_text = get_post_meta($video_post_image_thumbnail_id, '_wp_attachment_image_alt', true); } else{ $video_post_image_alt_text = 'No Image'; } // Get post date $post_date = get_the_date('Y-m-d'); // Extract year, month, and day $brighter_blog_what_new_year = get_the_date('Y'); $brighter_blog_what_new_month = get_the_date('m'); $brighter_blog_what_new_day = get_the_date('d'); // Get date URL $date_url = get_day_link($brighter_blog_what_new_year, $brighter_blog_what_new_month, $brighter_blog_what_new_day); $brighter_blog_video_right_title = wp_trim_words( get_the_title(), 5, '...' ) ?>

'post', 'order' => $in_focus_post_order, 'orderby' => $in_focus_post_orderby, 'posts_per_page' => $in_focus_post_display_number, // Fetch a single post 'ignore_sticky_posts' => 1, ]; if (!empty($in_focus_post_category)) { $in_focus_query_args['category_name'] = $in_focus_post_category; } $in_focus_post_query = new WP_Query($in_focus_query_args); if ($in_focus_post_query->have_posts()) { while ($in_focus_post_query->have_posts()) { $in_focus_post_query->the_post(); $in_focus_post_random_color_array = array_rand($brighter_blog_tag_color, 1); // Get post thumbnail or fallback image $in_focus_post_image = (has_post_thumbnail()) ? get_the_post_thumbnail_url(get_the_ID(), 'large') : get_template_directory_uri() . '/assets/images/no-image.jpg'; $brighter_blog_post_thumbnail_id = get_post_thumbnail_id(get_the_ID()); if (get_the_post_thumbnail_url()) { $brighter_blog_in_focus_post_image_alt_text = get_post_meta($brighter_blog_post_thumbnail_id, '_wp_attachment_image_alt', true); } else { $brighter_blog_in_focus_post_image_alt_text = 'No Image'; } if (strlen(get_the_title()) > 5) { // Trim to the first 5 characters and add ellipsis $brighter_blog_in_focus_post_title = substr(get_the_title(), 0, 35) . '...'; } else { // If the title is less than or equal to 5 characters, display it as is $brighter_blog_in_focus_post_title = get_the_title(); } ?>
<?php echo esc_attr($brighter_blog_in_focus_post_image_alt_text) ?>
on