Archive for March, 2008

Free web hosting music - CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT 469

Friday, March 21st, 2008

CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT 469 Listing 17-8. Using the Class Variable in main-content.php

A Conversation Layout Now that you have your building blocks in place, you can make some decisions about which pieces to use in appropriate circumstances. This first example demonstrates a layout to satisfy the readers who want to go straight to the conversation and join in. A Single-Post View WordPress has a template function that tells you if the page you are viewing contains a single post: the is_single function. You ll use that template function to decide to exclude the sidebars and allow the post and comments to fill the width of the template. Listing 17-9 show the modified code to make this happen. Listing 17-9. Testing for a Single Page in index.php

Notice a couple of big changes here. First, all the PHP code is inside one block. You don t need to include each line of PHP inside its own tags. You can amalgamate multiple PHP lines. This works well in this case because there is no longer any HTML code mixed in. Second, you use the WordPress template function is_singleto test if the reader is viewing a single post. If the function returns true, then you set your CSS class variable to main-content-full. If it is not true, the else part of the clause is executed, setting the CSS class variable to the normal main-content-norm. The main-content building block isn t included. Then you test again whether you are viewing a single page. This time the test is negative. The exclamation mark in front of the is_single function negates the test. This test means, If the page is not a single
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

468 CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT (Web space)

Friday, March 21st, 2008

468 CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT Figure 17-5. Main content commented out Before moving onto building a layout from these pieces, you need to make one more change to the basic structure. You can see in Figure 17-2 that the combination of main content and sidebar B does not fill the width of the theme. Similarly, the main content with no sidebars is also too narrow. To resolve this problem, you can define three CSS classes that specify different widths for the main content, as shown in Listing 17-6. Listing 17-6. Special Class Rules in style.css #main-content { float: left; text-align: left; padding: 0 10px 0 5px; } .main-content-norm { width: 340px; } .main-content-wide { width: 530px; } .main-content-full { width: 720px; } This way, you can specify in the code of the template which width to use. Listings 17-7 and 17-8 show the changes in index.phpand the main-content.phpinclude file to continue using the default value. I ll explain how this code works in the next section. Listing 17-7. Setting the Class Variable in index.php


If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Web site counters - CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT 467

Thursday, March 20th, 2008

CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT 467 Figure 17-2. Sidebar A commented out Figure 17-3. Sidebar B commented out Figure 17-4. Both sidebars commented out
In case you need quality webspace to host and run your web applications, try our personal web hosting services.

Web hosting faq - 466 CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT

Wednesday, March 19th, 2008

466 CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT If you examine index.php (you can use the WordPress Theme Editor, as described in Chapter 16), you will see that it has become very simple and modular. Listing 17-5 shows the whole file. It has been reduced to a mere 18 lines. Each of the main areas of the file has now been extracted to its own file. Listing 17-5. The Lean index.php


Note that the header.php and footer.php files are not directly included by this file. Instead, the WordPress template functions get_header() and get_footer() have been called. These standard template tags automatically include a file called header.php and footer.php, respectively. If one of these files doesn t exist in the theme, the tags will include the corresponding files from the default theme. This modularity now allows you to be incredibly flexible in the layout of the theme. As an example, simply commenting out any combination of the three include files in the central section allows you to change which pieces of the page are included. Figures 17-1 through 17-5 demonstrate how you can change the layout by commenting out files.
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT 465 (Best web design)

Tuesday, March 18th, 2008

CHAPTER 17 CUSTOMIZING YOUR BLOG S LAYOUT 465 #sidebar-b h2 { margin-top: 1.2em; } ul.sidebar-b-sidelists { list-style-type: none; margin:0; padding-left: 10px; } ul.sidebar-b-sidelists li { margin-top: 4px; margin-left: 1em; text-indent: -1em; } Listing 17-4. New CSS Names in sidebar-b.php

A quick check on the main blog page shows that everything still works. If you download the completed split-out version from the Apress web site (as file c3rohorses-step1.zip) and unzip it into your wp-content/themes directory, you will see that I have split it into quite a few files and renamed the theme to c3rohorses. The file list now looks like this: comments.php footer.php header.php html-head.php index.php main-content.php search-form.php sidebar-a.php sidebar-b.php
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.