you're who you choose to be…

Self Employed Web Designer and Web Developer. Still learn to be a great Web Designer…

How to Create a WordPress Theme from Scratch (part1)

Sep 5th in WordPress by Sam Parkinson

Creating a WordPress Theme, The Homepage Following on from the recent article on “PSD to HTML”, this tutorial will look at taking a HTML/CSS template and turning it into a functioning WordPress theme. There is so much you can do when creating your own theme we couldn’t nearly cover it all. So, we’re going to look at how themes are structured, creation of the core files and splitting up that index.html file.

Author: Sam Parkinson

I live in London, the capital city of England. I enjoy it, there is always something to do. As to what I’ve done web related, I’ve created a proxy site, a blog and a club site, I’ve also havd the pleasure of creating several web designs for a few lucky people. I’ve almost learn’t PHP, HTML and CSS are my area of expertise though I’m also a good guy to have when it comes to hardware.

Overview – The Structure Of A Theme

The structure of a WordPress theme is fairly simple, I like to start with the CSS file. It details everything about the theme for WordPress to use. You then have index.php, it’s simply the template file your using with the PHP template tags included, included with that is header.php & footer.php, files that are used across the whole site. Now most themes don’t use just four files and that’s because WordPress allows you to use template files to layout different content. There are the defined layout files, such as archives.php and single.php. However you can also create your own, say, if you wanted to make a page that had a totally different layout to the default.

Because this is such a large topic we’re splitting it into a two part series, this part making a simple but functioning theme from a standard HTML & CSS template, and the second part will look at add more of the advanced parts, such as sidebars.

I will be working on turning the great template “Typography Paramount” by Six Shooter Media into a simple WordPress theme.

Step 1 – style.css

The style sheet is the defining file of the theme for WordPress. There are a few simple things you need to do. The first is renaming the main (if you have more that one) file to style.css, next you need to add a bit of commenting to the file.

  1. /*
  2. Theme Name: Typography Paramount
  3. Theme URI: http://www.sixshootermedia.com/
  4. Description: An image-less template focusing on Typography.
  5. Author: Sam Parkinson
  6. Author URI: http://xseria.com
  7. Version: 1.0
  8. .
  9. General comments/License Statement if any.
  10. .
  11. */

The code above is all contained in a comment, so it won’t affect the style definitions. Now I filled it out with a few details, these will be used by WordPress to display the details of the theme to admins. Make sure you add it to the top of the file with no white-spaces before it.

I’ve gone and renamed the style sheet file from the template, it was called 1.css. I have also made a new folder called typography-paramount which will be what I upload to the WordPress theme folder. Put the style sheet in this folder, but not under another directory otherwise it cannot be seen by WordPress.

Step 2 – The Header and Footer

In this step we’re going to create the two files header.php and footer.php. Although they are optional both are used in most themes, there not exactly hard to use either.

header.php

Starting with the header, create a new file in the theme folder called header.php, then open up index.html from the template and copy the following from it. This will become the header and will be displayed on every page of the site, bear that in mind when making other templates.

  1. <!DOCTYPE html PUBLIC ”-//W3C//DTD XHTML 1.1//EN” ”http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&#8221;>
  2. <html xmlns=http://www.w3.org/1999/xhtml&#8221; xml:lang=“en”>
  3. <head>
  4. <title>-</title>
  5. <meta http-equiv=“content-type” content=“text/html; charset=utf-8″ />
  6. <link rel=“stylesheet” href=“css/1.css” type=“text/css” media=“screen,projection” />
  7. </head>
  8. <body>
  9. <div id=“wrapper”>
  10. <div id=“header”>
  11. <p class=“description”>
  12. An imageless template focusing on Typography.
  13. </p>
  14. <h1><a href=“#”>Typography Paramount</a></h1>
  15. <ul id=“nav”>
  16. <li><a href=“#”>Link Here</a></li>
  17. <li><a href=“#” class=“active”>Link Here</a></li>
  18. <li><a href=“#”>Link Here</a></li>
  19. <li><a href=“#”>Link Here</a></li>
  20. <li><a href=“#”>Link Here</a></li>
  21. </ul>
  22. </div>

