maandag, maart 26, 2012

Tutorial: Take your minimalist web design from Photoshop to HTML part 1 | TechRepublic

Tutorial: Take your minimalist web design from Photoshop to HTML

Takeaway: Ryan Boudreaux follows up on his tutorial for creating a minimalist layout in Photoshop by showing how to take that PSD file and turn it into HTML.

Following up from a recent tutorial on creating a minimalist website design using Photoshop, I am going to demonstrate how to take that design from Photoshop to HTML in response to TR member dougried's request. This is the first segment of three parts, which will take you through the process, step-by-step. The PSD file will be used as a roadmap for creating an HTML template file and the associated stylesheet that will fit the look and feel of the original PSD. The PSD serves as a "smart" wireframe, as it contains the cues we will use for building the foundation and styling with CSS, CSS3 and several HTML5 elements. All files needed for this demonstration are included in the download (zip file).

Before we get started, here are the two parts of the original tutorial:

Separating the elements of the original PSD file

First, we need to un-compress the download file to a working location, and then open the PSD file (Minimalist_Template_Final.psd) in Photoshop as shown in Figure A below. Now, we can start with our dissecting of the background images. (The PSD file will also play double duty as our wireframe as we begin creating our styles and code for the HTML.)

We want to organize our layout in such a way that it can be put into defined sections such as rows, columns, blocks, or tiles so that they can be rendered using the coding and styling. The text and images in the PSD layout are going to be added on top of the background layers and can be placed easily with styling and code.

Figure A

In Photoshop we will create several individual images of the main content and background section starting with separating the header section from the body, and then the footer section. The body background will be a separate container, and we will eventually create sections with HTML5 <section> tags in the coding to piece it all back together. The text and images in the PSD layout are added layers on top of the background layers and can be replaced easily with styling and HTML code. It is the background elements that will need to be separated, and in this first section, we will copy the "Background" layer with the gradient and save it as a separate gif file named background.gif.

Next, unselect all the other layers in the PSD file leaving the "Background" layer visible.

Then, save the file in your web images directory (web/images) using the Save for Web & Devices… selection as background.gif.

The screen capture in Figure B displays the background layer selection.

Figure B

Next, we will create a separate image for the web name and subheading. To preserve the translucent background of the text sections we will:

  • Make the "Web Site Name" visible and make sure all other layers are hidden.
  • Use the Crop Tool (C) to surround the headings and accept the horizontal selection, then save the image in your web images directory using the Save for Web & Devices… selection as headername.gif. See Figures C and D below.
  • Make sure you "Step Backward" (Alt+Ctrl+Z) to get the PSD file back to its original state.

Figure C

Figure D

Next, the featured image will be cropped out and saved as a separate gif.

  • Make the "bg" layer and "Image Bg" layer visible, and make sure all other layers are hidden.
  • Use the Crop Tool (C) to surround the two background image layers and accept the selection, then save the image in your web images directory (web\images) using the Save for Web & Devices… selection as feature.gif. See Figure E and Figure F below.
  • Be sure to return the PSD to its original state by using the "Step Backward" (Alt+Ctrl+Z).

Figure E

Figure F

Included in the original download file are two more PSD image files for the "Connected" and "Social" icon. I have converted the two original PSD files to gifs and saved them for your convenience, and they are in the web images directory (web\images) as Connected_Icons.gif and Social_Icons.gif. These two images are both displayed in Figure G below for reference sake.

Figure G

Now that we have the major pieces of the PSD broken down into specific sections, it is time to start creating some HTML code and then the styles, based on the wireframe layout. Below is the basic HTML code to get us started with an outline within the <body> tags of the document and it is saved as the web document index.html.

    <section id="main">
      <section class="container">
            <header id="header">
          <p>Header Stuff Goes in Here</p>
        </header>
        <section id="main_content">
          <section id="left_sidebar">
            <p>Left Column </p>
          </section>
          <section id="right_column">
            <p>Right Column</p>
              <section>
                  <img src="images/feature.gif" />
              </section>
              <article id="left_feature">
                <p>Left Feature Article</p>
              </article>
              <article id="right_feature">
                <p>Right Feature Article</p>
              </article>
          </section>
        </section>
      </section>
        <footer id="footer" class="footcon">
          <p>Footer Stuff Goes in Here </p>
        </footer>
    </section>

Next, we will start adding in the styles to bring the code alive as we transform the PSD layout file into a working web document. We will start with some basic styles just to get the header, footer, sections and articles defined, and we will tweak some of them as we move through the tutorial. The styles are displayed below and saved as the document styles.css. The 1 pixel solid red border is a temporary style for this step to show the container separations, which you will see displayed below.

