Monday, December 24, 2012

How to create a simple WordPress theme


This tutorial will show you how to create a simple WordPress theme. When building your own theme, you can use our Free Wordpress themes for reference.

How to create a basic WordPress theme?

To start building your theme, first create a sub-folder in the wp-content/themes directory in your WordPress folder. For the purpose of this tutorial, we will call the folder "tutorial_theme". The name of the folder should correspond to the name of the theme you want to create. To do this you can use either your favorite FTP client or the File Manager tool in your cPanel.
Before you start creating the theme, you should decide how the layout of your website will look like. In this tutorial we will build a WordPress theme that consist of a header, sidebar, content area and a footer ,as shown below:
To do this we will have to create the following files into the tutorial_theme directory:
  • header.php - This file will contain the code for the header section of the theme;
  • index.php - This is the main file for the theme. It will contain the code for the Main Area and will specify where the other files will be included;
  • sidebar.php - This file will contain the information about the sidebar;
  • footer.php - This file will handle your footer;
  • style.css - This file will handle the styling of your new theme;
You can either create those files locally with a simple text editor(like notepad for example) and upload them via FTP or you can use the File Manager tool in your cPanel to create the files directly on your hosting account.
Now let's take a closer look at each file and what it should contain:

The header.php file

In this file you should add the following code:
<html>
<head>
<title>Tutorial theme</title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
</head>
<body>
  <div id="wrapper">
    <div id="header">
      <h1>HEADER</h1>
    </div>
 
Basically, this is simple HTML code with a single line containing a php code and a standard WordPress function. In this file you can specify your meta tags such as the title of your website, meta description and the keywords for your page.
Right after the title the line we add <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>"> tells WordPress to load the style.css file. It will handle the styling of your website. The <?php bloginfo('stylesheet_url'); ?> part of the line is a WordPress function that actually loads the stylesheet file.
Next, we have added the beginning of a "div" with class wrapper which will be the main container of the website. We have set class for it so we can modify it via the style.css file.
After that we have added a simple label HEADER wrapped in a "div" with class "header" which will be later specified in the stylesheet file.

The index.php file

<?php get_header(); ?>
    
<div id="main">
  <div id="content">
    <h1>Main Area</h1>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h1><?php the_title(); ?></h1>
    <h4>Posted on <?php the_time('F jS, Y') ?></h4>
    <p><?php the_content(__('(more...)')); ?></p>
    <hr>
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
  </div>

  <?php get_sidebar(); ?>

  </div>

<div id="delimiter"></div>

<?php get_footer(); ?>
The code in this file begins with <?php get_header(); ?> which will include the header.php file and the code in it in the main page. It uses an internal WordPress function to do this. We will explain this in details later in this tutorial. Then we have placed a Main Area text to indicate which section of your theme is displayed in this area.
The next few lines consist of a PHP code and standard WordPress functions. This code checks whether you have posts in your blog created through the WordPress administrative area and displays them.
Next, we include the sidebar.php file with this line - <?php get_sidebar(); ?>. In this file you can display your post categories, archives etc.
After this line, we insert an empty "div" that will separate the Main Area and the Sidebar from the footer.
Finally, we add one last line - <?php get_footer(); ?> which will include the footer.php file in your page.

 The sidebar.php file

In the sidebar.php we will add the following code:
<div id="sidebar">
  <h2 class="sidebartitle"><?php _e('Categories'); ?></h2>
  <ul class="list-cat">
    <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
  </ul>
  
  <h2 class="sidebartitle"><?php _e('Archives'); ?></h2>
    <ul class="list-archives">
      <?php wp_get_archives('type=monthly'); ?>
    </ul>
</div>
In this file we use internal WordPress functions to display the Categories and Archives of posts. The WordPress function returns them as list items, therefore we have wrapped the actual functions in unsorted lists (the <ul> tags).

The footer.php file

You should add these lines to the footer.php file:
<div id="footer">
  <h1>FOOTER</h1>
</div>

</div>

</body>
</html>
With this code we add a simple FOOTER lable. Instead of this code you can add links, additional text, the copyright information for your theme and additional objects.

The style.css file

Add the following lines to the style.css file:
body {
    text-align: center;
}

#wrapper {
    display: block; 
    border: 1px #a2a2a2 solid;
    width:90%; 
    margin:0px auto;
}

#header {
    border: 2px #a2a2a2 solid;
}

#content {
    width: 75%;
    border: 2px #a2a2a2 solid;
    float: left;
}

#sidebar {
    width: 23%;
    border: 2px #a2a2a2 solid;
    float: right;
}

#delimiter {
    clear: both;
}

#footer {
    border: 2px #a2a2a2 solid;
}

.title {
    font-size: 11pt;
    font-family: verdana;
    font-weight: bold;
}
This simple css file sets the basic looks of your theme. Those lines  set the background of your page and surround the main parts of your site with borders for convenience. At this point your website should look like this:
As we have previously mentioned, internal WordPress functions are often used in the code of the theme. You can take a look at the complete Function Reference at the official website of WordPress for more information about each function.
From now on you can modify the CSS file, add images, animations and other content to your theme in order to achieve the looks you want for your blog!

Wednesday, December 19, 2012

Free Website Creation Tutorial For Beginners