We’re now going to add the WordPress template tags to header.php, these tell WordPress where to inject the various content into the theme. Also remember to change that link to the stylesheet.

  1. <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&#8221;>
  2. <html xmlns=http://www.w3.org/1999/xhtml&#8221; <?php language_attributes() ?>>
  3. <head profile=http://gmpg.org/xfn/11&#8243;>
  4. <title><?php bloginfo(‘name’); ?> <?php wp_title(); ?></title>
  5. <meta http-equiv=“Content-Type” content=“<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />
  6. <link rel=“stylesheet” href=“<?php bloginfo(‘stylesheet_url’); ?>” type=“text/css” media=“screen,projection” />
  7. <?php wp_head(); ?>
  8. </head>
  9. <body>
  10. <div id=“wrapper”>
  11. <div id=“header”>
  12. <p class=“description”><?php bloginfo(‘description’); ?></p>
  13. <h1><a href=“<?php echo get_option(‘home’); ?>/”><?php bloginfo(‘name’); ?></a></h1>
  14. <ul id=“nav”>
  15. <?php wp_list_pages(‘sort_column=menu_order&title_li=’); ?>
  16. </ul>
  17. </div>

There’s quite a lot that’s been added but it’s all fairly simple when you look through it. All the tags above are well documented in the WordPress Codex. I’m just going to go through what each of the functions do.

language_attributes() – Prints the language type for the <html> tag.
bloginfo() – Used to print information about the site, the parameters are available on the Codex, ‘name’ returns the title of the blog.
wp_title() – Simply returns the title of the page.
wp_head() – Prints the javascript links and other header stuff.
get_option() – Retrieves a value from the options database.
wp_list_pages() – Lists links to the site’s pages, the parameters sort the pages correctly and also stop WordPress from printing a default title.

footer.php

Create the file footer.php and copy everything in the template from <div id="footer"> down-wards and shove it in the new file. A dynamic footer that displays the correct year, site title and a feed link is common place in themes, so lets add one.

  1. <div id=“footer”>
  2. <!– Please leave this line intact –>
  3. <p>Template design by <a href=http://www.sixshootermedia.com&#8221;>Six Shooter Media</a><br />
  4. <!– you can delete below here –>
  5. © <?php the_time(‘Y’); ?> <?php bloginfo(‘name’); ?><br />
  6. <a href=“<?php bloginfo(‘rss2_url’); ?>”>Grab the feed</a></p>
  7. </div>
  8. </div>
  9. < ?php wp_footer(); ?>
  10. </body>
  11. </html>

I’ve gone and changed the footer to display the copyright icon, followed by the current year (<?php the_time('Y'); ?>) and the site’s name (<?php bloginfo('name'); ?>) then on a new line put a link to the rss feed (<?php bloginfo('rss2_url'); ?>).

wp_footer() is what WordPress uses to add things to the bottom of the site, more often that not used by plugins to add things like site tracking code.

Step 3 – The Core File

We’re now going to create index.php

index.php

This is one of the two required files for a WordPress theme (the other being style.css), so lets get started. Create the file and put it along with the rest, then add to it the following.

  1. <?php get_header(); ?>
  2. <?php get_footer(); ?>

This simple tells WordPress where to include the header.php and footer.php files. Because this is a two part series we’re going to include the creation of the sidebar in the next article. You can either chose to leave it’s div in as static html or just leave it out which is what I will do. Add the following between the previous two tags.

  1. <div id=“content”>
  2. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  3. <h2><a href=“<?php the_permalink() ?>”><?php the_title(); ?></a></h2>
  4. <?php the_content(); ?>
  5. <p><?php the_time(‘F j, Y’); ?> at <?php the_time(‘g:i a’); ?> | <?php the_category(‘, ’); ?> | <?php comments_number(‘No comment’, ’1 comment’, ‘% comments’); ?></p>
  6. <?php endwhile; else: ?>
  7. <h2>Woops…</h2>
  8. <p>Sorry, no posts we’re found.</p>
  9. <?php endif; ?>
  10. <p align=“center”><?php posts_nav_link(); ?></p>
  11. </div>

