• Hi Folks

    I have been working on modifying author.php page to include both posts and comments for particular author. The problem I stumbled upon is implementing paging (post_nav_link).
    Could you give me an advice how to could i manipulate posts_nav_link. Or is there a way to have custom paging thing?

    Currently i do this:
    i get $posts, obtain $comments of author and combine them together.
    However, paging depends only on number of posts but not on comments.

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Virme,

    We recently explored a similar approach for one of our websites. It turns out that this problem is more difficult to solve than first appears…

    Our application was a bit different, but the general idea was the same: combine comments and posts into one list and display them as such. You are correct — this render’s the built in paging useless. You’ll have to roll your own to make it work.

    Doing this isn’t a trivial task, since you must to track the offset of two separate lists, and query accordingly. There are a few ways to do this, for example using the PHP session or (yikes) tacking parameters onto the querystring. In our case, however, manually building the paged URLs (e.g. …/page/3) broke permalinks, and resulted in a 404 when the page number was higher than the total number of active posts. This could probably be fixed (hacked), though I suspect you’d have to tinker with the WP core, which should be avoided.

    That aside, doing this introduces another, more serious issue: tracking these offsets assumes that the user enters the list on the first page. If someone comes in an external link to, say, page 3, you have to calculate the offsets for all the previous pages before you can build paging navigation for page 3. Not a huge problem until you have hundreds of pages of content and thousands of readers. The potential to generate an immense amount of database traffic here is pretty high.

    In our case, we ultimately modified our design approach to better mesh with WP’s limitations.

    HTH

    -k

Viewing 1 replies (of 1 total)
  • The topic ‘Combining posts and comments in authors page’ is closed to new replies.