// Get all notices for JavaScript (remove pagination for real-time filtering)
$args = [
'post_type' => 'notice',
'posts_per_page' => -1, // Get all notices
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC'
];
$query = new WP_Query($args);
$notices_data = [];
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
$file_url = get_post_meta(get_the_ID(), 'notice_file', true);
// Get notice categories
$categories = wp_get_post_terms(get_the_ID(), 'notice_category');
$category_name = !empty($categories) ? $categories[0]->name : 'সাধারণ বিজ্ঞপ্তি';
$notices_data[] = [
'id' => get_the_ID(),
'title' => get_the_title(),
'category' => $category_name,
'date' => get_the_date('Y-m-d'),
'displayDate' => get_the_date('F j, Y'),
'fileUrl' => $file_url ? $file_url : '#'
];
}
}
wp_reset_postdata();
// Get all notice categories for filter dropdown
$categories = get_terms([
'taxonomy' => 'notice_category',
'hide_empty' => false,
]);
?>