This is what WordPress call the WordPress Loop. The first line of PHP starts this loop, endwhile is the end of it. WordPress fills out the loop for each article on the site, and if there isn’t any it displays that “Woops…” content. I’ve also added a navigation link that will place link’s to more articles, so visitors can take a look at older content without using the archive.

In the next article we will write up single.php, this would be what is displayed if a visitor clicks on the title of a post. It will include the commenting system, unlike index.php.

Review – Does it Work?

So we now have four files in out theme, assuming that you didn’t forget to update you index.php file (doh!) it should work as a simple but functional theme.

Test it out in that new theme previewer that been put in the latest WordPress, after looking around there only seems to be an issue with long titles, easily fixed by adding the following to #content h2 in the style sheet.

Continue to Part 2.

sumber dari : http://nettuts.com/tutorials/wordpress/how-to-create-a-wordpress-theme-from-scratch/

About these ads

Filed under: Blog, Komputer,

About me…

me
Quick Facts
- 24 tahun.
- Muslim, mengikuti jejak para pendahulu yang sholeh.
- Suami dari 1 orang istri.Ayah satu orang putra
- Bekerja sebagai Technical Support Computer di percetakan Rotogravure.
- Mahasiswa Kelas Karyawan Universitas Mercubuana, Jurusan Desain Grafis dan Multimedia.

Yahoo status

MacManiac

MacManiac

Social Networking

Klik untuk mengenal lebih jauh Erwin di Facebook Klik untuk mengenal lebih jauh Erwin di Twitter Klik untuk melihat image yang disimpan di Picasa RSS feed

Reference 4 Design

smashingmagazine.com webdesignerdepot.com www.davidairey.com

Freebies

iconspedia.com iconarchive.com Desktop wallpaper- www.vladstudio.com

Belajar Design di sini

http://www.smashingmagazine.com http://www.designer-daily.com

Fave Linux

	
SLAX is a Linux Live CD operating system based on Slackware. It does not need to be installed on a computer system's hard drive; it boots and runs from either a CD or USB drive. There is also an option to run SLAX from RAM. SLAX was developed by Tomáš Matějíček in Czech republic using the Linux Live scripts. debian.org ubuntu.com

My File

Klik untuk melihat file saya di 4shared Klik untuk melihat file saya di mediafire

RSS smashingmagazine.com

  • Sebuah galat telah terjadi; umpan tersebut kemungkinan sedang anjlok. Coba lagi nanti.

RSS DailyDesignerNews

  • Packaging from the past: 10 awesome vintage packages
    Nowadays packages you’ll find in your local supermarkets are commonly filled with information, legal or not. Why not take a look back and see how packages were more minimalist in [...]
  • Featured designer: Loic Bard
    Montreal based designer Loïc Bard creates gorgeous furniture to make your interior much more design friendly. He’s got some design awards and press mentions for his great work.
  • Freebies wednesday
    Every wednesday, we share a few freebies that’ll make your designer toolbox a bit more useful. Slides.js Create stylish web presentations with this JavaScript tool. Those presentations are embeddable, mobile-friendly, [...]
  • 8 awesome CSS tools for productive web design
    Recently I’ve been looking for tools to improve my web design workflow, especially to work with CSS better. In this post you can discover some of the tools I have [...]
  • Featured illustrator: Oli-B
    Colorful and playful, Oli-B’s illustrations often stare at you in a mix of eyes, hands, and other body parts and geometric shapes.

