WordPress: page-Default skin Theme page template

Source: Internet
Author: User
Tags comments php page template php template
ZH-CN: Page

Languages:english español français Italiano Japanese language 한국어 Myanmar Nederlands Português do brasil·русский· Slovenčina ไทย Chinese (complex) · (Add your language)

You can write a journal (article) or page in WordPress. When you write a general blog post, you write a journal (article). These logs (articles) are listed in reverse chronological order on the home page of the blog. And the page is like "about bloggers", "contact bloggers" such content, they are not affected by the time rules, and its content generally rarely change. You can use pages to organize and manage any number of content.

Common pages include the following: Copyright, relevant legal information, reprint license, company information and accessibility statement. (Incidentally, it's a good idea to create a page with a presentation and contact information--see the Lorelle recommendations.) )

In general, pages are similar to logs (articles) with headings and content, and the appearance style is consistent by using a template, but in this respect the page has several important features that differ from the journal (article). What's the Contents 1 page? 2 Create Page 3 modify the URL of the page (or "Slug") 4 List the Site page 5 Organization page 6 page template 6.1 Default skin theme page template 6.2 Use which template to display a particular page. 6.3 Create your own page templates 7 pages and Templates sample 7.1 archive with Content 7.2 page article 8WordPress used as CMS 8.1 use a page as a home 8.2 the previous version of the WP2.1 first page of the backup method 9 including a 10WordPress dynamic " Page " What's the page? "

pages can: the content of a page is less affected by time than a log (article). Pages can be organized into pages and [subpages]. Pages can use various [page templates] that contain [template file],[template tags] and other PHP code.

Page Cannot: page is not a log (article), nor is it an excerpt from a large article. They don't appear on the blog's homepage as much as a log (article). ( Note: You can use the [Inline posts plugin] to include the journal (article) in the page. The page cannot be associated with the category, nor can it be assigned a label. The organizational structure of the page is only generated by the interaction of each layer and is not related to the label or classification. The page is not a file. They are stored in the database as well as the log (article). Although you can add template tags and PHP code to your page template, you can't add them to the page content and try to make them work. (Note: You can use plug-ins such as exec-php or runphp to do this.) ) to create a page

If you have sufficient administrative privileges, you can log into WordPress to create a new article, and create a new page. Select [Admin Panel]>[page]>[page new] to create a new page. Modify the URL (or "Slug") of the page

Since version 2.5, changes to the page URL have become less intuitive. If you enable the permanent link and select the day and Name option (click on the Set tab and then click on the Permanent Link sub-tab), the permanent link will automatically appear under the title of the journal (article) when you enter the subject of the journal (article).

But if you choose a permanent link-related other option, or if you don't have a permanent link enabled, you need to edit the page URL by following these steps: Create a new page by writing a > page . Click the Publish button when the page content is complete. Open the admin > Page . Click on the edit next to the page. Click on the edit link to modify the permanent link that appears under the title.

In other words, if you do not enable the correct permanent link option, you will have to make changes to the URL after the page has been published. List Site pages

WordPress can automatically list pages on a site, such as by using a [template label] named Wp_list_pages () to display them in the sidebar. The following instructions refer to [Wp_list_pages] related pages: Sort the list of pages (Customize the order in the page list, the "page Sorter" section in the Compose > page Management panel is useful), remove a page from the list (or ' hide '), Controls the display of the page (displaying all pages or displaying specific subpages), and controlling the depth of the page hierarchy in the list.

You can also use HTML links to take over links to pages. For example, if you want the copyright page to appear in the footer, the link will appear as:
If you do not set [fixed link]

<a title= "Copyright Information" href= "wordpress/?page_id=14" >copyright 1996-2006</a>

if you set the [fixed link]

<a title= "Copyright Information" href= "wordpress/copyright/" >copyright 1996-2006</a>

Note : your. htaccess file must be writable to make the page permanent link effective, otherwise you will have to update the. htaccess file whenever you create a new page. Organize pages

Just as you can create subcategories under categories, you can create subpages in a page by creating layers of pages.

Suppose you use WordPress for a travel agency to do a website, and then for the continents and countries to establish a separate page to facilitate the management of tourism matters scheduling. You can create a page called "Africa" on which you can give information about African tourist routes. You can then create a series of subpages under the "Africa" page, "Lesotho", "Cameroon", "Togo" and "Swaziland". Similarly, you can create a "South America" page, and then its subpages can include "Brazil", "Argentina" and "Chile". Your site will look like this: Africa Cameroon Lesotho Swaziland Togo South America Argentina Brazil Chile

Open the admin > Compose > Compose Page panel and click the "Parent page" drop-down menu in the upper-right corner of the face. The Drop-down menu contains a list of existing pages in the Web site. If you want to convert the current page to a subpage or a child of a parent page, select the appropriate page from the Drop-down menu. If you specify a parent page from the list, the page currently being edited becomes a subpage of the selected page. When the page is listed, the subpage is nested under the parent page. The hierarchical structure of the page can also be seen from the fixed links of these pages.

The fixed link for the Cameroon page in the example above is:

http://example.com/africa/cameroon/
page Templates

A single page can use a specific custom page template (php template file, such as snarfer.php) in the skin theme (see the [#Creating_Your_Own_Page_Templates Create your own page template] under the Custom Templates guide). The new page template overrides the default page.php page template in the skin theme. See later [#What Template is used to Display a particular page?| Which template to use to display a specific page. To see which template to use, but read the following section first, which will help you understand the answer to the question:

WordPress is configured to use a different page template for different pages. Under the Compose > page Management panel (or sidebar, depending on the version of WordPress you are using), there is a drop-down menu labeled "page Template". Here you can choose to display the template used for a particular page.

Note: in order to be able to access the page template selector, you need at least one custom page available in the current active skin theme (see the following [#Creating Your Own page templates| Create your own page template to learn how to create]). Default Skin Theme page template

The default skin theme includes 3 available page templates: page.php-default page templates: Display page content archives.php-Ignore page content, but display a series of archive links.php by month or by topic (by category)-Ignore page content and use Wp_ List_bookmarks () shows which template the link uses to display a particular page.

WordPress finds several template files in the currently active skin theme. The first lookup result will be used to display the given page. WordPress finds files in the following order: page template page.php index.php to Create your own page template

The files that define each page template can be found in the [Using themes| skins Theme] directory. To create a new custom page template for a page, you need to create a new file. Now we'll name this page template snarfer.php. At the top of the snarfer.php file, enter the following:

<?php/
*
Template name:snarfer
* *
?>

The above code defines the snarfer.php file as the "Snarfer" template. The page template name "Snarfer" can be modified arbitrarily. The template name appears in the skin theme editor and is used as a link to edit the file.

The file can be arbitrarily named, with the name extension. PHP (see file name that you should not use for filename retention (not available); These are filenames that WordPress retains for special use.

The above five elements of the code after the content can be your own business. The rest of the code is the way the control page is displayed using the Snafer page template. You can look at the template tags available here in wordpress various template functions introduced. You can copy the contents of other templates (which can be page.php or index.php) into snarfer.php, and then add the five-element code at the beginning of the file, which is easier to do. As a result, you just need to make adjustments to HTML and PHP code without having to re-establish it. This gives the relevant examples below. Once you have finished creating the page template, place it in the theme catalog, and then use it when you create or edit the page. ( Note : The page template option does not appear when you create or edit a page unless you define at least one template using the above method.) ) page and template sample

The following are examples of instructional examples. Archive with content

The page template displays the contents of the page at the top, and then displays a list of monthly archives and categories below the content. It can be used for WordPress's default appearance theme (aka Kubrick), and is believed to be used in a number of other skin topics with little modification.

Save the following content to arc-cont.php:

<?php
/* Template name:archives with Content
*
/?> <?php get_header

();?>

< div id= "Content" class= "Widecolumn" >

 <?php if (have_posts ()): while (Have_posts ()): The_post ();? >
 <div class= "POST" >
  

page Article

A page template can make a specific classification using a specific template to display the article. It can be used for WordPress's default appearance theme (aka Kubrick), which is believed to be used in a number of other cosmetic topics with little modification.

Save the following content to pageofposts.php:

<?php/* Template name:pageofposts * get_header ()?> <div id= "content" class= "Narrowcolumn" > <?php i F (Is_page (')) {$cat = Array ()} elseif (Is_page (')) {$cat = Array ()} elseif (Is_page (')) {$cat =
Array (17);

else {$cat = ';} $showposts =-1; -1 shows all posts $do _not_show_stickies = 1; 0 to show Stickies $args =array (' category__in ' => $cat, ' showposts ' => $showposts, ' caller_get_posts ' =& Gt
$do _not_show_stickies,); 

$my _query = new Wp_query ($args); ?> <?php if ($my _query->have_posts ()):?> <?php while ($my _query->have_posts ()): $my _query->t
			He_post ()?> <?php//necessary to show the tags global $wp _query;
			$WP _query->in_the_loop = true; ?> <div <?php post_class ()?> id= "post-<?php the_id ();?>" >  
WordPress as a CMS 

You can use WordPress for basic content management. If you do this, you'll probably create a lot of pages for your content. use a page as a homepage

WordPress 2.1 introduces an option that makes it easy to set any page as the home page. Open the settings > Reading in WordPress admin interface. In the first category you can choose to set any published page or journal (article) page as the homepage. The default setting is to display the latest blog log (article) as the home page. Pre-WP2.1 version of the first set of backup method

If you do not want to use the built-in features to set the homepage as a static page, you still have two ways to choose. Use the static homepage plug-in, it can set any Web page as the homepage of your website. The plugin modifies the home page query and glues the page with the home page slug to the front pages.

When a page is displayed as a home page, if there is a page template named home.php for the currently active skin theme, the plug-in overwrites the page's page template and uses home.php. If the page is accessed on a standard page (such as http://example.com/home/), the page's scheduled page template will still be used

As an alternative to Plug-ins, WordPress will identify the template directory under the "home.php" document, and index.php and use the former for the first page appearance definition. If your home page is not your own blog, then it is recommended to apply the home.php template to the blog page anyway. You can use the query_posts () template tag to call any page before calling the main loop (loop). For example:

<?php 
     query_posts (' pagename=home '); 
? >

A log (article) with only pagename as "home" will be called. See Query_posts () for practical use of this template label. include a page

You may also want to include some pages throughout the site. This makes it much easier to edit site elements. There is a plug-in named improved include page that can be easily achieved. WordPress's Dynamic "page"

A Web page can be static or dynamic. Like those that only need to be created once, without having to recreate the standard HTML static page each time based on user access, you can create the build by Dreamweaver. Correspondingly, a dynamic page, like the one created through WordPress, will be regenerated every time the user accesses it. Many of these are in the form of PHP code, which, depending on each visit, will generate a relative new content.

Almost everything in WordPress is dynamically generated, including pages . All the content (articles, pages, comments, links, categories, etc.) that you or others have written in WordPress is stored in your MySQL database. When your site is visited, your WordPress will call the information from the database, and then through your current use of the WordPress template, generated by the requested corresponding page, feedback to the user. Therefore, WordPress information is dynamic, including those included in the page .

An HTML document can be said to be an example of a static page, no PHP code used, such as "About Me" page, static page and dynamic page of a very big difference, that is, when you change your wordpress settings, or templates, static pages will not change. The page features in WordPress are developed to solve such problems. Every time you modify the content or style, the page will reflect it to your blog.

Although it is a dynamic page , many people regard them as static. For content Publishing, the difference between static and dynamic is clearly explained. More generally speaking, static is "the lack of a typical change." It is easy to understand that the definition of this word affects the description type of the page itself. It is also easy to understand why people think that a page is static; Other content is dynamic, but the page is usually kept still. Because pages are often used to display some fixed information about your site. (for example, information about yourself, a description of your site).

In other words, a page is loaded with static information, but it is dynamically generated. Therefore, whether it is "static" or "dynamic", can be used to describe the features of WordPress page . But in order to avoid clutter and the page itself is dynamic, the page is not considered static in the document.

Related content: Making Your Blog Appear in a non-root Folder This article has been marked as requiring processing. You are welcome to edit it enthusiastically to help Codex. CATEGORIES:ZH-CN: Start using ZH-CN: Design and layout zh-cn: template zh-cn:copyedits zh-cn: Need your help

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.