Saturday, March 23, 2013

How to Make a Featured Post Carousel for WordPress

Conceiving the default likeness
Before we do any thing, proceed to the topics folder of your WordPress installation (wp-content/topics/) and make a backup of the "default" folder. This is the Kubrik theme we will be revising. The backup is in case you desire to revert back to the initial, unmodified topic.

First, we’re going to make a default likeness in the happening no boasted mail image is specified. Let’s hold it sugary and easy for this tutorial. Open up your preferred image editor and conceive a 233x130px rectangle with 10px radius circular corners. I made the backdrop a white to grey radial gradient and put some text on peak. This is what I have:

Add the PHP code
Now for the cipher. Open the “header.php” document interior the “default” folder. At the end of the document, you will glimpse a div impede and an hr tag like this:

<div id="header">
    <div id="headerimg">
        <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
        <div class="description"><?php bloginfo('description'); ?></div>
    </div>
</div>
<hr />

Between the ending div tag and the hr, insert the following code:
<div id="featured">
    <ul id="carousel">
        <?php
        $featured_posts = get_posts('numberposts=3&category=1');
       
        foreach( $featured_posts as $post ) {
            $custom_image = get_post_custom_values('featured_image', $post->ID);
            $image = $custom_image[0] ? $custom_image[0] : get_bloginfo("template_directory")."/images/no-featured-image.jpg";
            printf('<li><a href="%s" title="%s"><img src="%s" alt="%s" /></a></li>', get_permalink($post->ID), $post->post_title, $image, $post->post_title);
        }
        ?>
    </ul>
    <div class="clear"></div>
</div>

Style with CSS
Next we need to add some CSS styles. Open up the “style.css” document and put the following code below at the end of the document. All this does is float the register elements to the left and space them out equally.

/* Featured Post Carousel */

#featured {
    padding: 10px 10px 0 20px;
    }

#carousel {
    list-style: none;
    margin: 0;
    padding: 0;
    }

#carousel li {
    float: left;
    padding: 0;
    margin-right: 10px;



Comprehending the code
Let’s take a look at what the cipher we added does. Inside the canister div (id=”featured”) we have an unordered list and some PHP cipher to develop register elements.

$featured_posts = get_posts('numberposts=3&category=<strong>1</strong>'); 

The first line shown above retrieves the mail data using the get_mails() function and assigns the mail data to the $featured_posts variable. The get_posts() function excepts a single parameter in the form of a query string similar to what you might glimpse at the end of a URL (sans the primary inquiry mark). The first parameter is “numberposts” which we’ve set to 3 for this tutorial. This parameter sets how numerous boasted posts we will be showing. The second parameter is “category” which we’ve set to 1. The worth of the “category” parameter should be the ID of the category you are utilising for your boasted posts. You can find the ID of a class by going to the class administration sheet and hovering your mouse over a class title. The rank bar will display a link. The last number is the class ID. 

The next line is a foreach loop that will loop through the mails we’ve retrieved utilising the get_mails() function. The first line interior the foreach loop retrieves the URL of the image utilising the get_post_custom_values() function and shops the URL in the $custom_image variable. The first parameter identifies the key of the made-to-order value we’re utilising, “featured_image”. The second parameter identifies what post we’re getting the worth from. 
  
$custom_image = get_post_custom_values('featured_image'$post->ID);  


In the next line we do a quick check to see if an image was indeed specified. If no image was specified, we assign the $image variable the URL of the default image. If an image was specified, we use that.

$image = $custom_image[0] ? $custom_image[0] : get_bloginfo("template_directory")."/images/no-featured-image.jpg"; 

In the last line we actually output the list elements. Each element is an image that links to the featured post.
    printf('<li><a href="%s" title="%s"><img src="%s" alt="%s" /></a></li>', get_permalink($post->ID), $post->post_title, $image, $post->post_title); 

Creating Featured Posts
That’s it! Now, whenever you want to feature a post, assign it to the featured category and create a custom value with a key of “featured_image” and a value of the image URL. Images should be 233x130px.
 


   

Beginner’s Guide to WordPress Menus

WordPress boasts an excellent way to organise your site’s menus, but it may not be apparent when you first install your location. In detail, a fresh setting up doesn’t use the easy list scheme at all–you have to snare that up yourself. pursue along as I display you the list system basics and how to start utilising it on your new site.

Employed with the initial WordPress meal lists
When you first establish a new WordPress location, most meal lists work in what I call “the old way.” For my demonstration, let’s refer to the Twenty Eleven topic. Out of the carton, the theme’s top navigation list is populated automatically. Each new page (as opposed to mail) supplemented to your location is mechanically supplemented to the list, in alphabetical order. Thankfully, progeny sheets gaze nice in the list, appearing as second- and third-level pages, accordingly.

So what’s the difficulty?
Put succinctly, this procedure of populating the menu bounds you in the following ways:
  • No command over the alignment of menu pieces.
  • No command to depart some pages off the menu.
  • No way to add anything other than pages.

Altering menus the hard way
suspend on–there’s habitually a way to get what you need in WordPress. If you understand a few template tags and don’t mind revising the cipher in your theme’s template, you can command all those things and more. The issue is, meal lists should be manageable from a amicable client interface–not from backend cipher needing some mechanical information.

The first step in the menu management interface is to create a new list. Then, you can add any sheet, post, class sheet, custom connection, and more to the list. Finally, organise the alignment of list items by pulling and dropping them where they need to be. Even creation of sub-menus is but a click-and-drag away, intuitively comprised by indenting sub-menus in the interface.

After you’ve constructed one or more menus, simply accredit them to distinct menu locations sustained by your theme. It’s rare for topics to not support at smallest 1 list location. If your very popular topic has no locations, you can ascertain out my item displaying how to effortlessly add list support to any topic.

No list support in your favorite topic? No problem.
WordPress lists-Screenshot of list Widget setupWhether or not your theme supports menu locations, you can add meal lists to sidebars as widgets. Simply add a widget to the sidebar of your alternative. You can give the widget a title, tell it which list to brandish, and you’re off to the races–as they say.

Thursday, March 21, 2013

Introduction to WordPress Terminology

WordPress was conceived by the developers as weblogging or blogging programs. A blog, as defined in the Codex Glossary, is an online periodical, diary, or successive, released by a person or assembly of persons. numerous blogs are personal in nature, mirroring the attitudes and concerns of the proprietor. But, blogs are now important devices in the world of report, business, politics, and amusement.

Blogs are a form of a Content Management System (CMS) which Wikipedia calls "a system utilised to organize and facilitate collaborative content creation." Both blogs and Content Management Systems can present the function of a website (site for short). A website can be considered of as a collection of articles and information about a exact subject, service, or product, which may not be a individual reflection of the owner. More lately, as the role of WordPress has expanded, WordPress developers have started using the more general term site, in location of blog.

