Putting The Loop In Context

The Loop is the heart of a theme, which is what controls how your content is displayed. It is the functional connection between the MySQL database data and the HTML that is rendered in the visitor's browser. Basically anywhere a post or page is displayed, WordPress is going to use the Loop. This can be a single post or page, a loop of posts, or a sequence of loops with different display options.

Most WordPress themes feature a header, footer, and sidebar element. Figure 5-1 shows how the Loop is placed directly in the middle of these elements, creating your web site content area. This section of your web site is usually dynamic and will change as you navigate through it.

The Loop by default is used in your WordPress theme template files. Custom Loops can be created anywhere in your theme template files, as Figure 5-2 shows. Custom Loops are also used in plugins and widgets. Loops can be used anywhere inside of WordPress, but different methods exist for creating custom Loops depending on where they are used, and the potential side effects of each construction will differ.

Multiple Loops can be used throughout your theme template files. Custom Loops can be created in your header, sidebars, footer, and main content areas of your web site. There is no limit to the number of Loops that can be displayed on your web site.

The following section looks at the basic flow control of the Loop, and the WordPress template functions provided to customize the way content is displayed while being handled inside of a loop. Armed with the basics, it then goes into building custom loops based on hand-tailoring those query parameters.

Creating And Writing Your Blog

Creating And Writing Your Blog

The success of a blog lies in the content. It is the content and the key words that consistently attract potential customers. Great blog content literally means something different on every blog. Great blog content is researched and not impulsive. You cannot treat the blog as an experimental playground and expect it to work for you. It is designed to mean business and make you presence felt online and you have to ensure it performs the way you want it to.

Get My Free Ebook


Post a comment