RSS lifehacker

  • Give Better Criticism with These Four Rules
    Giving someone thoughtful, productive criticism is a lot harder than it seems. To keep things productive, cognitive scientist, author, and philosopher Daniel Dennett shares four simple rules to help guide you to successful critical commentary. Read more...    
  • Evernote Adds Easy-to-Use Reminders to Its Notes Apps
    Mac/iOS/Web: Evernote is incredibly popular, but it has been missing one key feature: reminders. Today, Evernote has updated its apps to include easy-to-use reminders. Read more...    
  • Focus on Consequences, Not Intentions, If You've Made Someone Angry
    When you've unintentionally angered someone, your first instinct may be to explain that making them mad wasn't your goal, and try to elaborate on what you really meant. If you've noticed that it never really seems to calm them down, here's why: your intentions matter less than the consequences of your actions.Read more...    
  • What to Expect From This Year's Memorial Day Sales
    As the unofficial start of the summer, Memorial Day is typically associated with a sunny afternoon BBQ. But for in-the-know shoppers, this holiday is also an excellent time to flex your shopping muscle. Historically, Memorial Day weekend offers the best sales since the start of the year, frequently with stacking coupons that slash prices on already-discounte […]
  • Mailbox, One of the Best Gmail Apps We've Seen, Is Now on the iPad
    iPad: Mailbox, the Gmail app that's made to help you get to inbox zero, is now available for the iPad. Like its iPhone counter-part, it sports a clean design and gesture-based interface that makes flicking through email easy. Read more...    

RSS vector tutsplus

  • How to Create Text-Free Assembly Instructions in Adobe Illustrator
    Do you like to read assembly instructions? I certainly don’t! If you’re like most people, you would rather skip the text and try to assemble something using the illustrations only. Am I right? Some people like to try to assemble things using no instructions at all! Sadly, there is nothing we can do about this group.In this tutorial, you will learn how to cre […]
  • Create a Coffee Cup Mock Up in Adobe Illustrator Using the 3D Revolve Effect
    Adobe Illustrator’s 3D effects can be a used to create quick, yet realistic product mock-ups. While not a full ray-tracing 3D application, Illustrator’s 3D feature is quite sophisticated, and it has some advantages over its more expensive counterparts. For starters, vector objects and effects can be scaled to any size without loss of quality. It’s easy to re […]
  • What’s New With Adobe InDesign CC: Interface Improvements
    In this video we are going to show you the new look of Adobe InDesign CC. You can learn how to set a custom interface brightness, how to see preview of your new documents and how can 64bit and Retina Display support help you to work more effectively with Adobe InDesign CC.
  • Creating a Simple Kawaii Yeti With Basic Shapes in Adobe Illustrator
    In this tutorial, I am going to show you how to make a cute monster character in Adobe Illustrator using basic shapes, Pathfinder panel, Width Tool, and Strokes. You will be able to apply these techniques to create other characters. Let’s get started! 1. Create the Body of the YetiStep 1Start off by creating a New Document (CMD + N) and set the artboard size […]
  • Workshop: Vector Critique #34
    Vectortuts+ is all about helping people turbo charge their skills, and today we have another special community post that will help our readers take their images to the next level. The best thing is, you can be part of it too! Find out more at the jump.How to Participate:This workshop contributor has offered a piece of work that they would like help with, ple […]
  • Tuts+ Premium Cash Back Offer: 3 Days to Go
    This offer ends soon! Act now and don’t miss out on cash back when trying a monthly Tuts+ Premium subscription.At $19 a month, Tuts+ Premium is fantastic value. But it’s even better when we hand your first $19 right back to you!For a limited time we’re offering $19 cash back to new Tuts+ Premium monthly subscribers when signing up via PayPal. If you’ve been […]
  • Create a Feisty Female Vampire and Her Pet in Adobe Illustrator
    In this tutorial I’m going to show you the inspiring process of drawing a Vampiress and her Voodoo-pet in a vintage portrait illustration with grungy elements in Adobe Illustrator. We will move step-by-step from sketch to the final vector colored image using custom brushes, gradients and the Pen Tool. Ready? Let’s get started!1. Turn Your Sketch into Vector […]
  • Create a Resting Owl Scene With Brushes and Pattern in Adobe Illustrator
    In this tutorial, we will be creating a resting owl scene using basic shapes and brushes in Adobe Illustrator. We will also be utilizing the Paintbrush Tool to create different Stroke Weights for the tree and we will be discussing various techniques for shading and designing with patterns. Let’s get started!1. Plan Your Composition By Sketching Out Your Idea […]
  • How to Create a Detailed Honey Text Effect in Adobe Illustrator
    In the following steps you will learn how to create a detailed honey text effect in Adobe Illustrator. You will learn how to create a subtle honeycomb background using basic tools, effects and blending techniques. You will learn how to create some simple brushes and how to add shading and highlights using basic blending and masking techniques. Finally, using […]
  • Quick Tip: Create a Set of Neon Art and Scatter Brushes in Illustrator
    Follow this quick tip and create your own collection of Neon Brushes in Adobe Illustrator. You will create Art Brushes and also Scatter Brushes, different colors and sizes that you can use in your projects. You’ll continue to see how you can save a set of brushes for use in the future and examples of some great quick effects you can create with your brushes. […]