Terminology associated to Content
The period Word in WordPress mentions to the phrases utilised to compose posts. mails are the principal component (or content) of a blog. The posts are the writings, compositions, considerations, discourses, musings, and, yes, the rantings of the blog's owner and visitor authors. mails, in most cases, are the cause a blog exists; without mails, there is no blog!

To facilitate the mail writing method, WordPress provides a full featured authoring tool with modules that can be moved, via drag-and-drop, to fit the needs of all authors. The Dashboard QuickPress module makes it easy to rapidly compose and release a mail. There's no excuse for not composing.

Integral to a blog are the images, images, sounds, and videos, else know as newspapers. newspapers enhances, and gives life to a blog's content. WordPress presents an easy to use procedure of injecting newspapers exactly into mails, and a method to upload newspapers that can be subsequent attached to mails, and a Media supervisor to organise those various Media.

An significant part of the posting method is the act of assigning those mails to categories. Each mail in WordPress is filed under one or more classes. classes can be hierarchical in environment, where one class actions as a parent to some child, or offspring, classes. Thoughtful categorization permits posts of alike content to be grouped, thereby aiding viewers in the navigation, and use of a site. In supplement to classes, periods or keywords called tags can be allotted to each mail. Tags act as another navigation device, but are not hierarchical in environment. Both classes and tags are part of a system called taxonomies. If classes and tags are not sufficient, users can also conceive made-to-order taxonomies that allow more exact identification of mails or sheets or made-to-order post kinds.

In turn, mail classes and tags are two of the components of what's called post meta facts and figures. mail meta data refers to the data affiliated with each mail and includes the author's name and the designated day posted as well as the mail categories. mail meta facts and figures also mentions to Custom areas where you assign specific phrases, or keys, that can recount mails. But, you can't mention post meta data without considering the period meta.

usually, meta means "information about"; in WordPress, meta usually refers to administrative-type data. So, in addition to post meta facts and figures, Meta is the HTML tag used to describe and characterise a world wide world wide web sheet to the out-of-doors world, like meta tag keywords for seek engines. furthermore, numerous WordPress-based sites offer a Meta section, generally discovered in the sidebar, with links to login or list at that location. And, don't forget Meta Rules: The rules characterising the general protocol to follow in utilising this Codex, or Meta, as in the MediaWiki namespace that refers to administrative purposes within Codex. That's a allotment of Meta!

After a mail is made public, a blog's readers will respond, by remarks, to that mail, and in turn, authors will answer. Comments endow the connection method, that give-and-take, between scribe and book reader. remarks are the life-blood of most blogs.

Finally, WordPress furthermore boasts two other content administration tools called sheets and made-to-order mail types. sheets often present static information, such as "About Me", or "Contact Us", Pages. Typically "timeless" in nature, Pages should not be bewildered with the time-oriented objects called posts. Interestingly, a sheet is permitted to be commented upon, but a sheet will not be categorized. A made-to-order mail kind mentions to a kind of organised data that is distinct from a mail or a sheet. Custom post kinds permit users to effortlessly conceive and manage such things as portfolios, tasks, video libraries, podcasts, extracts, chats, and anything a user or developer can envisage.
 
Terminology associated to Design
The flexibility of WordPress is clear-cut when discussing terminology associated to the design of a WordPress blog. At the centre of WordPress, developers conceived a programming structure entitled The Loop to handle the processing of mails. The Loop is the critical PHP program code used to brandish posts. Anyone liking to enhance and customize WordPress will need to understand the mechanics of The Loop.

Along with The Loop, WordPress developers have created Template Tags which are a assembly of PHP purposes that can be invoked by designers to present an activity or display exact information. It is the Template Tags that form the cornerstone of the Template documents. Templates (files) comprise the programming parts, such as Template Tags, that command the structure and flow of a WordPress location. These documents draw information from your WordPress MySQL database and develop the HTML code which is dispatched to the web browser. A Template Hierarchy, in essence the order of processing, dictates how Templates control nearly all facets of the output, encompassing Headers, Sidebars, and Archives. Archives are a dynamically developed list of mails, and are typically grouped by designated day, class, tag, or author.

Templates and Template Tags are two of the parts utilised in the composition of a WordPress topic. A topic is the overall design of a site and embraces color, graphics, and text. A Theme is occasionally called the skin. With the recent improvement in WordPress, Theme Development is a warm topic. WordPress-site proprietors have accessible a long list of topics to choose from in concluding what to present to their sites' viewers. In detail, with the use of a topic Switcher Revisited Plugin, WordPress designers can permit their tourists to select their own Theme.

As the capabilities of WordPress have advanced, developers have added devices that permit users to easily organise a site's gaze and functionality:
  • Widgets provide an very simple way to add little programs, such as the current climate, to a sidebar.
  • Meal lists make it easy to characterise the navigation buttons that are normally present near the peak of a site's pages.
  • The backdrop tool allows the client to change the background image and hue of a location.
  • The Header device gives the client command of the images brandished at the top of a site's various sheets.
  • Formats allow the client to control the display of a exact mail (i.e. display this post as an apart or as a quote or as a gallery). The WordPress Twenty Twelve topic is an excellent example of a topic that benefits these devices.

And speaking of the WordPress Twenty Twelve topic, developers and users are boosted to discover that theme in minutia. The WordPress Twenty Twelve topic, evolved by the WordPress community, demonstrates the use of devices such as meal lists and Widgets, presents examples of recommended topic cipher methods, and emphasizes the use of the Child topic notion to shield a theme from getting overwritten during a WordPress update.

Plugins are made-to-order purposes created to extend the centre functionality of WordPress. The WordPress developers have maximized flexibility and minimized code bloat by permitting out-of-doors developers the opening to conceive their own useful add-on characteristics. As evidenced by the Plugin book or directions, there's a Plugin to enhance virtually every aspect of WordPress. A Plugin administration tool makes it exceedingly easy to find and install Plugins.

Terminology for the manager
Another set of periods to analyze are those involving the Administration of a WordPress site. A comprehensive set of management Panels endows users to effortlessly administer and supervise their blog. A WordPress administrator has a number of powers which encompass requiring a tourist to list in alignment to take part in the blog, who can conceive new mails, whether remarks can be left, and if documents can be uploaded to the blog. An manager furthermore characterises connections and the associated connection Categories which are an significant part of a blog's connection to the out-of-doors world.

Some of the major administrative responsibilities of a WordPress blog engage supplementing, deleting, and managing listed Users. Administering users means commanding functions and Capabilities, or permissions. functions control what functions a listed client can present as those functions can range from just being able to login at a blog to accomplishing the role manager.

Another chief anxiety for the blog administrator is commentary Moderation. commentarys, also called considerations, are answers to mails left for the mail scribe by the tourist and represent an important part of "the give and take" of a blog. But remarks should be patrolled for Spam and other malicious aims. The WordPress management remarks SubPanel simplifies that method with easy-to-use partitions which add, change, and delete remarks.

