Realtime hit counterweb stats

So You Want To Design Custom Templates for WordPress….

Posted by AdaptiveBlog | Posted in Tutorials - WordPress, WordPress | Posted on 19-08-2010

4

Creating a WordPress theme from scratch is not hard. I’ll hold your hand through it.

Tutorials on this topic have been written before and the WordPress website also has guides for you to follow. But are those tutorials and guides really helpful to you when you don’t understand the lingo? Even I got lost while reading the WordPress guides.

Tools – Before we get started tomorrow, you’ll need:

  • WordPress installed on your computer. Follow the instructions on Installing WordPress Locally Under Windows XP. If you can’t install WordPress on your computer for whatever reason, no worries, just make a dummy WordPress install on your website.
  • Notepad or other text editors. I use Notepad.
  • SmartFTP – If you’ll be testing your theme online, I’d suggest that you download and install SmartFTP or another FTP program to upload your theme files.
  • Bookmark XHTML Validator and CSS Validator. You’ll need those tools to validate your theme. They also come in handy when you need to spot and fix errors.

Complete Lessons Listing

#1 Intro

#2 Index.php

WP Theme Lesson #2: Starting Index.php

Posted by AdaptiveBlog | Posted in Tutorials - WordPress, WordPress | Posted on 24-08-2010

0

Starting Index.php is the third lesson of my WordPress theme tutorial series. If you haven’t read lesson one and two I’d suggest you read them. Otherwise, you will not have a clue of what I’ll show you in this lesson.

It’s time to stop reading and start creating your WordPress Theme. In this lesson, you’ll get your hands dirty with some WordPress codes. This is the part where you really need a WordPress blog installed on your computer, not an online blog because offline is more convenient.

Step 1: Open Xampp Control.

Navigate to your xampp folder. Usually My Computer > xampp or C:\xampp.

Double click on xampp-control.exe. A window will pop up. Click on start for Apache and MySQL. Your pop up window should mirror the image below:

Now that it’s turned on, you can minimize that window.

Step 2: Create your theme folder.

Go to your wordpress themes folder. It should be at xampp/htdocs/wordpress/wp-content/themes. Create a new folder. Name it tutorial.

Step 3: Create index.php and style.css files.

Open up Notepad or the text editor of your choice. Notepad is at Start > Programs > Accessories > Notepad.

Copy and paste everything from this file: index.txt to your Notepad window.

Save your notepad in the tutorial folder as index.php

 

Open another notepad. Leave it empty. Save the empty notepad as style.css, in the same folder. Close the style.css notepad.

 

So now you have two files: index.php and style.css.

 

 

index.php Explanations:

Click on the image above for the full view. I will explain to you what each circled area does.

Doctype – Indicates what kind of codes you’re using to code your theme. Doctype is not important at this point. I’m pointing out Doctype so you don’t have think about it.

<html> is where my web page starts.

<head> is where the head of my web page starts. Every web page has a head and a body. </head> is where the head ends.

<?php bloginfo(‘stylesheet_url’); ?> is a PHP function that calls for the location of the style.css file so my theme can link to it and style everything on my pages. Anytime codes are wrapped in <?php and ?>, it’s PHP and it’s different from the rest of my codes. In PHP, <?php is start and ?> is end.

So:

  • <?php – start PHP
  • bloginfo(‘stylesheet_url’) – call for the location of style.css
  • ; – stop calling for style.css. The semicolon is one way of closing a set of codes within PHP.
  • ?> – end PHP

Moving on…

<body> – This is where the body starts. The body is everything that I see and read on a web page. Reading this tutorial means I’m looking at the body of the web page. </body> is where the body ends.

</html> is where my web page ends. Nothing else after that.

Step 4: Copy and paste everything in style.txt to your style.css file. Save and close it.

Step 5: Setting up your theme.

Open up a browser.

Type: http://localhost/wordpress/wp-login.php. Go to it and login into your WordPress administration area. (You’re able to see the login page because you opened the Xampp Control in the first step. Otherwise, your browser will give you a Not Found error.

Looking at the administration area. Click on Presentation and click on the theme named Tutorial to activate it.

Notice, your theme does not have a thumbnail screeshot yet. The box is empty. Once activated, WordPress will tell you.

Now open up a new browser or tab (if your browser has tab browsing) and go to http://localhost/wordpress. You should then get a blank page. I mean completely blank. If it isn’t blank, you’re at the wrong page.

Your theme has been set up. That’s it for this lesson. Next up, we start working on the header template.

Don’t forget to close your Xampp Control. Double click on its tray icon in your toolbar, click Stop for Apache and MySQL. Then click exit.

 

Have a question? Use the comment form below to ask me.

An intro to WordPress Custom Themes

Posted by AdaptiveBlog | Posted in Tutorials - WordPress, WordPress | Posted on 19-08-2010

2

Intro is the first lesson of my tutorial series about creating WordPress themes. I will not teach you everything all at once. That will only confuse you. What I’ll show you is not a reference. It’s meant to teach you step-by-step, level-by-level. If you want a reference to everything WordPress themes, then read WordPress.org’s documentations, Design and Layout. Otherwise, learn from my lessons.

This lesson covers:

  • Basic Rules
  • Lingo / Terminology
  • Hierarchy

