Tag and Alignment with CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 Margins and Padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Using
s for Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4
Kim Explores WordPress City . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Welcome to WordPress City . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Kim Learns Her Way Around WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Kim Builds Her First Page in WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Kim Organizes Her Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Kim Adds Photos and Other Media to Her Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Getting Started with WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Logging In and Out of WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Check Your Work as You Go . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 WordPress Content: Posts and Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Plan Your Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Creating Your First Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Creating a Blog Post . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Getting Organized: Post Categories and Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Featured Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Using Video, Photos, and Quotes with Post Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Managing and Deleting Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5
Customizing WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
The Appearance Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 Superpower Your Site with Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Kim Looks Behind the Curtain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Changing the Appearance: Theme Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Customizing Your Theme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Customizing Your Navigation Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Understanding the Screen Options Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Customized Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Advanced Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Moving Hosts Using the Tools Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 For More Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
vi Contents
6
The Big Launch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
There’s No Place Like Your Web Host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Kim’s Portfolio Finds a Home . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 A Network of Friends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 So You’re Ready to Set Up Your Website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Setting Up Hosting: A Home Online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Getting a Basic HTML and CSS Site Up and Running . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Setting Up WordPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Contents vii
About the Author
Nate Cooper is a writer and consultant in New York City. After
working in retail marketing at Apple Inc., Nate has established
himself within the New York tech and entrepreneurial commu
nity, writing on the subject of business strategy. His company
Simple Labs consults with businesses on WordPress implemen
tation and content strategy, and regularly draws audiences for
events on the topics of communications and technology.
Photo credit: Amanda Ghanooni
About the Illustrator
Kim Gee is an illustrator and graphic designer, currently living in New York City with her boyfriend and her pet dog, Tofu. In 2010 she created her eponymous web comic and has since self-published a graphic novel and mini-comic collecting her work.
A Note from the Author
When I started my consulting business, I anticipated a demand for basic web skills in the design community. Graphic designers who’d been able to get by knowing just Photoshop, Illustrator, and InDesign would tell me that their clients started expecting them to know how to write HTML and CSS. As companies started shifting over from proprietary content management systems to general CMSs like WordPress, the need for designers to have basic tech knowledge grew. Today, designers must be able to create content both for print and for the Web, and that means knowing HTML and CSS.
When seen against the media’s transition from print to Web, perhaps this shouldn’t be shocking. What surprised me, however, is how much interest in these skills has spread beyond the design and media communities. If you’re as old as I am, you might remember a time and place when office desks didn’t always have computers on them. I remember visit ing my dad’s office at a community college while I was still in high school. He was considered forward-thinking because he not only had a computer on his desk but he actually read his own email, which was unheard of by certain college administrators.
We don’t live in that world anymore. It didn’t take very long for the Internet, desktop computers, word processing, typing skills, and email to become standard tools for nearly every single job in existence. Now, not only designers, but all sorts of professionals are required to produce content for the Web using basic HTML and CSS. The Web is taking over, but that doesn’t mean learning about it has to be a pain.
My hope is that this book will appeal to those people feeling left behind as well as those who want to get ahead. We live in an ever-changing world where the skills you learn today aren’t guaranteed to carry you into the future. To succeed in the jobs of the future, you’ll have to learn not only what’s needed for the task at hand, but also how to adapt and learn new skills. Learning shouldn’t be a chore! Once you figure out how to make learning a fun experience, you’ll crave it.
Whether you’re a designer, writer, student, or anyone else who’s new to website design, I hope you find this comic funny and interesting, but I also hope it inspires you to adopt the mantra learning is awesome!
Looking forward to the future! :)
Nate Cooper
July 2014
Acknowledgments
This book started as a Kickstarter project. Though the project has evolved quite a bit since the original plan, I wanted to express my sincere thanks to those who initially supported me in my goal of writing an educational comic book.
These early adopters proved that people want this book to exist and put their money where their mouth is. I thank them for believing in me, and in this concept. A special thanks to my top funders: Matthew Bergman, Dwight Bishop, Dean Cooney, James Cropcho, Sue Maisonneuve, Steven Morrison, Edward O’Neill, and Johan Uhle. Thanks also to: Gail Amurao, Angie Hall Anderson, Ari Arsyadi, Tony Bacigalupo, Stephen Bennett, Claire Burns, Nicole Calasich, Luke Chamberlin, Sara Chipps, Ernie Cooper, Jessica Cooper, Katrina E. Damkoehler, Colin Deeb, Martha Denton, Amy Donnelly, Danny Dougherty, Tarynn Farmer, Edward G, George Haines, Steven Hodas, Jim Hopkinson, Bill Johnson, Raygan Kelly, Mitch Kocen, Marissa Levy Lerer, Jonathan Levin, Anna Lubrecht, Michelle Mazzara, Colette Mazzucelli, Brenna McLaughlin, Lura Milner, John Murch, Stefan Nickum, Jason Nou, Paul Orlando, Eric Pan, Craig Plunkett, Julie Roche, Seth, Marny Smith, Shakti Andrea Smith, Kimberly Ann Southwick, Bobby Stoskopf, Erica Swallow, Harrison Swift, Kara Szalkowski, Sean Talts, Sophia Teper, Jennifer Tzahi, Jeremy Wadhams, Joe Watkins, Stefan Wehrmeyer, and Katy Zack.
I would also like to thank Shay Howe for his valuable feedback throughout the writing process, and everyone at No Starch Press who helped to turn this book into a reality.
1
The First Day of Class
Web Basics 101
Now, sun salutation and... breathe...
I’m so excited! My web class starts in just a few hours. Finally, I’ll be able to get it together and build my online portfolio.
Web Basics 101 3
Namaste!
4 Chapter 1 The First Day of Class
Hey, Doug! Hey...
Kim...?
Darn it!
Oh! Hey, Kim.
How’s it going?
Web Basics 101 5
Great! I’m just coming from yoga class. So, a bunch of us are heading
over to this show later tonight
if you wanna come.
6 Chapter 1 The First Day of Class
Can’t make it tonight,
Doug. After I drop
off these library books,
I have to go to my
Web Basics 101 class
at seven. It’s time I
finally learned how to
make a website.
You mean that
portfolio website you’ve
been talking about?
Oh, cool. Well, let me know the address when your site is live! Gotta run!
Yep!
Web Basics 101 7
Uh oh!
Don’t want to be late.
8 Chapter 1 The First Day of Class
Made it! Is everyone here?
Web Basics 101 9
Welcome to Web Basics 101.
My name is Nate, and I’ve been
building websites since 1997.
I’ve been using WordPress
since 2005, and now I’m going
to teach you how to get your
website up and running.
Sounds like I’m in
the right place.
10 Chapter 1 The First Day of Class
What You Need
In this book you’ll learn the fundamental concepts that go into building a website. We’ll discuss the basics of HTML, CSS, and WordPress. By the time you’re finished, you will have everything you need to launch your very own website. One little book can’t teach you every thing about developing websites, though. Learning is a process, and I hope that this book is a helpful beginning on your journey to becoming a web guru.
It’s up to you to do the exercises and to make sure you get the practice you’ll need.
This book takes the “learn by doing” approach. You’ll need a couple of things on your own computer to follow along.
A Web Browser
First, you’ll need a web browser. A web browser is what you use to view web pages online. If you’re running Windows, I recommend you download Chrome, Firefox, or Safari and not use Internet Explorer. Many older versions of Internet Explorer are not equipped to handle modern conventions for the Web. While most of what we’re doing in this book will work fine
in Internet Explorer, if you go deeper into web development you’ll be glad that you started using these other browsers.
If you’re on a Mac, you already have Safari installed and can stick with that if you’d like. But you may also want to get Firefox or Chrome to test out your work. Even though this is an extra step, you may find that you prefer some Firefox or Chrome features.
Having more than one browser is a great idea so you can see the differences between them, as well as see how your website will appear to visitors using different browsers.
A Text Editor
Next, you’ll need a text editor or code editor of some kind. Why bother getting a program just to write boring old text? A good code editor is designed to help you with the tricky parts of writing HTML and CSS. When you open a text editor, at first glance it may look similar to Microsoft Word or other word processors. But once you dig in, you’ll see that it is specially designed to display code, as Figure 1-1 shows.
Figure 1-1: Don’t use Word or another word processing program to write HTML (top)!
A good code editor makes your job easier (bottom). It will highlight pairs of tags, use a
monospaced font, and save the files in the right way.
If you’re on a PC running Windows, NotePad++ is a great free option (available at
http://www.notepad-plus-plus.org/). If you’re on a Mac, you can download Text Wrangler for free (http://www.barebones.com/products/textwrangler). Sublime Text is an excellent free code editor that works on both Macs and PCs (http://www.sublimetext.com/) and one I would highly recommend. Choose an editor you like, and get to know it.
What You Need 11
A web browser and a text editor are all you need to follow along with the chapters
on HTML and CSS. If you get comfortable using a code editor, it can pay off down the line if you pursue a more advanced scripting language, like PHP, JavaScript, or Ruby.
Stuff to Know
In this book, I assume you can use a file browser (Finder on Mac, Explorer on Windows) to open and save files and install programs, and that you generally know your way around a computer. There are some other basics you’ll also need to know.
How Do You Read an Address?
You’ve probably seen a website address before. It looks like http://nytimes.com/, http:// en.wikipedia.org/, or http://nostarch.com/websitecomic. Because we geeks like fancy names, we call this a URL, which is short for uniform resource locator. We’ll just call it a link or an address for now, though.
As you move to new places on the Web, this address changes, just as your location
changes as you walk around big city blocks and go to new stores.
Let’s take a closer look at what each part of an address does:
http://nytimes.com/articletitle
❶ ❷ ❸ ❹
❶ First, there’s the http://. That lets us know that we’re using HTTP, the HyperText Transfer Protocol. That’s a fancy way of saying that the web browser should expect to receive an HTML document. We’ll write some of our own HTML in Chapter 2.
HTTP is the most common protocol you’ll see on the Web. Another one worth
knowing is HTTPS, which means Secure HyperText Transfer Protocol. You should see this protocol used on pages where you’re entering confidential information, like credit cards or passwords. You might also see other protocols from time to time, like ftp://
(short for File Transfer Protocol, which is described in “An FTP Client” on page 14).
❷ Then we have the domain name. Here, that’s nytimes.
❸ The .com that follows means that this site is commercial. While .com is still the most popular kind of top-level domain, you’ll see all sorts of different top-level domains
these days.
âťą The rest of the URL points to an article, blog post, or other particular resource or page.
What Are Clients and Servers?
Ever wonder what’s on the other end when you go to a website, or what makes the Web work? It’s just a bunch of computers talking to one another.
12 Chapter 1 The First Day of Class
When you visit Wikipedia, your computer talks to the Wikipedia server. It works a little bit like this:
Iwantthis
webpage. Sure,
no problem.
Hereyou go.
When you ask your web browser to pull up a Wikipedia article, Wikipedia’s server (shown in Figure 1-2) brings you the article, just like the server at a restaurant brings you a menu or a croissant when you ask.
Figure 1-2: A server can be a simple desktop computer, or it can be racks of specialized computers like the servers in this photo, which serve up Wikipedia pages. The more traffic your website gets, the bigger and better server you’ll need. (Photo credit: Victorgrigas)
Until today, you’ve probably been mostly acting as a client, requesting pages from the Web. Well, now you’re going to be serving up those pages. But you might be wondering where you’ll get your own server.
What’s a Host?
To make sure the web pages you create can be seen by the world, you’ll need to have a server of your own. Running a server can be a pain, so people often buy space on someone else’s server. A company that sells space on a server is called a web host. For a fee, a web host stores your web pages and keeps them up and available 24/7 to anyone who wants to access them. Usually, setting up a host involves two steps. First, you register a domain (like www.natecooper.co) for a fee, and then you pick a host and pay a monthly or yearly fee for the hosting.
Stuff to Know 13
An FTP Client
Eventually, you’ll need a way of sending files to your host. This is how you’ll add pages and edit articles. For that you’ll need an FTP (File Transfer Protocol) pro gram. A great free FTP program available for both Windows and Mac is FileZilla (http://www.filezilla-project.org/). Once you’ve signed up for hosting, you’ll get the login information from your host and be able to connect remotely via FTP. You don’t need an FTP client yet, but you may find yourself needing one later when you have your first website.
Figure 1-3: FileZilla is a free FTP application that lets you upload files from your computer to a remote server.
But you don’t need to spend any money to follow along with everything covered in this book. As we build web pages in HTML and CSS, you’ll be testing them on your computer using your web browser. That means you’ll just be checking how your web pages look on your own computer, without having those pages broadcast on the Internet.
When we start playing with WordPress in Chapter 4, you’ll need a host because Word Press uses technology that requires a server in order for it to work. To follow along you can use a free WordPress account from WordPress.com, or if you sign up for hosting with a third party site like Host Gator, you can set up WordPress for free (see Chapter 6).
We’ll revisit some particulars of how to buy a host in the last chapter of this book. For now, file that away in the to-do list in your mind. If you’ve installed your web browser and a code editor, all you need now is a sense of adventure. Get ready to learn!
14 Chapter 1 The First Day of Class
2
The Trouble with HTML
Woof!
I gathered all of my photos and writing, like the teacher said. This plan will help guide me, but where should I even start?
I thought I’d be ready
to tear down my old
site and put up my new
portfolio by now.
Uuuugh. Oh no, Tofu. I don’t think I’ll ever get this
website finished. I tried
to listen in class today,
but all my notes ended
up as comics.
Don’t worry, Tofu. I’ll always keep photos of you on my website. *Yawn* This all seems so overwhelming...
Grrr.
The Trouble with HTML 17
Kim Learns Basic HTML Tags
Whoa. Where are we?
Looks like we lost our
ride home. Let’s go
look for help.
Woof.
Tofu, I’ve got a feeling
we’re not in Brooklyn
anymore...
Or are we? Are you looking for the way?
Eep!
18 Chapter 2 The Trouble with HTML
Don’t be frightened. Did you crash-land your ship?
How did you know?
The
smoke.
Woof?
I don’t know what happened! One minute I was planning my website, and the next thing I knew I was climbing out of this crashed spaceship. I don’t even know where I am.
Yes. You see,
I am a web guru.
I am learned in the
ancient language
of HTML.
Ah. So you are
seeking to build a
website! You’ve come to the right place.
I
have?
Like
HTML?
Indeed. The Web is built on languages, and to build a web page you’ll need to learn two: HTML and CSS.
Don’t worry.
HTML and CSS are
pretty simple to learn.
My Page
This is a basic HTML page.