And not to be disregarded is the obligation for an manager to hold their WordPress present to insure that the newest features, bugs, and security repairs are in effect. To accomodate administrators, WordPress has a simple improvement Tool to download and establish the lastest type of WordPress. There's no apologise to not improvement!
 
The Terminology of Help
The final set of jargon connects to assisting you with WordPress. First and foremost is the suspending Help tab that is brandished under each of the Administration SubPanels. That framework help describes the function and use of the current SubPanel and provides connections to other help topics. And, there are other help assets available to WordPress users; Getting More Help, Finding WordPress Help, Troubleshooting, and WordPress FAQ (frequently inquired inquiries) are good starting points. furthermore Getting begun with WordPress will jump-start readers into the world of WordPress and the very good WordPress courses provide in-depth tutorials on numerous of the facets of utilising WordPress. Among the most significant resources is the WordPress Support Forum where knowing volunteers response your questions and help solve any problems associated to WordPress. And, of course, this Codex which is topped up with hundreds of items designed to make your WordPress experience a achievement!

History of the WordPress Name
in addition to the technical terminology of WordPress, it's also intriguing to understand the annals of the title, WordPress. The name "WordPress" was initially coined by Christine Selleck (see associated post) in response to developer Matthew Mullenweg's yearn to aide his new programs task with printing presses. In this sense, press refers to the world of reporters, reporters, columnists, and photographers. An aptly chosen title, because WordPress serves as the publishing press that endows its users to release their words.

First Steps With WordPress

Let's take a step-by-step trip through your WordPress location and glimpse how the distinct purposes work and how to make your new location your own. During the first part of this tutorial, delight don't change anything inside the program unless it is part of the tutorial. After following these steps, you'll shortly be changing everything.

Log In
start by logging into the “administration locality” or the back end of your website. Visit your site's login page by putting "wp-admin" after your domain name (e.g. http://example.com/wp-admin). You can furthermore place "login" after your domain as of WordPress 3.4. Some topics supply a "log in" connection or pattern on the front end as well. Now log into WordPress using your username and password.

Start at the peak
After logging in you are on the main management Screen called the Dashboard. This is the brain behind your website, the place where you can let your creativity blow up, composing brilliant prose and conceiving the best and most beautiful website possible. This is where the association of your location starts - and this is just the start.

check propel Your WordPress location
Take time to look at the location before you get into the changing of things and figuring out how all of this works; it's significant to glimpse how the WordPress Twenty Twelve theme is prepared out and works. Consider this the test propel before you start supplementing on all the special characteristics.

The layout you are looking at is called a WordPress topic. It is the appearance of your website, fashioning the gaze of the site and the border of the content. The WordPress Twenty Twelve theme characteristics a "header" at the top with the name and tagline for your location. Below this is your Menu. Along the side you will glimpse some names and connections. This comprises Widgets Within the major middle part of the page is the content area. At the base of the page is the footer.

Let's gaze at the mail for a moment. There is a "name," and underneath the name is date the post was in writing, then the body of the post, and eventually some data about the post. This is called the mail meta facts and figures and comprises data about the mail such as the class allotted to that mail.

Scroll down the sheet and notice the bar at the end of the sheet. This is called the "footer." It says "Proudly powered by WordPress."

Back to the sidebar, you will see distinct sections with data. Among these you may find a register of latest Posts, latest remarks, Archives, classes, and connections to the Admininstration Screens, Log Out, and RSS feeds. This is part of the menu or navigation computer display that persons will use to move around your location, travelling to mails from distinct categories or time periods.

It's All in the minutia
Take time to notice the lesser minutia of this world wide web page layout and design. Move your mouse over the title of the item post. observe how it alterations color. This is called a hover. Most topics characteristic a distinctive hue or underscore when you move your mouse over a connection. Move your mouse over any of the connections in the sidebar. Do they change? Is the change the identical? You can change your link hovers to gaze distinct in distinct parts of your page. furthermore look at the hue of the connections. How are they tinted or underscored to stand out from the rest of the text?

Observe the little design minutia and where they are put inside the sheet. In the beside future, you may desire to change some of these details, such as the color of the title in the white carton at the peak of the sheet. If you recall that is called the header then you will understand to gaze within the header section of your method sheet, the document that controls the gaze of your world wide world wide web sheet, when you want to make alterations to it.

Take a fast journey round
For now you only have one post. It is residing inside a sheet that is prepared out as your home sheet or the front page. If you bang on the title of the mail, it will take you to the exact page for that mail. The first sheet or dwelling sheet of your location features the most latest mails on your location. Each mail name will connection to the genuine sheet of the mail. Some topic conceiveers conceive their lone mail pages to gaze distinct from the dwelling sheet. By banging on the title, you are taken to another world wide web sheet that examines distinct from the dwelling sheet.

afresh, in the lone post, pay vigilance to the layout and observe what is now different about the conceive components. Is the header distinct? Smaller, bigger, or a distinct color? Is there a sidebar?

mails are generally stored in classes and/or Tags so you can keep associated topics simultaneously. Right now you only have one category, but will shortly desire more. bang on the lone category that seems in the sidebar of the home page. You are now in a sheet that has been developed to brandish only the posts inside that class. Again, take a gaze at the layout and glimpse how it may be distinct from the home page and the lone mail.

Do the identical with the Archives. You may only have one post, but gaze at how the sheets are laid out. They may or may not change, but gaze at all of it to glimpse how it all works.

All of these changes are created from only a couple of documents called template documents and you can learn more about how they work in pacing Into Templates. For now, although, let's get on with how the rest of WordPress works.

WordPress Admin Dashboard
Now that you have an idea of how your site examines and what the distinct layout parts are called, it's time to check drive the WordPress management. This is like familiarizing yourself with the backend of your new website. In detail, the first page you see after logging in is called the Dashboard, a assemblage of data and facts and figures about the activities and activities on your WordPress location.

The Dashboard assists to hold you up to designated day on new and intriguing morsels of data from the numerous WordPress resources. In the corner it also characteristics a register of the most latest undertaking you've carried out on your location.

On the left edge of the computer display is the major navigation menu detailing each of the administrative purposes you can perform. Move your mouse down the register and the sub-menus will "fly out" for you to move your mouse to and bang. Once you choose a "parent" navigation section, it will open up to disclose the choices within that section. 

The various menu items are as follows:
  •     Dashboard
  •     Posts
  •     Media
  •     Links
  •     Pages
  •     Comments
  •     Appearance
  •     Plugins
  •     Users
  •     Tools
  •     Settings  
The links in the overhead register will take you to a sequence of items that will guide you step-by-step through every facet of the Admin Screens. You're troubled to get started, so for now, let's start with the Users computer display.

