only paginate if posts respond_to :total_pages

We use the same helper to render posts in different places.

Some of them paginate some others don't. The latter do not have
the necessary data incl. total_pages. So if we try to paginate
them it will crash.

We used to check for the class of posts. But since will_paginates
changed this is now always a relation. It's also recommended
to test responds_to? instead of class.