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

(avery) #1

CHAPTER 4 • WordPress Theme Essentials 107


'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
?>


The wrapping code goes inside the single quotation marks at the end of each line.


Now, wrap the widget in a div with the class customwidget and enclose the title in a div
with the class customtitle:


<?php
register_sidebar( array(
'before_widget' => '

',
'after_widget' => '
',
'before_title' => '<div class="customtitle"',
'after_title' => '
',
) );
?>


You should use this custom stuff with caution. After all, most themes and widgetized plugins
are created with the unordered list in mind.


Now that you’ve gotten deep into the theme’s template files and have looked into how to
widgetize areas, you can do something about those comments. Yes, you did indeed look at the
comments.php template file earlier in this chapter, but there is more to comments than just
getting the functionality working. They need to look good.


MAKING COMMENTS LOOK GOOD


Not all sites need comment functionality, but chances are that a lot of the sites you’ll be
building with WordPress will. Most blogs allow readers to comment on the posts, and the
same goes for the vast majority of editorial sites out there, from newspapers to magazines.
This is just a good way to connect with the readership, and although the sites in question may
have different motives for doing this and may have different comment policies, the basic
functionality remains the same.


From a WordPress theme designer’s point of view, comments can be a bore, mostly because
making them look good can be a problem. The actual code isn’t all that hard, though, and if
you like the default comment view, you won’t even have to create the comments.php template
file if you don’t want to.


The following list notes the most important considerations for designing the comments
section of a site:


◾ Clearly delineate the comments section from other content. You don’t want the readers to
mix up comments with the editorial content.
◾ The comments need to be easy to read, just like the rest of the site.
Free download pdf