move code from posts_count to has_children