if posts logic