User Profile computer display
Click on the Users tab. The computer display will change and you will glimpse the computer display called All Users that displays a register of all your users; from here you can add or change living users and authors anecdotes. In the navigation list, click on the Your Profile list choice. This is where you will go in data about you, the scribe and administrator of the location. load up in the information and bang revise Profile when finished.

Now, let's gaze at some other powerful features of the WordPress Admin.

The Appearance computer display
The Appearance, topics computer display permits you to change the look of your location utilising different topics. topics are production styles that completely change the look of your location. conceived by WordPress developers and users, there are hundreds of topics accessible for you to select from. In your Appearance Screen, you will see register of actually established topics, encompassing the WordPress Twenty Twelve theme. To this quick-change method, easily bang on the Activate button under one of the themes recorded, then bang on your location title in the peak toolbar to glimpse how it gazes. Wow, you have another gaze and not anything else on the site has altered. It's that very simple.

proceed back to the look > topic Screen and bang the trigger button under the WordPress Twenty Twelve theme to convey the design back to what you had. To glimpse it afresh, click your location title in the toolbar, and there it is.

Add New mail computer display
Back in the management computer display, take a look at the mails computer display. You can use the tabs under the mails Menu to compose and manage your mails. Let's start by making your first check mail in the Add New tab.

If the computer display examines a little threatening, the Codex item on composing a mail will take you step-by-step through the method of composing a mail. Take a moment to read through the item and post your first application and then come back to this item and we'll take you onto the next step.

If you are in a rush, then simply fill in the spaces, one by one, in the post starting with the title and then compose a little test message in the post window. This is just for a test, so you can write anything you want. When you are done, bang the Publish button that is to the right of the post application window and it is done. You will then glimpse a bare compose a mail screen and you're prepared to write another post. proceed ahead. But do only three to four applications. There's more stimulating work ahead!

Now that you've gotten a seem for composing mails, you can view your mails by banging your location title in the toolbar at peak of the computer display. Now it's time to get down to the genuine work.

Designing meeting
All good websites come from a good design. noise redundant, but it's true. If you desire to create a good and solid website, you need a good and solid plan. I understand it's hard to do, and I understand you desire to keep poking and playing with this stimulating program, but it is time to take a shatter away from your computer and turn to the vintage paper and ballpoint. That's right, we're going back in time to when people really wrote things down.

On a part of notebook paper, or anything is lying round, recount your site. Take five to twenty minutes to come up with a reason for your site, or better yet, call it your operation Statement. 

Monday, March 18, 2013

How to install Simple PayPal Shopping Cart


There are two standard choices for installing a WordPress Plugin. You can either use the seek or Upload functionality.

For this tutorial we will illustrate how to present the setting up by seeking for the yearned plugin.

First log into the manager area of your WordPress installation. Then proceed to Plugins -> Add New.


In the seek field select period from the drop-down list, then enter “Simple Paypal buying Cart” in the text carton and bang the “Search Plugins” button.


The “WordPress Simple Paypal buying Cart” should appear as first result. bang the establish connection for it.


In the new window that will pop-up bang the “Install Now” button.


The plugin will be automatically downloaded and established for your WordPress. Once the setting up is accomplished, click the Activate Plugin link.


The WordPress buying Cart is now installed and you can adjust the settings for it and adapt the choices according to your desires. proceed to backgrounds -> WP Shopping Cart and change the various options.


Bear in brain that it is imperative to go in your Paypal internet message address in alignment to be adept to receive capital for goods you will create on your website.


At the peak of the backgrounds page for the WordPress buying Cart you will glimpse instructions how to create Add to cart buttons on your pages and how to brandish the shopping cart and the goods in it.

In alignment to conceive a new post with a merchandise for your WordPress buying Cart go to mails -> Add New.

Here is an demonstration data you can enter in a new sheet in alignment to conceive a sample merchandise.

go in the desired text and images if you like, and the WordPress buying cart merchandise cipher. Note that you need to change the “Product” and the number in the wp_cart tag to reflect the yearned merchandise name and cost.

For the shopping cart itself we will use the widget for the plugin. proceed to Appearance -> Widgets.

pull and fall the WP Paypal buying Cart widget to the Sidebar.

How to create a simple WordPress theme

To start construction your theme, first conceive a sub-folder in the wp-content/themes book or directions in your WordPress folder. For the purpose of this tutorial, we will call the folder "tutorial_theme". The title of the folder should correspond to the title of the theme you desire to conceive. To do this you can use either your very popular FTP client or the File supervisor device in your cPanel.

Before you start conceiving the theme, you should conclude how the layout of your website will gaze like. In this tutorial we will construct a WordPress topic that comprise of a header, sidebar, content locality 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 documents locally with a simple text editor(like notepad for demonstration) and upload them via FTP or you can use the document Manager device in your cPanel to conceive the documents directly on your hosting account.

Now let's take a nearer gaze at each file and what it should comprise:
The header.php document

In this document you should add the following code: 

The header.php file

<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>

Fundamentally, this is easy HTML cipher with a lone line encompassing a php cipher and a benchmark WordPress function. In this document you can specify your meta tags such as the title of your website, meta recount and the keywords for your sheet.

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 supplemented 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 change it via the style.css document.

After that we have supplemented a easy label HEADER covered in a "div" with class "header" which will be subsequent 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

<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

<div id="footer">
  <h1>FOOTER</h1>
</div>

</div>

</body>
</html>


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;
}



Tutorial theme

How to install a Wordpress theme

In the default WordPress setting up, there are a twosome of topics you can select from. You can find the topics in your WordPress administration locality > Appearance > Themes.

You can change the topic easily by clicking on the desired topic and then Activate "theme name".

How to install a WordPress theme?
If you would like to use a distinct WordPress topic for your blog web location, first of all you will have to download it to your local appliance. You can visit our Wordpress topics gallery and download free topics from there:

Once you have the new Wordpress theme on your localizedized hard propel, you have to upload it under the 'wp-content/themes' directory of your website. You have two choices to do that:

You can upload the .zip file of the topic in the 'wp-content/themes' book or directions by the document Manager and extract it online, or
Extract the document in your computer and then to upload the content in the desired folder via FTP.

Now, that you have the new topic uploaded on your site in the right folder, you can glimpse it in your WP admin section and choose it as a default theme for your site.

Saturday, March 16, 2013

How To Create Your Own Basic WordPress Widgets

This week I’d like to show how to do exactly that, and the widget we will be writing is a simple one that picks out a single random post from your site, pulls the featured image, and displays it on the sidebar – a visual “check this out” widget that will help users to find more content on your site.
This is also an extension of a continuing series in which I show you how easy it is to customize your WordPress template.
You may also be pleased to know that we’ve added a new WordPress Tutorials category to MakeUseOf, so be sure to check that out for an ever growing archive of up to date tips and guides to the world’s favourite blogging platform.

