Thord Daniel Hedengren - Smashing WordPress_ Beyond the Blog-Wiley (2014)

(avery) #1

CHAPTER 4 • WordPress Theme Essentials 109














  • How many uls with the children class are allowed is determined by the threaded comment
    depth setting in admin. Five is the default, so your themes should support that many at least.
    The whole concept of threaded comments is built on hierarchy, so you should probably set the
    margin or padding for the children class to 10 pixels or so. It all depends on your theme,
    but you should make every reply indent a bit.


    Styling the Reply link is easier. The link resides in an a with the class comment-reply-
    link, so just style that any way you want. You can make it float to the right and in a font size
    of 12 pixels easily enough by adding this to the style sheet:


    a.comment-reply-link {
    float:right;
    font-size: 12px;
    }


    The same applies to the Cancel Reply link that is outputted just below the Post a Comment
    header in the Respond section of the comment area. Again, this all depends on how your
    comments.php template looks, of course, but usually you’ll find it here. It is in an a with the
    cancel-comment-reply ID by default. You can make that bold just as easily as you
    managed the Reply link:


    a#cancel-comment-reply { font-weight: bold; }


    Threaded comments are a great way to make longer conversations more manageable, so do
    consider using them if the topics on the site in question spark debates.


    AUTHOR HIGHLIGHTING


    Highlighting the post author’s comments is a good idea, especially if the site is of the teaching
    kind. Say, for instance, you’re doing tutorials. The readers may have questions, in which case it
    is a good idea to be very clear about which comments are the author’s.


    Comments are placed in a list (ol), with every comment being a list item (li). This is where
    you can make a difference because wp_list_comments() applies some CSS classes to each
    li. Among those classes are bypostauthor, if it is in fact the post author who wrote a

    Free download pdf