WordPress code and how you can give your blog a personal note


WordPress and PHP

WordPress is written in PHP, a popular scripting language used online. You probably know this, and if you’re even the least bit knowledgeable in PHP you’ll quickly find your way around Word- Press and the various functions it offers on the plugin and theme development end of things. That being said, you don’t need any prior PHP experience to do funky stuffwith WordPress. Granted, you won’t be able to create WordPress plugins without knowing PHP, but you can certainly make things happen with the built-in template tags used in themes, and that will get you a long way, if not all the way there.

The WordPress Codex, which is to say the manual in wiki form found on codex.wordpress. org (see Figure 2-1), will be very helpful when you start working with the code. You should make yourself familiar with it, since whenever you branch out from the examples in the coming articles, or when you want to know more about a concept, the Codex will be where you’ll find the information needed to keep moving. While the Codex contains basic information and tutorials, you’ll often find yourself returning to a few reference listings, such as the template tags (codex. wordpress.org/Template_Tags/), which are explained shortly, and the function reference (codex.wordpress.org/Function_Reference) for your more advanced needs.

Themes and Templates

Before moving on, you need to know about themes and template files, since that will be what we’ll be looking at next. To put it simply, a theme is a skin for your weblog. It holds the design that your content, which WordPress outputs from the database, will be displayed in. However, that is a simplification that undermines the possibilities of theme development. Sure, you can use a really basic theme that more or less just outputs the default presentation that WordPress falls back on, but you can also completely alter the way your site’s content is displayed, making it look and behave in any way but as a weblog if you want to.

A theme consists of a stylesheet file called style.css. This file holds your basic style, the theme name, and data. Along with it are a bunch of PHP files, some absolutely necessary and some just good practice to make life easier on you or make interesting stuffhappen. These PHP files are called template files. You’ll find index.php, which will be the main file for listings and search results, and is the fallback file for situations where there is no other template file available. Other common ones include sidebar.php, which holds the sidebar content, comments.php for comment functionality, and header.php/footer.php that are for your site’s header and footer, respectively. You may also have a single.php for single post view, and a page.php for static WordPress pages, and maybe a dedicated template file for search results (search.php), along with your category listings in category.php, and so on. Add any number of page templates that you can apply to WordPress pages, and you get a tiny little glimpse of how versatile WordPress is.

Personalize your Blog

With your template files, and the WordPress functions as well as plugins and traditional PHP code, you can make your site behave in just about any way imaginable. Don’t want the commenting capability enabled? Just remove the code! Maybe you want a specific product page to look completely different? Then create a page template and style it any way you like. It goes on and on, and later in the book you’ll see how to build sites that are nothing like the common weblog at all. Just to make things a little more complicated, you can have even more functionality in your themes. The file functions.php can provide plugin-like features to your theme, and we haven’t even gotten started on widgets yet, areas where you can drop elements from within the admin interface.

The best way to learn about themes is to use them. Install a theme on a test weblog, play around, and then take a look at the files it consists of. Don’t bother with images and forget about the stylesheet as well (it is just a design), but do take a look at index.php and both header.php and footer.php to understand the way they are built up. It’s not very complicated in essence: first you load header.php, then whatever main template file is used (like index.php, single.php, or something else), possibly a sidebar.php file, and then footer.php.

Legal Disclaimer

Our website is not responsible for the information contained by this article. Webworldarticles.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.


This article was sent to us by: Benjamin Huffrey at 05152010

Related Articles

1. Wordpress Plugins and Functions PHP
Plugins and Functions PHP WordPress themes and plugins usually work pretty much by themselves, coming together only when it comes to implementing features. Th...

2. When to Use Wordpress functions php
When to Use functions.php When, then, is it really a good idea to use functions.php? I have a rule for that too: only use functions. php when the added function...

3. Are you using WordPress as a CMS
WordPress as a CMS Using WordPress for things other than blogging is something that comes naturally to a lot of developers today, but not so much for the ge...

4. Things to Consider When Using WordPress as a CMS
Things to Consider When Using WordPress as a CMS So you’re considering using WordPress as a CMS for a project huh? Great, and probably a good choice too...

5. Trimming WordPress to the Essentials
Trimming WordPress to the Essentials Usually, when doing work for clients or other people within your organization, you’ll have to think a little bit diff...

6. Wordpress Static Pages and News Content
Static Pages and News Content I touched upon static Pages and categories as a news model previously. It is truly a great tool whenever you need to roll out a ty...

7. Making Widgets a Little More Dynamic
Putting Widgets to Good Use Widgets and widget areas are your friends when rolling out WordPress as a CMS. It is perhaps not as important for the small and stat...