Key Concepts: WordPress Queries and the Loop

Each page on your blog consists of a query to your database of posts. Depending on the page you are viewing, the query will change. Your blog homepage for instance, may use the query “get the latest 10 blog posts“. When you view the category archives, the query may change to “get the latest 20 posts for the category family photos only, order the results by date published“. Each query will return a set of results, and depending on the page template being used, each result will be run through the main “loop” of the template. 

Each page can in fact consist of more than one query though, and you can even create your own queries to add functionality to various places in your template. You can see an example of this in use at the bottom of this article – we have a few additional queries that run on every page that aim to show you related articles you may be interested in, or articles which are trending this week.
To make our custom widget though, we will simply need to create an additional query that grabs X number of random posts plus their images, and displays them in some way on the sidebar. I already showed you last week the code to grab the featured image, so we really just need to know how to make a new WordPress widget and place it on the sidebar.

Basic Widget Code

Start by creating a new .php file in your wp-content/plugins directory. You could also follow the tutorial offline then upload it using the WordPress interface, but I find it’s easier to write as we go along in case you need to debug. Call your file whatever you like, but I’m going with random-post-widget.php
Paste the following into the file and save. Feel free to change the section at the top with my name in it, but don’t adjust the rest of the code yet. This is basically a skeleton empty widget, and you can see where it says //WIDGET CODE GOES HERE is where we will add our functionality in later.
<?php
/*
Plugin Name: Random Post Widget
Plugin URI: http://jamesbruce.me/
Description: Random Post Widget grabs a random post and the associated thumbnail to display on your sidebar
Author: James Bruce
Version: 1
Author URI: http://jamesbruce.me/
*/
 
 
class RandomPostWidget extends WP_Widget
{
  function RandomPostWidget()
  {
    $widget_ops = array('classname' => 'RandomPostWidget', 'description' => 'Displays a random post with thumbnail' );
    $this->WP_Widget('RandomPostWidget', 'Random Post and Thumbnail', $widget_ops);
  }
 
  function form($instance)
  {
    $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
    $title = $instance['title'];
?>
  <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
  }
 
  function update($new_instance, $old_instance)
  {
    $instance = $old_instance;
    $instance['title'] = $new_instance['title'];
    return $instance;
  }
 
  function widget($args, $instance)
  {
    extract($args, EXTR_SKIP);
 
    echo $before_widget;
    $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
 
    if (!empty($title))
      echo $before_title . $title . $after_title;;
 
    // WIDGET CODE GOES HERE
    echo "<h1>This is my new widget!</h1>";
 
    echo $after_widget;
  }
 
}
add_action( 'widgets_init', create_function('', 'return register_widget("RandomPostWidget");') );?>
As it is, the plugin doesn’t do much apart from print out a large title with the words “This is my new widget!“.
how to create widgets
It does however give you the option to change the title, which is kind of essential for any widget. Adding in other options is a bit beyond the scope of this article today, so for now let’s move on to give it a real purpose.
write your own widget

A New Query & The Loop

To make a new query to your blog database, you need to use the query_posts() function along with a few parameters, then run through the output using a while loop. Let’s try this – a very basic query and loop to demonstrate. Replace the line of code that says:
<h1>This is my new widget!</h1>
with the following:
// WIDGET CODE GOES HERE
query_posts(''); 
if (have_posts()) : 
 while (have_posts()) : the_post(); 
  the_title(); 
 endwhile;
endif; 
wp_reset_query();
This is an absolutely basic query using default options and zero formatting of the output. Depending on how your blog is set up, the default will most likely be to grab the 10 latest posts – then all the above code does is to output the title of each post. It’s pretty ugly, but it works:
write your own widget
We can make it a little better right away just by adding some HTML formatting to the output with the ECHO command, and creating a link to the post using get_the_permalink() function:
 
query_posts('');
if (have_posts()) : 
 echo "<ul>";
 while (have_posts()) : the_post(); 
  echo "<li><a href='".get_permalink()."'>".get_the_title()."</a></li>";
 
 endwhile;
 echo "</ul>";
endif; 
wp_reset_query();
write your own widget
Already, it’s looking much better. But we only want one post, picked at random. To do this, we specify some parameters in the query:
 
query_posts('posts_per_page=1&orderby=rand');
Of course, you could change it to any number of posts – in fact, there’s a whole range of extra bits you can pass into the query in order to restrict, expand, or change the order of the results, but let’s stick with that for now. If you refresh, you should see just one post which is randomized each time you refresh.
Now for the featured thumbnail. Replace the code with this, hopefully you can see where we are grabbing the thumbnail and displaying it:
query_posts('posts_per_page=1&orderby=rand');
if (have_posts()) : 
 echo "<ul>";
 while (have_posts()) : the_post(); 
  echo "<li><a href='".get_permalink()."'>".get_the_title();
  echo the_post_thumbnail(array(220,200));
  echo "</a></li>"; 
 
 endwhile;
 echo "</ul>";
endif; 
wp_reset_query();
You can see the finished results again on my development blog Self Sufficiency Guide, though I might have moved things around by the time you read this.
how to create widgets

Conclusion:

See how easy it is to make your own custom widget that can do exactly what you want? Even if you don’t understand 90% of the code I’ve shown you today, you should still be able to customise it somewhat by just changing variables or outputting different HTML. We wrote a whole widget today, but you could easily use just the new query and loop code on any of your page templates.

This Tutorial From 


Create Wordpress plugin from scratch

This tutorial will explain how to create Wordpress widget from scratch. You will also learn how to implement configuration page for your widget.

Getting started

You should already have Wordpress installed, either on your local machine or on a testing server. For this tutorial we will use the Wordpress version 2.7. You should also have a theme that support widgets. You could use the default one or make a wordpress theme from scratch and widgetize it.

Widget name

The first task in creating a Wordpress widget is to think about what the widget will do, and make a (hopefully unique) name for your widget. Check out Plugins and the other repositories it refers to, to verify that your name is unique; you might also do a Google search on your proposed name. The name can be multiple words.

Widget files

We will start by creating a folder widget-name in our wp-content/plugins/ directory, where Wordpress stores all it's plugins. It's a good idea to always create a folder for your plugin, even if it consists only of 1 file, so you could add more files later. The next step is to create our main widget file widget-name.php. To make Wordpress recognize it as a plugin we should add a specific header to it, that describes our widget.

Widget header

<?php
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
*/
?>
Our widget should appear in Wordpress administration area in inactive plugin list. Information about your widget will be extracted from the header of a main widget file. To continue developing our widget we must activate our plugin by clicking Activate to the right of the plugin entry. Activate plugin

Creating widget structure

