Added condition to not display unpublished posts