/*CSS Styles  */
body {
      background-color:#b9c7c7;
}
#header {
      border:1px solid red;
}
#footer {
      border:1px solid red;
}
.container {
      width:1020px;
      min-height:1020px;
      margin:0 auto;
      border:1px solid red;
}
.footcon {
      width:1020px;
      margin:0 auto;
      border:1px solid red;
      min-height:120px;
}
#right_column {
 margin-top:50px;
 float:left;
 top:0;
 right:0;
 width:610px;
 min-height:700px;
 overflow:auto;
 padding-left:5px;
 padding-right:5px;
}
#left_sidebar {
 margin-top:10px;
 margin-left:50px;
 float:left;
 top:0;
 left:0;
 width:200px;
 min-height:750px;
 overflow:auto;
 padding-left:5px;
 padding-right:5px;
}
#left_feature {
 margin-top:50px;
 margin-right:5px;
 float:left;
 min-height:250px;
 overflow:auto;
 width:280px;
}
#right_feature {
 margin-top:50px;
 margin-left:5px;
 float:right;
 min-height:250px;
 overflow:auto;
 width:280px;
}

Figure H shows how our index.html renders as displayed in Chrome 17.09:

Figure H

Now, let's add in the gradient image into our "container" section for the background by adding these two lines to our ".container" style:

background-image:url(images/background.gif);
background-repeat:no-repeat;

Figure I shows the resulting change, rendered in Chrome 17.09:

Figure I

The update is subtle, but the gradient is now visible from behind the feature image.

This concludes the first part of the tutorial. I will pick up in the next segment with adding in more styles for the remaining images, creating a gradient style for the footer area, and adding in the content text and linking for the navigation and other features.

Get IT Tips, news, and reviews delivered directly to your inbox by subscribing to TechRepublic's free newsletters.



http://www.techrepublic.com/blog/webmaster/tutorial-take-your-minimalist-web-design-from-photoshop-to-html/1346?tag=content%3Bsiu-container

Tutorial: Take your minimalist web design from Photoshop to HTML, part 2 | TechRepublic

Tutorial: Take your minimalist web design from Photoshop to HTML, part 2

Takeaway: Ryan Boudreaux continues his tutorial, taking a minimalist web design from Photoshop to HTML. Here, more styles and code are added as the final design is built.

In my last post, "Tutorial: Take your minimalist web design from Photoshop to HTML," we started work on splitting up the PSD file and created background images for the HTML page and then started our foundation HTML code (index.html) and some styles to establish the different sections (styles.css). Our initial styles set the main, container, header, left sidebar column, and right sidebar column, which also includes the feature content sections for an image and two feature articles. The download contains all the files utilized in this demonstration.

Adding styles and building the HTML

Picking up where we left off in the previous piece, we will start with adding in more styles for the remaining images, adding in the content text and linking for the navigation section, titles for the featured article sections, and feature content. Figure A shows how our index.html file looks at this point, as rendered in Chrome 17.0.9:

Figure A

Let's start with adding in the header image to the top left of the header section. To enable the image to be viewed, we will add in several lines of styles to the styles.css file, and we will add some textual content to the index.html file as well. I've kept the solid 1 pixel red border for now, but it will be removed as we move through the tutorial. The headername.gif file is called as a background-image as a URL, the height is set at 100px, the margin-top is set to 50px, the font-family, size and color are set to Tahoma, 14px, and #4b6262 respectively, and then a top padding of 18px and left padding of 15px rounds out the styling code additions to the styles.css file, which are displayed below:

Header styles:
#header {
border:1px solid red;
background-image:url(images/headername.gif);
background-repeat:no-repeat;
height:100px;
margin-top:50px;
font-family:Tahoma, Geneva, sans-serif;
font-size:14px;
font-weight:normal;
color:#4b6262;
padding-top:18px;
padding-left:15px;
}
The HTML code added to the header of the index.html file:
<header id="header">
<h1>The sub-heading slogan or catch phrase</h1>
</header>

Figure B shows the updates above as rendered in Chrome 17.0.9:

Figure B

Next, we will create our search bar and submit button for the final piece of the header section. Before we start with the code, we will need to capture the submit button arrow that we created in the original PSD file (see download). Using the same procedures as in the first segment of the tutorial, we will open the PSD file in Photoshop and make the button layers the only visible layers, crop to fit the arrow and gradient, size it to around 50×35 pixels, and then save it as a web-ready gif and name it search_button.gif, saving into the web images directory:

Figure C

The code for the search bar includes several CSS3 additions for gradients, border radius, box shadow, and backgrounds; the updates to the styles.css file are displayed below:

/* Search Form Styles */
#form {
margin-left:700px;
}
.search {
display: inline-block;
zoom: 1; /* display:inline-block for IE7 */
*display: inline;
border: solid 1px #d2d2d2;
padding: 1px 1px;
-webkit-border-radius: 7px;
-moz-border-radius: 7px;
border-radius: 7px;
-webkit-box-shadow: 0 1px 0px rgba(0,0,0,.1);
-moz-box-shadow: 0 1px 0px rgba(0,0,0,.1);
box-shadow: 0 1px 0px rgba(0,0,0,.1);
background: #b9c7c7;
background: -webkit-gradient(linear, left top, left bottom, from(#b9c7c7), to(#ededed));
background: -moz-linear-gradient(top,  #b9c7c7,  #ededed);
filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#b9c7c7', endColorstr='#ededed'); /* ie7 */
-ms-filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#b9c7c7', endColorstr='#ededed'); /* ie8 */
}
.search input {
font-family:Tahoma, Geneva, sans-serif;
font-size:22px;
color:#e0e9e9;
}
.search .field {
background: #b9c7c7;
padding: 0px 2px 3px 12px;
width: 190px;
border: solid 1px #bcbbbb;
outline: none;
-webkit-border-radius: 7px;
-moz-border-radius: 7p;
border-radius: 7px;
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
}
.search .button {
margin-bottom:-10px;
}

And the HTML <form> section and code is added to the header section just below the <h1> sub-title in the index.html file as displayed below:

<section id="form">
<form class="search">
<input class="field" type="text" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}" />
<input class="button" value="" type="image" src="images/search_button.gif"/>
</form>
</section>

Figure D shows the resulting header section as displayed in Chrome 17.0.9:

Figure D

The search functionality included in the <form> for this tutorial is for demonstration purposes only, and will not actually be a working search. (A database back end connection would need to be implemented for searchable content results. )

Next, we will add in the styling and HTML for the left navigation sidebar with the "About", "Blog", "Products", "Services", and "Contact" textual content. All hyperlinks will point to "dummy" pages to keep this tutorial moving along; however, should you want to link to actual sub-pages all you need to do is use the final index.html file as a template, and rename them as necessary for the remaining pages. First the HTML for the navigation is set into an unordered list and is the only code added to the left sidebar section as displayed below:

<section id="main_content">
<section id="left_sidebar">
<ul>
<li><a href="#">About</a></li><br />
<li><a href="#">Blog</a></li><br />
<li><a href="#">Products</a></li><br />
<li><a href="#">Services</a></li><br />
<li><a href="#">Contact</a></li>
</ul>
</section>

And the CSS styling is added to the left sidebar for anchor and list items, and with one modification to the margin set to -35px for alignment.

#left_sidebar {
margin-top:10px;
margin-left:-35px;
float:left;
top:0;
left:0;
width:200px;
min-height:750px;
overflow:auto;
padding-left:5px;
padding-right:5px;
}
#left_sidebar a, li {
font-family:Tahoma, Geneva, sans-serif;
font-size:22px;
font-style:normal;
font-weight:600;
color:#4b6262;
text-decoration:none;
list-style:none;
}

Figure E shows the resulting updates for the navigation section as rendered in Chrome 17.0.9:

Figure E

Next, we will add in the styling for our featured content areas which are separated into the left and right sub-sections within the right column section and just below the feature image. The styling additions to the right column includes font and some CSS3 text shadow effect for the feature titles and a separate font styling for the feature article, the additional styles which were added to the style.css file are displayed below:

#right_column .feature_title {
font-family:Tahoma, Geneva, sans-serif;
font-size:22px;
font-weight:500;
color:#1f2626;
margin-top:-5px;
text-shadow: 2px 1px 2px #656e6e;
filter: dropshadow(color=#656e6e, offx=2, offy=1);
}
#right_column .feature_article {
font-family:Verdana, Geneva, sans-serif;
font-size:14;
font-weight:normal;
}

The HTML code added to the index.html file is displayed below:

<article id="left_feature">
<p class="feature_title">Featured Content Title 1</p>
<p class="feature_article">"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
</article>
<article id="right_feature">
<p class="feature_title">Featured Content Title 2</p>
<p class="feature_article">"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
</article>

Figure F shows the result with the feature article sections as displayed in Chrome 17.0.9:

Figure F

Figure G shows the web page as it stands with the latest HTML and CSS styles added and with the red borders removed from the header and container sections, but the footer section's red border remains to differentiate it from the sections that have been converted.

Figure G

The third and final segment of the Minimalist PSD to HTML tutorial series will conclude with adding in the footer section, including creating a CSS3-styled gradient.

Get IT Tips, news, and reviews delivered directly to your inbox by subscribing to TechRepublic's free newsletters.

Ryan Boudreaux

About Ryan Boudreaux

Ryan's experience includes a broad range of technology support roles and web development expertise.