There are different ways to create a Wordpress widget. I prefer creating it as a static class, but the downside of this method it that our widget will support php5 only, anyway I believe, that support for php4 can already be dropped. So let's create our main class, that will contain all widget methods.
error_reporting(E_ALL);
add_action("widgets_init", array('Widget_name', 'register'));
class Widget_name {
  function control(){
    echo 'I am a control panel';
  }
  function widget($args){
    echo $args['before_widget'];
    echo $args['before_title'] . 'Your widget title' . $args['after_title'];
    echo 'I am your widget';
    echo $args['after_widget'];
  }
  function register(){
    register_sidebar_widget('Widget name', array('Widget_name', 'widget'));
    register_widget_control('Widget name', array('Widget_name', 'control'));
  }
}
Our plugin should not throw any level errors (even notices), so we should turn error reporting on while we are developing. We will remove this line when the widget will be finished. The add_action function hooks our register method to an widgets_init event. You can read about it in Wordpress codex. It takes the action hook name as its first parameter and the callback function as a second parameter. You should definitely read about callbacks in php manual. To make widget appear in widgets menu in Wordpress we must register them first, we do that with our register method which creates a widget itself and a control panel for it. The before_widget, after_widget, before_title and after_title in widget method are required for compatibility with various themes. Activate widget Navigate to widgets page in administration area and activate it. To do that press add button next to your widget. It should appear at current widgets column, you can press edit button next to it too see the control panel. Don't forget to press save changes button! The text from your widget method should appear in your blog sidebar. Your widget in sidebar

Saving Widget Data to the Database

Most WordPress Widgets will need to get some input from the site owner or blog users and save it between sessions, for use in its filter functions, action functions, and template functions. This information has to be saved in the WordPress database, in order to be persistent between sessions. There are two basic methods for saving Widget data in the database.

WordPress Options

This method is appropriate for storing relatively small amounts of relatively static, named pieces of data - the type of data you'd expect the site owner to enter when first setting up the Widget, and rarely change thereafter. Option values can be strings, arrays, or PHP objects (they will be "serialized", or converted to a string, before storage, and unserialized when retrieved). Option names are strings, and they must be unique, so that they do not conflict with either WordPress or other Plugins. Here are function you will need to modify options.
add_option($name, $value);
update_option($name, $new_value);
delete_option($name);

Create a custom database table

This method is appropriate for data associated with individual posts, pages, attachments, or comments -- the type of data that will grow as time goes on, and that doesn't have individual names. See Creating Tables with Plugins for information on how to do this.

Plugin Installation

If you need to install default data for your widget it is best to use activation hook. It takes 2 parameters. First one is a path to the main plugin file inside the wp-content/plugins directory. And the second one is the function to be run when the plugin is activated. Any of PHP's callback pseudo-types will work. We will add activate method that will install default data for our widget.
error_reporting(E_ALL);
add_action("widgets_init", array('Widget_name', 'register'));
register_activation_hook( __FILE__, array('Widget_name', 'activate'));
register_deactivation_hook( __FILE__, array('Widget_name', 'deactivate'));
class Widget_name {
  function activate(){
    $data = array( 'option1' => 'Default value' ,'option2' => 55);
    if ( ! get_option('widget_name')){
      add_option('widget_name' , $data);
    } else {
      update_option('widget_name' , $data);
    }
  }
  function deactivate(){
    delete_option('widget_name');
  }
  function control(){
    echo 'I am a control panel';
  }
  function widget($args){
    echo $args['before_widget'];
    echo $args['before_title'] . 'Your widget title' . $args['after_title'];
    echo 'I am your widget';
    echo $args['after_widget'];
  }
  function register(){
    register_sidebar_widget('Widget name', array('Widget_name', 'widget'));
    register_widget_control('Widget name', array('Widget_name', 'control'));
  }
}

Creating widget control panel

We should use our control method for displaying and updating form with widget options. Here is a basic template for it.
function control(){
  $data = get_option('widget_name');
  ?>
  <p><label>Option 1<input name="widget_name_option1"
type="text" value="<?php echo $data['option1']; ?>" /></label></p>
  <p><label>Option 2<input name="widget_name_option2"
type="text" value="<?php echo $data['option2']; ?>" /></label></p>
  <?php
   if (isset($_POST['widget_name_option1'])){
    $data['option1'] = attribute_escape($_POST['widget_name_option1']);
    $data['option2'] = attribute_escape($_POST['widget_name_option2']);
    update_option('widget_name', $data);
  }
}
You should be able to access it on the widgets page. Widget options

Conclusion

I hope this tutorial gave you all the information you need to build your first Wordpress widget. If you have something to add or found an error, please feel free to post a comment below. And I want to add that Wordpress codex is a great source of information. 

How to Create a WordPress Theme from Scratch

Setting Up the Work Station
To get started with this tutorial we should set up a server on our computer using either XAMPP or WAMP (usually if employed on a PC), or MAMP if you are working on a Mac. All of these tools permit for a local checking natural natural natural environment for WordPress and can make it so that you don't have to certainly move documents through FTP while employed on a task.

In periods of cipher revising I would highly suggest Notepad++. With syntax highlighting, and an very simple and clean user interface for coding, I would have to state it is my personal favorite (plus, you can't trounce free), but Notepad or Notepad 2 furthermore work as well.

Getting the essential Folders and documents prepared

In the folder containing your WordPress setting up, proceed to wp-content/themes/ and conceive a folder entitled “New 3.0 Theme”. This is where we will contain all of our documents during this tutorial. Now create the following documents and folders:

/images
style.css
header.php
index.php
single.php
footer.php
archive.php
page.php
sidebar.php
functions.php

Style.css
The style.css will comprise all of the components that style our WordPress template. First though. we will use it to affirm the name of our template as well as the scribe name and link, and recount and type. Now remember when conceiving a WordPress topic, the style.css is one of the two files needed to make the theme work, and the other, which we will be conceiving subsequent, is the index.php.

/*
Theme Name: New WP Theme
Theme URI: http://wordpress.org
Description: A clean and minimal theme that is completely compatible with
Author: Hasibul Islam
Author URI: http://www.webdeveloperszone.com
Version: 1.0
*/

All of this information can be changed at anytime, but it is important that it is all contained within the comments so that it doesn't affect any of the definitions created.
Now we will create some basic definitions that we will later implement in some of the template's PHP files.
body{  
    font-family: Arial, Helvetica, Georgia, Sans-serif;
    font-size: 12px;
    background: #d9d9d9;
    color: #000000;
}

a:link, a:visited{
    text-decoration: none;
    color: #000000;
}

a:hover{
    color: #5f5f5f;
}

h1 {
    font-size: 54px;
}

h3 {
    font-size: 24px;
}

#wrapper{
    margin: 0 auto;
    width: 750px;
    text-align: left;
    background: #fff;
    padding: 20px;
     
}

#header{
    width: 750px;
    height: 100px;
}

#blog{
    float: left;
    width: 520px;
    padding: 0 10px 10px 10px;
}

