Added conditional pagination code for "All posts"