WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to customize the comment navigation tags? (1 post)

  1. Marventus
    Member
    Posted 4 years ago #

    Hello, there. I hope you're all doing good.

    I've been trying for the last couple of days to customize the "Older Comments" and Newer Comments" links in this Blog (Apollo theme variant) with questionable success. Since it didn't look complicated, I tried to figure it out myself so as not to encumber the Forums with a silly question (and I admit it, because, I enjoy a nice challenge every now and then, haha) but it is turning out to be more delicate than I thought.
    The information I found in the WP Forums and this site (www.aarongloege.com/blog/web-development/wordpress/advanced-comment-customization/) were useful but didn't quite address my problem.

    What I'm trying to accomplish is to add a button as a background for both tags. I tried two things:

    1) Changing the default style classes of both "previous_comments_link" and "next_comments_link" tags to custom ones and specify somme css commands (among which, "background url") in my main style sheet. Even though I was able to display the button the way I wanted, it would display twice, one for each tag, regardless of the number of pages the comments were divided in or which page was active. This means that if you were on the most recent comment page, and the only navigation possible was to go back ("Older Comments" on only), the "Newer Comments" button would display as well. I assumed the problem was that the divs (in which each tag was displayed) were calling for the button even when they were not supposed to display any text inside.

    2) Then I noticed both tag divs were contained inside a "navigation" div, so I tried to apply the CSS rules to the Nav class as a whole instead of individually to each tag. After a lot of tweaking, I got this to work (this is the way it is now). However, there's a small problem with this solution: if the comments span across more than 2 pages (when both tags need to be visible at the same time), my technique does not work, and both tags appear one next to the other inside the same button, instead of appearing each one inside a single button. I know that, as a work-around, I can prevent comments from being displayed across more than 2 pages with the "Break comments" option in the Discussion section of my Admin Panel, but it is far from being ideal, since if my girlfriend'blog takes off (and I'm confident it will some day) and the number of comments increase, this solution could be very time-consuming and annoying.

    I'm thinking there's got to be a way of making this work, perhaps through a php callback function, but I can barely read and understand, let alone write in php. Of course, I'm also open to other kinds of solutions and advice, ANY kind.

    Thanks a lot for your help.

Topic Closed

This topic has been closed to new replies.

About this Topic