.sidebar{
    float: left;
    width: 200px;
    margin: 0 0 0 10px;
    font-size: 14px;
    list-style: none;
}

#footer{
    clear: both;
    text-align: center;
    height: 50px;
    background: #ccc;
    padding: 10px;
}

The tag is just utilised to affirm the specifications for fonts utilised on the website, as well as the background color (this can be altered to your own liking). We then affirm the style attributes for connections as well as some of the headers that we will be utilising throughout our theme.

The #wrapper is going to be the full size of the web page, with #header obviously being the header, and #blog encompassing just the latest blog posts on the location. finally we have .sidebar and #footer which will both just comprise the basic delineations for those granted areas, which we will get into more deepness about later.

Header.php
Next we will create the header.php, which at the moment will contain our website logo, as well as our custom navigation.

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php wp_title ( '|', true,'right' ); ?></title>

<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

<?php
    /*
     *  Add this to support sites with sites with threaded comments enabled.
     */
    if ( is_singular() && get_option( 'thread_comments' ) )
        wp_enqueue_script( 'comment-reply' );

    wp_head();
     
    wp_get_archives('type=monthly&format=link');
?>
</head>
<body>

<div id="wrapper">
    <div id="header">
        <h1><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1>
    </div>

All of this cipher doesn't actually need to be explained in much deepness, but just recall that the above code should be in the header.php of all of your themes. First we declare the doctype, as well as use the benchmark that will be utilised to show the name of your website as you kind it in your WordPress settings, and then your style.css and the PHP code that will endow WordPress 3.0's threaded comments.

supplementing Custom Navigation
Now that we have coded up our header.php with our rudimentary data and our blog's title, we can add our custom navigation list, a characteristic that was introduced in WordPress 3.0. Before we actually add the cipher to our header.php though, we have to first open up the functions.php, and add the essential code to endow the made-to-order menus.

<?php

//Add support for WordPress 3.0's custom menus
add_action( 'init', 'register_my_menu' );

//Register area for custom menu
function register_my_menu() {
    register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
}

?>

As you can see by the commented parts of the code, the first part, with add_action is utilised to add support for custom meal lists, and next we register a custom list and title it “Primary Menu”. Now, we will move on to implementing the list into our topic.

To do this, we will have to add this line of code below at the end of our header.php document.

<?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'menu_class' => 'nav', 'theme_location' => 'primary-menu' ) ); ?>

Now on to comprehending precisely what this means. The primary function that is being utilised is wp_nav_menu, with sort_column, container_class, and theme_location as the contentions being used. What sort_column does is makes certain that the alignment you pick in your WordPress dashboard is followed. container_class will allow for you to select the CSS class that you have conceived to be utilised to method your list. Lastly, theme_location just assigns the list to while we select, which at the moment happens to be primary-menu.

Styling the Navigation
We have our made-to-order header navigation up and running, but at the moment it just looks like a dull old register of connections that regrettably, are aesthetically unappealing. To rectify this, we will conceive a class called nav in our style.css.

.nav{
    width:750px;
    background: #000;
    display:block;
    float:left;
    position:relative;
}

.nav ul{
    list-style:none;
}

.nav li{
    float:left;
    position:relative;
}

As you can glimpse in our .nav we have made some rudimentary affirmations, such as the breadth of the navigation, backdrop, where it will align, as well as the display worth. Next we method the rudimentary unordered register by just making certain that no projectiles are shown with our links. For our register we ride high the pieces to the left, as well as place it relative.

Now we will complete the styling of our navigation by supplementing styles to the links and dropdown menus.

.nav a{
    display:block;
    text-decoration:none;
    color:#fff;
    padding:0 15px 10px 0;
    font-size:13px;
    font-weight:bold;
}

.nav ul ul{
    display:none;
    position:absolute;
    top:100%;
    left:0;
    float:left;
    z-index:99999;
    background: #212121;
}

.nav ul ul ul{
    top: 30%;
    left:100%;
    background: #343434;
}

.nav ul ul a{
    height:auto;
    line-height:1em;
    padding:10px;
    width:130px;
}

.nav li:hover > a,.nav ul ul:hover > a{
    color:#ccc;
}

.nav ul li:hover > ul{
    display:block;
}

As you can glimpse we start by fashioning our links for the list, and now we get into fashioning our drop-down meal lists. In .nav ul ul we set the position to unconditional, and put the top house to 100%, so that it is exactly under it's parent link. We also altered the backdrop to make the drop-down connection stand out a little bit, as well as set our z-index to 99999 so that no issue what's underneath it or in the menu's way, it will habitually stay on top of all other components.

For that third drop-down list, we have changed the backdrop hue afresh just slightly so that it stands out, as well as made left 100% so that it is all the way right of our first drop-down, and set the peak to 30% so that it is still adhered to that second drop-down, but is divided from the entire list.

finally we method the links for our drop-down menus, as well as the what our navigation will gaze like when a user hovers over a granted connection and its drop-down.

Index.php
The index.php will be the home sheet of our website, and will comprise cipher to encompass our header, footer, and sidebar, which I will interpret underneath, as well as the cipher to encompass the most latest mails from our blog and take benefit of WordPress 3.0's mail thumbnails feature.

<?php get_header(); ?>

    <div id="blog">
        <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
         
        <div class="post">
        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
         
            <div class="entry">  
                <?php the_post_thumbnail(); ?>
                <?php the_content(); ?>

                <p class="postmetadata">
                <?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?><br />
                <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?>
                </p>

            </div>
        </div>
<?php endwhile; ?>
         
        <div class="navigation">
        <?php posts_nav_link(); ?>
        </div>
         
        <?php endif; ?>
    </div>
<?php get_sidebar(); ?>  
<?php get_footer(); ?>

These lines of code are used to output all of the information in the header.php, sidebar.php, and footer.php wherever you place them in your theme files.