http://www.techrepublic.com/blog/webmaster/tutorial-take-your-minimalist-web-design-from-photoshop-to-html-part-2/1368?tag=content%3Bsiu-container

Tutorial: Take your minimalist web design from Photoshop to HTML, part 3 | TechRepublic

Tutorial: Take your minimalist web design from Photoshop to HTML, part 3

Takeaway: Ryan Boudreaux completes his three-part series on taking a minimalist web design from Photoshop to HTML. Here, he adds the finishing touches to the code for the footer section.

This is third and final segment in the series of our series on converting a minimalist web design in Photoshop to HTML. Here are the first two, if you missed them:

All the files associated with this tutorial are available in the download.

In fact, if you want to go all the way back, check out the original series on creating a minimalist website layout using Photoshop which prompted the PSD to HTML series:

Figure A shows the web design as it stands after the first two parts in building the index.html web document have been completed, as displayed in Chrome 17.0.9.

Figure A

In the final segment, all we have left is adding in the styling and content for the footer section, which is surrounded in the red border above. We will start with creating a CSS3-styled gradient.

First, let's open the PSD file one last time, and in this step we are going to use the footer area gradient layer to help us capture and create the CSS3 styles we are going to utilize for our web document.

  • Make sure the "Footer' layer is active and the only visible layer, then select the Crop Tool (C).
  • Now, select a slice of the gradient within the footer, being sure to select the entire top to bottom of the gradient; the width does not really matter, but in my instance, I selected a portion that is about 100px wide.
  • Press enter to accept the crop; the selection is shown in Figure B:

Figure B

  • Next, select File, and then Save for Web… and name it footer_ gradient.gif; save it to your working folder. We will use this gradient "snapshot" for our next step. RGB 99, 112, 111: HEX62716f,  and RGB 116, 143, 143: HEX 748f8f

One of my favorite online tools is the Ultimate CSS Gradient Generator by ColorZilla, which allows you to create a variety of gradients including horizontals, verticals and radials. We'll use it for the next part.

Once on the Gradient Generator website, I am going to select Import From Image. The button is pointed out with the red arrow as displayed in Figure C.

Figure C

Now, select Choose File and browse to the footer_gradient.gif file; select Open, and then, once the file name appears in the dialog box, select Import, as shown in Figure D below.

Figure D

The CSS gradient styling for background, linear-background, and filter stops will be created as a custom set. Before we accept the generated code, we can now update the color stops to more accurately reflect the effect that closely matches the gradient we created in the PSD. We will first set the first color stop to 60% and the second color stop to 80%. You can also name the custom set and save the unique permalink for future reference. The resulting generated gradient output is displayed below in Figure E, and the style code is included just below the screen capture.

Figure E

I've manually added in the fixed width of 1020px, the margin set to 0 and auto, and the height set to 100px to the top of the foot container styling.