Klik untuk mengenal lebih jauh Erwin

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Bergabunglah dengan 9 pengikut lainnya.

Erwin berkata….

  • 80 Kavling Ahlussunnah Murah -Tahap II -di Sedayu Bantul DIY: 80 KAVLING AHLUSSUNNAH MURAH – TAHAP II di Argod... bit.ly/17DUJDG 4 days ago
  • LIVE Daurah Fiqih Nasional IV “Matan Abu Syuja’” – Makassar: Bismillah, Mari belajar fiqih Imam Asy-Syafi’iy s... bit.ly/134dBaw 2 weeks ago
erwin @twitter

Friendfeed

View my FriendFeed
buattoko.com - memiliki toko online itu mudah

Forum Mac User

Komunitas Pengguna Apple Macintosh Indonesia
Free open source Mac software

RSS Udaramaya…

  • Sebuah galat telah terjadi; umpan tersebut kemungkinan sedang anjlok. Coba lagi nanti.

RSS New-Freeware

RSS Top ten Freeware…

RSS Techrepublic…

RSS Gizmo…

  • How to Disable JavaScript in Popular Free PDF Readers
    PDF files with malicious JavaScript embedded in them are a common way to spread malware. One way to defend against such malware is to disable JavaScript in the reader you use unless you need it for a trusted PDF. Here is how to disable JavaScript in the most commonly used free PDF readers. If JavaScript is ever needed, re-enabling it is straightforward in al […]
  • Eight PDF Files You Don’t Want to Open
    One of the largest sources of malware infections is PDF files with scripts buried in them. The embedded JavaScripts have instructions to download and install various types of malware. The Adobe Reader and Adobe Acrobat are the major targets for this kind of attack. Although Adobe seems to issue an unending stream of updates, many PC users still get infected. […]
  • How to Customize the Windows 8 Power User Menu to Suit Yourself
    Windows 8 doesn’t have a Start menu but it does have an abbreviated menu with some commonly used functions. It is variously called the 'Power User Menu', the 'Power Tasks Menu', or sometimes the 'Quick Access Menu' (Microsoft seems to have a problem with consistency of names in Windows 8). In this tip, I’ll point out a free prog […]
  • Easier Way to Use and Manage Libraries in Windows 7 and 8
    Windows 7 introduced a new way to organize files called "Libraries", which was carried over to Windows 8. Libraries are virtual folders that can centralize related items from multiple locations and can be very handy. However, their benefits are lost on many PC users who find their organization and use to be confusing or annoying. If you would like […]
  • Best Free Windows Store Apps for Your Windows 8 PC or Mobile
    You may not have noticed but we have been quietly assembling a list of the the best free apps from the Windows store that you can run on your Windows 8 PC or mobile device. Already the list has 75 applications in 58 categories so there are plenty of free goodies for you to play with. Check it out, despite all the negative press abour Windows 8, I wouldn […]

Blog Stats

  • 111,631 hits
web stats
Ikuti

Get every new post delivered to your Inbox.

%d bloggers like this: