document.addEventListener('DOMContentLoaded', function () { const tabButtons = document.querySelectorAll('.tab-button'); const postItems = document.querySelectorAll('.post-item'); tabButtons.forEach(button => { button.addEventListener('click', function () { const category = button.getAttribute('data-category'); // Show all posts if 'All' is clicked if (category === 'all') { postItems.forEach(item => item.style.display = 'block'); } else { postItems.forEach(item => { if (item.getAttribute('data-category') === category) { item.style.display = 'block'; } else { item.style.display = 'none'; } }); } }); }); });