added conditions to look for posts that have published flag set as true