Welcome!
You have arrived at a free, beginner-friendly tutorial site that will teach you to create a website and you'll be happy to know there is no web design experience needed.
Start here for a quick overview of how to start your site.
Step One
Register a Domain Name (YourSite.com)
Your website needs an address and that's exactly what a domain name is. Choose wisely because this name will represent your brand. You want to select something that fits and is memorable.
Check out these domain registration tips and discover how to get a free guide to help you start your website. Also learn how to get a domain name for only $1.99.
Step Two
Choose a Web Host
The web host is the company that houses your site and provides you with email addresses, space for your web pages, free scripts for blogging, forums, social networking, shopping carts and more.
There are two kinds of hosting options I recommend. The cheaper, do-it-yourself option is best for those who want to learn mostly on their own.
However, if you want to make money with your site, you may decide to go with Site Build It! because this system holds your hand through the brainstorming and building process.
Learn more about web hosting here.
Step Three
Start Building!
How you create your site will depend on the kind you want to make. For example, if you want to create a blog, you can take advantage of the built-in templates that come with the blogging (WordPress) platform.
No coding experience is necessary. All you do is search for the theme you want to use, activate it, make your customizations and your website is ready to go.
If you don't want to use WordPress, you can build using a more manual method or web design software.

What Kind of Site Do You Want?

There are so many different types of websites. From ecommerce, membership to content sites/blogs. Find out the best way to approach your future site. Click here for details on different kinds of websites you can create.

Creating Niche Websites

Creating Niche WebsitesA niche website focuses on a narrow market. So instead of making a website about something generic like skin care, you may choose to narrow it down to getting rid of acne, or managing eczema.
The more defined your target market is, the easier it will be to engage your audience and sell products to them.
You start by doing some keyword research so you can find a "profitable niche" and build a very useful content-rich website that caters to the audience you've defined.
Once your site is up and running you can monetize it by selling ad space, your own products, joining affiliate programs, and more.
This is the way I've been earning a living since 2006. Learn more about building niche websites here.

Site Build It! (SBI!)

Site Build It!SBI! is a premium website building system for static websites that launched in 2000.
SiteSell prides themselves on the step by step guidance they provide instead of just doling out unlimited gigabytes of web page space and a "good luck!"
Their system comes with a domain name, hosting, autoresponder, brainstorming tools (niche finder), mailing list manager, forum support, site builder, marketing tips and more.
You will receive a video action guide that will walk you through the brainstorming and website building process. The system is broken down into 10 days and you can follow along at your own pace.
SBI! is not really for blogs, but it is for people who want to make simpler, informational websites to make money with Google AdSense, affiliate programs and more.
Find out why people buy Site Build It! here.
Check out their Buy 1 Get 1 Free Offer for December.

Static HTML vs. Dynamic Websites

There are basically two kinds of websites you can create.
1) Static HTML (Content is uploaded and displayed "as is")
2) Dynamic (WordPress, Joomla, etc.) Dynamic means information is pulled from a database so you can display your website content by date, category, etc. Think blogs.
Static HTML sites are not that popular these days. In order to create them, you have to learn HTML, use templates or buy some kind of software like Dreamweaver, Artisteer, etc.
This is actually a static website that you're reading now. It was created long before blogging became popular.
With Site Build It! (above), you will be building a static website, but you don't need any software or learn website design since their system comes with a website builder.
In 2004, WordPress revolutionized the way we build websites because there is no software to buy. You simply install the WordPress script from your web host, launch the admin panel, choose a theme design and begin writing your content.
Because WordPress is dynamic, you can add functionality very easily using plugins. These are scripts (many of them are free) that you install to help you do so many things (collect visitor feedback, build surveys, add social media icons, and more.)
No longer do you have to spend time uploading complicated scripts just to add shopping carts, comments, and all other kinds of functionality to your website.
Learn more about WordPress below.

Using WordPress to Make Blogs or Dynamic Sites

WordPress LogoIf you want to create a blog website (content sorted dynamically by category and date), I would highly recommend using WordPress because it's the most flexible, robust blogging system on the Web.
What's cool about this platform is you will have access to a variety of templates you can choose from, so building your website is a breeze.
And when you're ready to change designs, just choose another theme and your site will update instantly!
As you'll see in the video on my WordPress tutorial page, WordPress is not just for blogs where your content is dated and arranged in reverse chronological order. You can use it to create a traditional, static site as well.

The Free Website Warning

You will never see me endorsing free web hosting. Not only does the web address look unprofessional (freesite.yoursite.com), but you will be very limited to what you can do with your site.
Free sites are also very risky because you don't own your content. So if the company decides to shut down, guess what happens to your content?
Yep. Right down the drain.
Many people make the mistake of starting off free with the intention of moving to a paid host later. The problem is, the process of moving to another host can be a royal pain, so you might as well do it right the first time.
Not convinced yet? Read why I believe free websites are bad.
Also, check out my article that discusses more common mistakes people make with building websites today.

Want to Build a Social Networking Site?

STOP. Before you embark on your journey to be the next Facebook, I have some important advice I want you to read about creating social media sites or any kind of website that requires user interaction/participation.
Read my tips on creating social networking sites.

How to Build Traffic to Your Website

Once your site is up and running, the best place to start building traffic is the major search engines because the traffic is free and targeted. Learn how to get listed in Google, Yahoo and Bing and create sitemaps so the engines know about all your web pages.