.footcon {
width:1020px;
margin:0 auto;
height:100px;
background: #748f8f; /* Old browsers */
background: -moz-linear-gradient(top,  #748f8f 0%, #748f8f 60%, #728c8b 80%, #677777 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#748f8f), color-stop(60%,#748f8f), color-stop(80%,#728c8b), color-stop(100%,#677777)); /*              Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #748f8f 0%,#748f8f 60%,#728c8b 80%,#677777 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #748f8f 0%,#748f8f 60%,#728c8b 80%,#677777 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #748f8f 0%,#748f8f 60%,#728c8b 80%,#677777 100%); /* IE10+ */
background: linear-gradient(top,  #748f8f 0%,#748f8f 60%,#728c8b 80%,#677777 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#748f8f', endColorstr='#677777',GradientType=0 ); /* IE6-9 */
}

We will now add these styles to our styles.css file, updating the footer container styles that create the four columns, and we will also remove the red border. Now, let's view the index.html file in Chrome 17.0.9, displayed in Figure F:

Next, we will add in the four columns to the footer : Social Networking, Stay Connected, Participate, Copyright 2012, and Rights and Privacy Disclaimer. First we will create the sections and then add in the respective content.

From our PSD file, we see that all footer paragraph sections have the same font face, size, and styling of Lucinda sans Unicode, 12px, regular, and the color #ffffff. The font styling will follow these guidelines and are displayed below:

.column p {
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size:12px;
font-style:normal;
color:#ffffff;
text-align:left;
}

Next, we will set the styles for four columns that will fit within the defined footer area with the float left, margin set to 0 0 20px, left padding to 3%, and the width set to 22.5%, with the first column set to clear all and padding left of 0:

.column {
float: left;
margin: 0 0 20px;
padding-left: 3%;
width: 22.5%;
}
.first {
clear: all;
padding-left: 0;
}

Next, we will style the anchor text with text decoration set to none, a left margin of 25px, and the color set to #ffffff:

.column a {
text-decoration:none;
color:#ffffff;
margin-left:25px;
}

The disclaimer section uses identical styling as the footer section with the following styles defined:

.disclaimer  {
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size:12px;
font-style:normal;
color:#ffffff;
margin-left:180px;
}
.disclaimer a {
text-decoration:none;
color:#ffffff;
margin-left:240px;
}

The footer section HTML coded into the index.html file:

<br clear="left"/>
<footer class="footcon">
<article class="column first">
<p><a href="#">Contact Us</a><br />
<a href="#">FAQ's</a><br />
<a href="#">Accessibility</a><br />
<a href="#">Partners</a><br />
<a href="#">Portfolio</a>
</p>
</article>
<article class="column">
<p>SOCIAL NETWORKING</p>
<img src="images/Social_Icons.gif" />
</article>
<article class="column">
<p>STAY CONNECTED</p>
<img src="images/Connected_Icons.gif" />
</article>
<article class="column">
<p>PARTICIPATE<br />
We invite you to participate in our online community. Join our Facebook page, see our videos on YouTube,follow us on Twitter....</p>
</article>
</footer>
<section class="disclaimer">
<p>Copyright 2012 <a href="#">Rights and Privacy Disclaimer</a></p>
</section>

Here, the changes for the footer are displayed in Chrome 17.0.9:

Figure G

While the icons under Social Networking and Stay Connected are not anchored to links, it would not take much to split out the icons into individual image files and add linking to each. Or, another option would be to create an image map for each of the two footer images.

This completes the three-part series of converting the PSD file to HTML code. Figure H shows the completed website as displayed in Chrome 17.0.9:

Figure H

Get IT Tips, news, and reviews delivered directly to your inbox by subscribing to TechRepublic's free newsletters.

Selena Frye

About Selena Frye

Selena Frye is a Senior Editor at TechRepublic.com.


http://www.techrepublic.com/blog/webmaster/tutorial-take-your-minimalist-web-design-from-photoshop-to-html-part-3/1378?tag=nl.e075

maandag, maart 05, 2012

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required


How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required

GET OUR TOP STORIES

FOLLOW LIFEHACKER

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required

You want to start your own blog but you don't want to look tacky by using an existing design. Creating your own theme can be daunting, but with some assistance you can have a unique design for your blog in no time. This post will help you put it all together using WordPress, the most popular (and free) blogging software available.

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding RequiredCreating a WordPress theme can take quite a bit of work when you're starting from scratch because you have to put together quite a bit of PHP code (the programming language WordPress uses) before you can even get to creating the look and feel of your site. We're going to save you the trouble by providing those files pre-made for you, plus a skeletal structure of the CSS you're going to need to make your WordPress site look the way you want. The PHP code is based upon the work of Ian Stewart, but has been updated for WordPress 3.3.1. If you're ready to get started, here's what you'll need:

  • WordPress, installed and ready to go. During theme development we highly recommend running a local web server with PHP and WordPress installed so you're not testing any changes you make live on your web server. This also makes development a lot faster. When you're done, you can simply install the finished theme on your web server and it will be ready to go. If you want to develop locally, the easiest way to get started is with the self-contained web servers WAMP (Windows) or MAMP (OS X). They contain the Apache web server with PHP and MySQL ready to go, so you'll be able to download and install WordPress quickly and easily. Once you've got your theme ready to go, installing WordPress on a proper server is generally quite easy. For example, our favorite beginner host,Dreamhost, features a one-click WordPress installation.
  • Our blank theme files. Download and unzip.
  • Basic knowledge of HTML and CSS (which you can obtain here).
  • A design you've made for your WordPress site (which you can learn how to do in Photoshophere).
  • Optional: If you don't want to use the theme editor built into WordPress, you should get a programming-friendly text editor. (Here are our picks for Windows and OS X.)
  • Optional: Since you're WordPress site is likely empty, and it's hard to create a theme when there's no content, you can download sample content (and import) for development purposes. This can be a big help in a local development environment where you're not going to use the content. You probably don't want to add it to a live site because 1) it'll be visible, and 2) you'll want to remove it after you're done developing.

Once you've got everything, you're ready to start making your theme!

Get to Know and Install Your Theme Files

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding RequiredWhen you unzip the lh_wordpress_blank_theme.zip file your downloaded, you'll have a folder filled with a bunch of files and two folders. Here's a quick list of what they are and what they do:

  • 404.php - The page responsible for displaying 404 not found errors, for when a user attempts to go to a page on your WordPress site that does not exist.
  • archive.php - Displays the archived posts list, much like the main page but for posts in the archive.
  • author.php - Displays all the posts for a particular author. It's basically the same as the archives page, but just for one author.
  • category.php - Displays all the posts in a given category.
  • comments.php - When on a single post page and comments are accepted, this file will be used to show the comment form.
  • footer.php - The footer that will be inserted at the bottom of the page. You'll need to edit this file and add what you want to show up in the footer.
  • functions.php - Custom functions for the theme. You should leave this alone unless you know PHP and know what you're doing.
  • header.php - Displays the header at the top of every page on your WordPress site. This is the code that generates the menu.
  • img - A folder for custom images you're using in your theme. You can leave this empty or delete it if you are not using custom images.
  • index.php - Displays the primary blog roll page. Like many other pages (e.g. author.php, page.php, search.php, etc.) in incorporates the header.php, sidebar.php, and footer.php files to display the entire site.
  • page.php - Displays any single page. This does not include posts, but rather individual static pages you've created in the WordPress Admin.
  • search.php - Displays search results a user requested through the search widget on your WordPress site. If no results are found, it will inform the user that it failed to bring up any results.
  • sidebar.php - This file contains the primary and secondary areas for sidebar widgets. You can add widgets to these areas via the WordPress Admin and shouldn't need to edit this file.
  • single.php - Displays a single post with or without comments.
  • styles.css - This is the file we will be editing in this guide, so it has been highlighted in red. This contains the skeletal structure of the CSS you'll need to make your WordPress site look the way you want it to look. The majority of your work will be in this file.
  • styles - A folder to contain any additional CSS files you may use or import. If you don't use this, you can just delete it.
  • tags.php - Displays posts for a given tag.

That list probably seems a little intimidating, but chances are you won't need to edit most of those files. We just wanted you to know what everything does. At the very least, you only need to edit styles.css, and maybefooter.php (if you want to add content to your footer). Now that you know what you're in for, let's install this blank theme in WordPress. To do so, just follow these steps:

  1. Log into your WordPress Admin section. You probably know where this is, but if not it is, by default, at http://yourdomain.com/wp-admin (or if you're running WAMP/MAMP it is, by default, at http://localhost:8888/wp-admin).
  2. Go to the appearance tab on the left-hand menu and choose Appearance -> Themes.
  3. From the menu up top (which only has two tabs), choose Install themes.
  4. Click the Upload link.
  5. Click the Choose file... button to select the lh_wordpress_blank_theme.zip file you downloaded and then click Install Now.
  6. When the theme has been installed, click back to Appearance -> Themes and find it. It should by called Blank and have no preview image. When you see it, click the Activate link to make it the active theme.

Alternatively, if you prefer installing via FTP or just moving the files to the correct directory on your local machine, unzip the lh_wordpress_blank_theme.zip and rename it "blank" (or whatever you want). Now find the wp-content folder in your WordPress installation directory and open it. You'll see a directory called "themes" inside. Copy blank into it, then follow the last step in the steps above to activate it on your WordPress site.

Style Your WordPress Theme

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding RequiredWith the blank theme installed you're ready to start making your WordPress theme look great. Currently, however, it looks like an ugly mess of blue, green, and black. It may not even look that good if you haven't added a menu, widgets, or any content. If you still need to add content, either download sample content or create some of your own. Even if you install sample content, you'll still need to go into the WordPress Admin, click on the appearance section, and edit both the Menus and Widgets subsections. Just head into the Widgets subsection and (literally) drag some widgets into both the primary and secondary sidebar spaces, then create a menu in the Menus subsection. Once you have all your (possibly fake) content ready, you'll see it all on your WordPress site. It will probably look something like the image to the right.

Now that everything is in place, we need to start editing the styles.css file. You can either open it up in your favorite programming-friendly text editor, or you can go to the Appearance tab in the WordPress Admin section, choose Editor, and then choose styles.css from the right-hand menu (if it isn't already selected by default). Either way, you should now see the skeletal CSS structure you're going to use. It does not include every single style you may want to edit, but the main ones you'll need to get most of your style together. (Later on we'll discuss how you can discover other elements and how to style them as well, so if you want to take things further than the template we've provided you'll be able to do so easily.) Since everyone's design is going to vary a little bit, we're going to discuss what most of the styles do rather than offering up specific code you can use. You're going to need to bring your own design and CSS knowledge to the table, so if you're feeling a little shaky you can brush up your skills with our CSS night school lesson. So, without further ado, here's a rundown of the styles.css file. Each item we cover will demonstrate what it looks like now and what it could look like once you add some style.

Global: General Style Defaults

The General Style Defaults are pretty much laid out for you already and should be pretty familiar even if you don't know very much CSS. For the most part these styles are just setting the margins of the document (which are currently at 0 pixels), the default font to use on the page, what colors the background and text are, how links look in their various states, and more. You can leave this information as-is, or go in and make general changes as desired. For the most part, the look and feel of your WordPress site won't be too heavily influenced by these styles and, if anything, the changes you make will mostly relate to the fonts and colors.

Page Layout

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding RequiredThe Page Layout section of the styles.css file contains only two code blocks: one fordiv#container and one for div#content. In both cases we're targeting DIV tags. The one called container is what contains pretty much everything on the page that is not the header or the footer. That means you've got the post, static page, or blog roll, the comments, and the sidebar widgets all wrapped into this one container. By default we've given it a 4px margin to inset all this content just a tiny bit from the header. You can adjust it however you like and add any new styles you wish here. The content DIV, on the other hand, only includes the post, static page, or blog roll (and comments, if they're visible). Any styles you add here will only effect that content. One of the first things you're going to want to do is position this DIV somewhere on the page. Traditionally it is aligned left by using this CSS code:

float: left; 

Chances are you'll also want to define it's width, any margins or padding, and anything else you want to be different in that specific area of your site. Here's what my site's content DIV style looks like:

div#content {         width: 640px;         float: left;         margin: 0 0 0 51px;         padding: 0 18px 0 0px; } 

As you can see, it has a width of 640px. It also floats to the left, just like we talked about earlier. Additionally, I've added a 51px margin on the left side and 18px of padding on the right side. How do I know which numbers correspond to which sides? In CSS margins and padding code, it goes like this: top, right, bottom, left. This is easy to remember because, abbreviated, it looks like TRBL. That sounds like trouble or terrible when you sound it out. Either way, that's a quick and easy way to remember it.

Header

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding RequiredThe header is a fun part of your page to style because you get to decide how the menus look. Although you might have additional elements in your header should you decide to add a few new things do the header.php file in your theme, menus are still the main draw. Menu items are given in a list style that, without styling, would look a lot like this:

  • Page One
  • Page Two
  • Page Three
  • Page Four
  • Page Five

The dots wouldn't be green, but you'd basically end up with a list. You don't want that, and presumably you want the menu running along the top of the page. We handled that problem for you and styled the menu so it appears as one straight line of options rather than an unordered list. There are two pieces of CSS that make this happen. The first belongs to the .menu class' ul (unordered list) element:

.menu ul {     list-style: none;     margin: 0; } 

This code takes away the dots and any margin adjustments you'd get with an unordered list by default. The second relevant code block looks like this:

.menu li {     display: inline;     float: left;     padding: 0 8px 0 4px; } 

This code tells the list to display inline, which means it'll display in a line rather than in a traditional list. Additionally, each list item (li) is told to float left (which will give us a little more freedom to move each item around) and have 8px of padding on the right and 4px of padding on the left (so the text isn't so scrunched together. All of that's enough to get you a basic menu, but we also want to style the a element (a as in a href, the link tag) to make all the links in the menu look the way we want. For that, we need this CSS:

.menu-item a {         font-size: 30px;         text-decoration: none;         color: #3eaf00; } .menu-item a:hover {         color: #5d8a05; } 

All this code does is set the font size (to 30px), the color of the font to green (specifically #3eaf00), and remove the underline that appears under links by default (text-decoration: none). The hover state just specifies a slightly darker green (#5d8a05) to display when the user rolls over any menu link. This is all pretty straightforward, basic CSS but it allows you to make your menu look different from the other text on your page without resorting to images. If you want to change the text even more, you can consider a different font or converting everything to upper or lowercase text. If you need some good web font options, you can find hundreds in theGoogle Web Font Directory.

Once you've made these style choices you're pretty much done styling the menu and your header. There are definitely other styles you can find and play around with, but we'll discuss how to locate those at the end of the post.

Content: Posts and Pages

Remember the div#content style we defined earlier? Pretty much everything in this and the following two content sections of this post relate to styles that exist just inside that DIV. Most of the

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required.entry-title
This is a style that relates to different page headers. In the styles.css file, you'll find it attached to h1s, h2s, and h3s most often. Post headers adopt the .entry-title style regardless of what h# tag they are, so you can define each individually by first specifying the h# tag and then adding .entry-title to it. You can see this in several pre-defined code blocks in your styles.css file, such as h1.entry-title and h2.entry-title. Static page titles work in the same way, but their style is .page-title and they generally only use the h1 tag along with that style. That means you shouldn't need to define any header styles for page titles beyond h1.page-title. Styling these titles are just like styling any other text, but you want them to be big. If they're as small as other text they won't stand out like they should.

.alignright and .alignleft
These two styles simply align images to the left and right of an entry (and you can probably guess which is which). You'll also notice that in your styles.css file, padding is applied to three sides of the image but not one. Why? The side with no padding is the side that won't be next to text. This is the right side of the image on right-aligned images and the left side on left-aligned images. This is done so the image doesn't look awkwardly indented in a block of text wrapping around it. When you're creating your WordPress posts and pages and adding images to them, you'll be able to choose the image's alignment within the editor. These styles will automatically be applied to any aligned image in your post. Unless you want to increase/decrease the padding, or add additional styles, you can leave these two classes alone.

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required.entry-content
The entry-content style is applied to the contents of blog posts and static pages you create in WordPress. This class pretty much applies its styles to any text, images, or whatever end up in the body of the content you create. For the most part, you don't have to do much here. You can set the text styles you want, decide what headers (h1, h2, h3, etc.) look like, style lists, and basically any other element you want to have a specific style in the content section.

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required.entry-utility
The entry utility is an class for a small section at the end of each post that provides context. It'll offer up information like the post's categories and tags, as well as an RSS feed. If you're not just a reader but rather a writer on your WordPress site, you will also see an "Edit" link in this section. Adding style to .entry-utility will determine how this section looks.

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required.entry-meta
It's easy to confuse entry-meta with entry-utility, but it's different. It contains the author name, date, and other metadata. If you want to change the way it looks, such as make the text smaller since it isn't vital information, you'll want to edit this class.

.navigation
Navigation is a class for styling the navigation links at the bottom of your theme. Navigation links are the links that point to older and newer posts.

Content: Comments

Although the comments section might seemlike an easy styling task, it's actually one of the most complex sections of the blog. The comment form, itself, is pretty straightforward, but as people reply to comments and then reply to those replies, you end up with a lot of nested comments. There is also plenty of metadata, as well as an avatar, the shows up alongside a user's comment. This means you've got plenty of elements to style.

.comments
Primarily, there are three: h3, ol, li, and img. Of course, h3 refers to the comment header. Because comments are posted in an ordered list, the ol (ordered list) and li (list item) elements are necessary. In most cases you'll want to borrow a few styles from your header menu because you won't actually want numbers next to your comments. You may also want to change the background color of each comment in the list or add other styles as well. You can do that by styling the ol and li elements of the .comments class. Finally, styling the img element is important because comments will contain an avatar for the user. That avatar might be blank or generic, but it'll still show up for every commenter. Styling the img tag in the comments class (.comments img) will provide you control over how those avatars look and how they behave when paired with the comment text.

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required.comment
Very similarly named to the previous class, .comment is the style that applies to specific comments.

.children
Children is the class used to target replies to comments. These replies are considered children of the comment. Replies to the replies are also considered children.

div#respond
The respond DIV is the DIV holding the comment reply form. If someone wants to leave a comment, they'll need to use this form to do so. You'll want to style this DIV in order to make the form look the way you want. For the most part you'll just be changing text, but you can also style form elements and buttons for an especially unique look.

Content: Sidebar

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding RequiredStyling the sidebar is actually pretty easy, but it can get more complex if you want to get very specific. WordPress gives you two widget areas: div#primary and div#primary. You can target each of those DIVs individually, or you can add styles to both of them using the .widget-area class. Furthermore, each widget you add to a widget area is added as—surprise!—a list item. The .xoxo class is applied to this list and can be used to separate and style each widget the way you want. If you want to get really specific, however, you'll need to target each widget directly. We'll discuss how to do that in the next section.

Additional Styles

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding RequiredNow that we've talked about all the basic styles you'll need to target in order to turn this blank theme into your own, let's discuss how you can take it a bit further. WordPress themes contain tons of elements so there are undoubtedly more you'll want to style. In order to easily discover what they are as you're going through the development process, all you need is the right tool.

If you're using Chrome, that development tool is built right in. Just preview your theme as you're developing it and open up the Developer Tools. You can do that by going to the View menu and choosing Developer -> Developer Tools. In Firefox (and many other browsers), just download and install Firebug, then click on the Firebug extension to activate it. Whichever tool you use, it'll cause the screen to split into top and bottom halves. The top half will contain the page and the bottom half will contain the pages code. If you mouse over any element on the page you'll see it highlighted in the code so you can inspect further. This will quickly tell you what the element is called and show you any styles already applied to it. You can then use this knowledge to add a new style for that element (or the class applied to it). Just continue doing that until you've found all the styles you want to add to your styles.css file. When you're finished, you'll have a completed theme!


If you've made a WordPress theme before and have additional tips for making it easier, please share them in the comments. Additionally, if you use this process to make a WordPress theme yourself, be sure to post a screenshot in the comments as well. Happy theming!
Contact Adam Dachis:



http://lifehacker.com/5890139/how-to-create-a-custom-theme-for-your-wordpress-blog-with-minimal-coding-required