Basic rules:

  • Rule #1: Close everything in the order that you open them.

    Right and Wrong way to close

    In The Wrong Way to Close, the closing ul tag is out of order.

    Every tag is wrapped by the < and > characters, the presence of the forward slash, /, indicates whether each tag is an opening or closing tag. <> is open. </> is close. In the example, I used the ul (unordered list) and li (list item) tags. Notice how the opening and closing li tags sit inside the opening and closing ul tags. That’s called nesting.

  • Rule #2: Every theme has at least two files – style.css and index.php. You tell your theme where everything goes within index.php and how everything should look like within style.css.

    Here is the complete list of files (don’t worry about this list yet):

    • style.css
    • index.php
    • home.php
    • single.php
    • page.php
    • archive.php
    • category.php
    • search.php
    • 404.php
    • comments.php
    • comments-popup.php
    • author.php
    • date.php

Lingo:

  • Template – A set of codes that you can use in multiple places without having to write the same codes again and again.
  • Template file – A file that contain one or multiple sets of codes (templates). Every page is made up of multiple template files. For example: index.php file, style.css file, sidebar.php, etc.
  • Theme or WordPress theme – All the files you’re using: texts, images, codes, etc. Note: WordPress theme and WordPress template(s) are two different things, despite some people consider them the same.
  • Post - Currently, you are reading a post. Furthermore, it’s simply an entry of your blog. In example, one page of a diary.
  • Page – A special type of post that is not orangized by categories. It is separate from the rest of your posts. Note: In WordPress, page and Page are two different things. Whether you capitalize the “P” makes a huge difference.

Hierarchy:

The diagram below simply shows you what the WordPress system will look for, in case one of your theme file is missing. I listed only six files, instead of thirteen in the diagram because those are the main ones that you should focus on. Further down this tutorial series, you will learn about the rest of the files.

main-hierarchy.gif

I’ve indicated the level of importance of each file by its position. Top, left is most important. Bottom, right is least important.

Hierarchy or levels of importance exists for template files because if the archive.php file, which handles the look for archive pages, is missing, then WordPress will point to the index.php to control how the archive page will look like.

If the single.php template file is missing, which template file does it look for to display a single post view? It looks for index.php.

If you have any question, feel free to ask. Please do it through the comment form below, instead of emailing me. That way, others looking for the same answers don’t have to repeat their questions.

Follow this WordPress Theme Tutorial Series from the beginning.

The WordPress Web Design Strategy

Posted by AdaptiveBlog | Posted in WordPress | Posted on 21-07-2010

0

In the last couple of years, a new type of web designer has emerged: the WordPress web designer.

What is a WordPress web designer?

In a nutshell: smart, forward thinking web designers that base most if not all of their web design work off of WordPress. That means the entire web site is built using WordPress.

Why build all your sites using WordPress?

For the very same reason you don’t go the woods to kill a turkey for Thanksgiving (you go to the grocery store) … is why WordPress web designers don’t build static HTML websites – why would you not take advantages of all the things that WordPress does for you for free!

… Some nerd details:

When basing your web site off of WordPress, you get all this functionality for free:

1. Advanced templating for easy site wide updates.
2. Built-in SEO
3. Automatic search and categorizing of your content.
4. Built-in image upload and insertion.
5. Built-in text editor and the ability for non-nerds to add, edit delete pages.

… And that is just scratching the surface!

The economic advantages of using WordPress

If you haven’t guessed it already, using WordPress in your day-to-day web work WILL have major economic advantages – in a nutshell, you will be able to provide a lot more for your clients for a lot less work! This will lead to you landing more web design contracts and making more cash because the extra WordPress skills will allow you to charge more for your time.

Until next time,

Scott Beach

What You Need To Create Unique WordPress Themes.

Posted by AdaptiveBlog | Posted in WordPress | Posted on 21-07-2010

0

What do you need to know in order to be able to edit or create a WordPress theme?

I would say that you need to know three basic things:

HTML/XHTML
CSS
The WordPress page hierarchy and behavior.
I think the first two are obvious, but the last needs some more explaining.

What is the WordPress page hierarchy and behavior?

In a nutshell: WordPress has a hierarchy of template pages that it follows whenever someone request a post.

… If WordPress can’t find a certain template, it will fall back and use the default (index.php) to display the information. If this doesn’t make sense, please check out the diagram below … it should help:

For example:

Let’s say a visitor uses the built-in WordPress search capability. To display the search results, the WordPress engine will first try to load the ’search.php’ template page. If it can’t find it, WordPress will use the ‘index.php’ instead.

So what the diagram shows you, is that the index.php page is kinda the ‘master template’ … and if any of the other templates can’t be found, the WordPress engine can always use index.php.

… I hope this makes a little sense.

Why do you have to understand this?

Now that we understand how the WordPress engine looks for page templates in a theme, we now know what page templates we need to build.

Does a theme have to include ALL the template pages?

If it isn’t already obvious, you can get away with creating a theme with only one template page: index.php.

In this ultra simple theme, all your pages would be exactly the same since the WordPress engine would be using the same template (index.php) for all the page types. That said, you will also need the default ’styles.css’ file for all your CSS code.

So the bare minimum theme must only have two files:

index.php
styles.css
To customize all the possible pages that WordPress can display, you would need to include all these page templates:

* style.css
* index.php
* home.php
* single.php
* page.php
* archive.php
* category.php
* search.php
* 404.php
* comments.php
* comments-popup.php
* author.php
* date.php

Conclusion

The point of this article was to give you a global understanding of what it takes to create themes in WordPress.

If you guys want to learn more about creating themes for WordPress … let me know.

Thanks,

Scott Beach