<?php get_header(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Other than that, the cipher here is attractive easy to realise. After we call the header.php, we use our #blog that we created just a little bit before, and we call the loop that will be utilised to bring up the newest posts on our WordPress blog. After that we cover the name of our posts in

, which we also styled earlier.

The one part of cipher here that displays how we're going to be taking advantage of WordPress 3.0's post-thumbnail feature is the . As it stands, this code won't do anything, until we cause the feature in our functions.php which we will do in the next step.

Enabling Post Thumbnails
We have supplemented our cipher to display the mail thumbnails on the homepage, but at the instant nothing happens as we have not really endowed the characteristic to work. Now open up the functions.php that we worked on before, and the underneath code should be supplemented after your list navigation code.

// Enable post thumbnails
add_theme_support('post-thumbnails');
set_post_thumbnail_size(520, 250, true);

The cipher overhead is pretty self-explanatory as it magic charms out nearly precisely what it does. The second line will add the support for mail thumbnails in our topic, while the third line characterises the exact dimensions of our thumbnail, which for this item, will be set at 520 pixels for breadth, and 250 pixels for height.

Sidebar.php
The sidebar.php is, as you estimated, the document that will brandish all of the information we desire in the sidebar. Since we have currently included the document in our index.php, all we have to do is put the code in this file and our sidebar will display up on the homepage.

<div class="sidebar">
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?>

<?php endif; ?>
</div>

Yup, that will be all of the cipher that's added to our sidebar.php to make it purposeful. We call the div that we created in our style.css, and the code underneath will make it so that we can add widgets to our sidebar in the alignment and way we want them by the WordPress backend. although, like numerous characteristics, we have to modify our functions.php document first to make this characteristic work properly.

//Some simple code for our widget-enabled sidebar
if ( function_exists('register_sidebar') )
    register_sidebar();
The code just notifies WordPress to list a sidebar which we called in our sidebar.php. WordPress can handle multiple sidebars attractive effortlessly if you want more than one, but for the sake of holding this already-long tutorial relatively short, we'll let Google answer the inquiry on how to do that for you.

Single.php
The single.php is what will be utilised for a single mail sheet, and most of the cipher should look pretty alike since we've already coded up our index.php. Really the only thing that's distinct is that we have added in our comments-template div, and the cipher to include the comments.php.

<?php get_header(); ?>

    <div id="blog">
        <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
         
        <div class="post">
        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
            <div class="entry">  
                <?php the_post_thumbnail(); ?>
                <?php the_content(); ?>

                <p class="postmetadata">
                <?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?><br />
                <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?>
                </p>

            </div>

            <div class="comments-template">
                <?php comments_template(); ?>
            </div>
    </div>

<?php endwhile; ?>
     
    <div class="navigation"> 
        <?php previous_post_link('< %link') ?> <?php next_post_link(' %link >') ?>
    </div>

<?php endif; ?>
</div>

<?php get_sidebar(); ?>  
<?php get_footer(); ?>

Comments.php
With the release of WordPress 3.0 has meant the standardizing of comments forms throughout all WordPress themes making it easier for theme authors to and plugin developers since the comments form can be modified via hooks.

Below will be the code you will want to put in your comments.php file in your theme template.
<?php comment_form(); ?>

This will brandish a remarks form that examines well on our theme, but if you would like to discover more about customization of the commentary pattern, you might desire to ascertain out WordPress 3.0 topic Tip the Comment pattern.

Page.php
When you conceive a sheet in WordPress, a distinct document is used to brandish the content of what you drafted into the page, and that is page.php. The cipher will gaze almost absolutely equal to what we typed up in our single.php, except since it is a sheet we are going to omit the remarks template, and change the post navigation slightly to handle a sheet rather than of a mail. Other than that, the code will be precisely the same.

<?php get_header(); ?>

    <div id="blog">
        <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
         
        <div class="post">
        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>


            <div class="entry">
            <?php the_content(); ?>

                <p class="postmetadata">
                <?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?><br />
                <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?>
                </p>

            </div>

        </div>
         
<?php endwhile; ?>

    <div class="navigation">
        <?php posts_nav_link(); ?>
    </div>

<?php endif; ?>
</div>

<?php get_sidebar(); ?>  
<?php get_footer(); ?>

Category.php
The category.php will assist as the document that, when a client examines at a specific post category, time for posts, or specific scribe, will be the document that serves up the data to display mails. As with our page.php, most of the code here is going to be the exact same as the single.php we created before, except for a chunk right at the beginning.

<?php get_header(); ?>

    <div id="blog">
        <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
         
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
      <?php /* If this is a category archive */ if (is_category()) { ?>
        <h2>Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category:</h2>
      <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
        <h2>Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h2>
      <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
        <h2>Archive for <?php the_time('F jS, Y'); ?>:</h2>
      <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
        <h2>Archive for <?php the_time('F, Y'); ?>:</h2>
      <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
        <h2>Archive for <?php the_time('Y'); ?>:</h2>
      <?php /* If this is an author archive */ } elseif (is_author()) { ?>
        <h2>Author Archive</h2>
      <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
        <h2>Blog Archives</h2>
    <?php } ?>
         
        <div class="post">
        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>

            <div class="entry">
            <?php the_content(); ?>

                <p class="postmetadata">
                <?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?><br />
                <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?>
                </p>

            </div>

        </div>
         
<?php endwhile; ?>

    <div class="navigation">
        <?php posts_nav_link(); ?>
    </div>

<?php endif; ?>

</div>

<?php get_sidebar(); ?>  
<?php get_footer(); ?>

This piece of code right here will be the only thing that is added, and we have included it right after our WordPress loop.

<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
      <?php /* If this is a category archive */ if (is_category()) { ?>
        <h2>Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category:</h2>
      <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
        <h2>Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h2>
      <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
        <h2>Archive for <?php the_time('F jS, Y'); ?>:</h2>
      <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
        <h2>Archive for <?php the_time('F, Y'); ?>:</h2>
      <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
        <h2>Archive for <?php the_time('Y'); ?>:</h2>
      <?php /* If this is an author archive */ } elseif (is_author()) { ?>
        <h2>Author Archive</h2>
      <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
        <h2>Blog Archives</h2>
    <?php } ?>

What this does is use a assortment of if/elseif statements in PHP to show what we are actually browsing on our blog. So if we're looking at a exact category called “Test class 1”, it will display in the h2 heading “Archive for the ‘Test Category 1’ Category:” before all mails, and it will do this for certain dates, authors, and so on.

made-to-order Backgrounds, Feed connections
As recounted before, one feature that has been applied in WordPress 3.0 is the ability to conceive or change the backdrop of your location, be it an likeness or rudimentary hue, just through the WordPress backend. All we need for this characteristic to work fully?

This one little line of code:
add_custom_background();

And like that, custom backgrounds are now enabled. Next, we are going to be adding some equally simple code to make it so that relevant feed links are available everywhere on the site. Be it the standard feed, comments, tags, categories, all of these will be added to the header without any extra code.
Let's add the following code to our functions.php, to make this feature work as it should.
add_theme_support( 'automatic-feed-links' );

Footer.php
To complete off our work here, we are going to conceive our footer.php file, which too will use the #footer that we announced in our style.css, and will just contain some rudimentary copyright data as well as a link to the tales and remarks RSS feed at the bottom.

<div id="footer">
    <p>
    <strong>Copyright 2011 <?php bloginfo('name'); ?> | All Rights Reserved.</strong> </a>
    Designed by <a href="http://slackrmedia.com">SlackrMedia</a>
    </p>
    <p><a href="<?php bloginfo('rss2_url'); ?>">Latest Stories RSS</a> | <a href="<?php comments_rss_link('comment feed'); ?>">Comments RSS</a></p>
    </div>
</div>

</body>
</html>