If you want to do more advanced stuff with WordPress, you need to understand theme essentials. Naturally, you can just start hacking the default theme, or download Notes Blog Core and go from there, but there are things that won’t be obvious from just using and tinkering with the code. That’s why we’ll take a dive into the WordPress theme concept in this article to get acquainted with themes and how they work. After doing that, you’ll be able to put your knowledge to good use in the coming articles. The following two articles will discuss more advanced usage, and then you’ll take it from there.
This article will get you started with themes in the sense that you’ll see how they work and see how you can alter them to fit your needs. You’ve already played with the loop, now lets put it to good use and start building stuff.
You’re probably familiar with WordPress themes and the premises under which they operate. In short, themes are a way to separate the design from the code, but in reality there is still a lot of coding happening in the more advanced themes out there.
A theme consists of a folder with template files and any other files that may be needed. The only two absolutely necessary template files are style.css and index.php. The former contains the header that identifies your theme, while the latter is the basic layout. In fact, even if you don’t put in the sidebar.php template file, or the comments.php comments template, you’ll get both sidebar and comment functionality served by WordPress automatically. If you’re looking for a challenge, try to create a WordPress theme consisting of just the two necessary files, and see what you can do with it. It is an interesting exercise, but is not all that great an idea for more advanced sites, of course.
The style.css is not only a stylesheet, but also the theme’s header file, so to speak. This is the file that identifies the theme, and it needs to start with some basic information:
/* Theme Name: Your Theme Name Theme URI: http://your-theme-homepage.com Description: Oh what a lovely description of your theme you'll put here! Author: Your Name Author URI: http://your-website.com Template: If this is a child theme, you'll set the template theme's folder name here Version: A version number . Any general information, license statements, plugin requirements, or any other information you might want to share. . */
Version numbering and template information is optional. Templates and child themes are covered later on, along with delving deeper into the concept. Without this code on the top of the style.css, WordPress won’t recognize your theme as a theme, and that in turn means that you won’t be able to activate it. Not doing much good then, huh?
Like any properly coded Web site, you’ll need a doctype heading and title tags and such. While you can rely on WordPress to serve the default headings needed with your get_header() call in index.php, it is a better idea to have your own header.php template file. Add a footer.php file while you’re at it, and some proper comment handling with comments.php, and you’re getting somewhere.
Our website is not responsible for the information contained by this article. Articleinput.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.
Note: This article was sent to us by: Rodney Merkan at 05152010
1. Making the Most of Image sharing Services in Wordpress
All articles are property of their respective authors. Please read our Privacy Policy!
© 2009 ArticleInput.com.
Partners: Damenmode