Sai Gopal Wordpress Blog

saigopal wordpress blog

Saigopal's website

Saigopal's website

My Daughter Website

Weebly

Palwow

Freelance Jobs

Friday, May 28, 2010

Customizing Blog's Layout

Customizing Your Blog’s Layout
In this chapter, I will show you how to improve your users’ experience by tailoring your blog’s
layout to your audience. As with the previous chapters, the focus is on building your community
and making it enjoyable and rewarding for people, so they will return again and again. To
achieve this goal, you need to think about the users’ experience as they use your site. What are
your readers doing on the site? What are they trying to achieve? When you have the answers to
these questions, you can help your readers by customizing your site to accommodate their
interests.
Considering What Your Reader Is Doing
When users click the comments link of a story, they are taken to a new page where they are
presented with the story in full and the related conversation. Almost everything else they see
looks the same as the layout on the front page. That’s the beauty of a template-driven system.
You don’t need to do anything to get the same look and feel, as well as common content across
all your pages.
But sometimes presenting the same layout is not the right thing to do. You should think
about what the users are doing. What are their intentions? What benefit will they get from this
action? What will they want to do next? The answers to these questions depend somewhat on
the nature of your site.
Having a Conversation
People love to chat. They love to have their say. In pubs and clubs, in their homes, in bus queues,
and in supermarket aisles, people love to talk.
For many people, it is just as rewarding to have those conversations without the face-toface
contact, such as on the phone or on a shortwave radio. People still have conversations with
pen and paper, sending letters to each other. Similarly, people love to have conversations online.
The nature of some online conversations is analogous to other types of conversations.
Real-time chat in a chat room is most like a face-to-face meeting with several people. Instant
messaging is like a phone conversation between two people. E-mail is like a paper-and-pen
correspondence. Yet the online world gives us other ways to converse that don’t have true parallels
in the real world. That e-mail conversation can take place on a mailing list, where many
people join in. Bulletin boards are like conversations with a lot of people, but the conversation
can be in near real-time, like a chat, or time-delayed over many hours, days, or weeks, more
like a mailing list.
461
C H A P T E R 17
■ ■ ■
Blog comment conversations can be similar to bulletin boards and forums in some
respects, but in other ways are quite different. One big difference is that often blog conversations
are lead by an article or post of substantial length.
Discussing the News
If your site is all about commenting on some type of news, like current political events, users
are likely to want to read the full details of the story you posted and to contribute to the conversation
about it. Their benefit is that they got to hear what their peers have to say and contribute
to the conversation themselves. The ability to have a lively conversation with one’s peers is a
very rewarding experience.
You and your writers might post a long, thought-out opinion piece or a proposal for a new
direction your group might take, and from that trigger a substantial debate with your readers.
In these situations, your readers might not want any distractions from the conversation or the
debate. Their main aim in visiting the page is to continue taking part in that debate.
Coming to Learn
Perhaps your blog is primarily about offering information of a tutorial nature and soliciting
feedback. In this case, your visitors still want to read what you have to say and perhaps provide
feedback, but they will also want to find more information and other resources about
the subject. Your articles are likely to have more structure than a news-type blog post, and
perhaps include images or illustrations. It may be that the piece is long enough to split into
multiple pages.
Your readers might want to read more on the subject you are discussing. They might want
to see a brief list of related resources, perhaps with some kind of summary or rating system.
Looking for a Review
Your blog could be specialized review site, where you discuss and review the latest science fiction
books, movies, and games. Here, your main articles will probably be in-depth reviews of
the latest DVD releases, complete with publicity photos, cast lists, and so on. But you may also
have, for example, a news category where the nature of the stories will be different. On such a
site, you might want to have links to allow your readers to purchase the products you are
reviewing. If they are affiliate links, you could even earn money that way.
To encourage readers to return, you could have a voting or rating system. Or perhaps, you
will just want to encourage them to leave their own reviews in the comments.
Moving to the Next Step
In all the scenarios I’ve mentioned, and in any others appropriate to your blog, you must try to
anticipate what your visitors will want to do next. You want to help them take their next step,
even if that next step is to leave your site! Here are some possibilities of what visitors will want
to do next and how you can help them:
462 CHAPTER 17 ■ CUSTOMIZING YOUR BLOG’S LAYOUT
• Participate in the conversation. Have the comment form right there.
• Find what else you have been discussing. Have links to other articles in the same
category.
• Buy the game you’ve just reviewed. Have the link there ready for them.
• Go off and do more research. Have links to other related sites right there.
It may sound strange to want to help people leave your site, but sometimes that is a good
thing. Have you ever wanted to return to a site you found useful, but you forgot to bookmark
it? You can’t remember the URL, but you do remember a related site you visited on your journey
to get there. You return to the related site, and try to retrace your steps. Of course, you want
your site to be the one everyone wants to visit, but that isn’t always the case. Being that related
site that people return to find links can be just as important. Having a reputation for being the
place to find out about other sites on your subject is one of the things that started this whole
weblog business.
Changing the Layout
In this section, I’ll show you how you can configure your blog to cater to different types of
users. You’ll see how to create different layouts for different views in your blog. Some layouts
will have both sidebars, some will have one or the other, and some will have none. First, you
need the elements that you will use to build your layouts.
Building Blocks
Think of a layout as building blocks or puzzle pieces that you want to fit together in certain
ways. PHP allows you to split up your files in this way and include them into the original.
Furthermore, WordPress encourages this kind of split in its support for theming. The themes
supplied with WordPress are structured this way.
So, first you’ll break down the theme files into multiple pieces. You will take each of the
elements of the header, the main section, the individual sidebars, and so on, and split them
into separate files. You can then choose to include those files as appropriate based on the type
of page to display.
Rather than take you through splitting each file piece by piece, I will show you one such
piece and leave the rest as an exercise. You will be able to download the completed version from
the Source Code area of the Apress web site (http://www.apress.com).
The example I will take you through is splitting the rightmost column from the main file
into its own file. Listing 17-1 shows the code to be moved. All of this code will go into a new file
called sidebar-b.php. The name is not related to its position on the page, because it may not
always be on the right.
CHAPTER 17 ■ CUSTOMIZING YOUR BLOG’S LAYOUT 463
Listing 17-1. The Right Sidebar Code to Go in sidebar-b.php

Once the code is in its own file, you need to insert the instruction to include that file in
the main index.php file exactly where the code was, as shown in Listing 17-2.
Listing 17-2. Include the New File in index.php