пї http://codex.wordthai.com/index.php?title=Pages&feed=atom&action=history Pages - ประวัติการปรับปรุง 2024-03-28T17:12:28Z ประวัติการปรับปรุงของหน้านี้ในวิกิ MediaWiki 1.13.2 http://codex.wordthai.com/index.php?title=Pages&diff=206&oldid=prev Kazama: หน้า ถูกเปลี่ยนชื่อเป็น Pages 2011-10-07T02:39:54Z <p><a href="/%E0%B8%AB%E0%B8%99%E0%B9%89%E0%B8%B2" class="mw-redirect" title="หน้า">หน้า</a> ถูกเปลี่ยนชื่อเป็น <a href="/Pages" title="Pages">Pages</a></p> <table style="background-color: white; color:black;"> <col class='diff-marker' /> <col class='diff-content' /> <col class='diff-marker' /> <col class='diff-content' /> <tr valign='top'> <td colspan='2' style="background-color: white; color:black;">←รุ่นก่อนหน้า</td> <td colspan='2' style="background-color: white; color:black;">การปรับปรุง เมื่อ 02:39, 7 ตุลาคม 2554</td> </tr> <!-- diff generator: internal 2024-03-28 17:12:28 --> </table> Kazama http://codex.wordthai.com/index.php?title=Pages&diff=32&oldid=prev Kazama: สร้างหน้าใหม่: In WordPress, you can write either posts or pages. When you're writing a regular blog entry, you write a post. Posts automatically appear in reverse chronolo... 2008-11-05T12:19:55Z <p>สร้างหน้าใหม่: In WordPress, you can write either posts or pages. When you're writing a regular blog entry, you write a post. Posts automatically appear in reverse chronolo...</p> <p><b>หน้าใหม่</b></p><div>In WordPress, you can write either posts or pages. When you're writing a regular blog entry, you write a post. Posts automatically appear in reverse chronological order on your blog's home page. Pages, on the other hand, are for content such as &quot;About Me,&quot; &quot;Contact Me,&quot; etc. Pages live outside of the normal blog chronology, and are often used to present information about yourself or your site that is somehow timeless -- information that is always applicable. You can use Pages to organize and manage any amount of content. <br /> <br /> Other examples of common pages include Copyright, Legal Information, Reprint Permissions, Company Information, and Accessibility Statement. (By the way, it's a good idea to always have an about page and a contact page -- see this [http://lorelle.wordpress.com/2005/09/28/who-the-hell-are-you/ advice from Lorelle].)<br /> <br /> In general, Pages are very similar to Posts in that they both have Titles and Content and can use your site's Presentation Templates to maintain a consistent look throughout your site. Pages, though, have several key distinctions that make them quite different from Posts.<br /> <br /> ==Pages in a Nutshell==<br /> <br /> '''What Pages Are:'''<br /> * Pages are for content that is less time-dependent than Posts.<br /> * Pages can be organized into pages and [[#Organizing_your_Pages|SubPages]].<br /> * Pages can use different [[#Page Templates|Page Templates]] which can include [[Stepping Into Templates|Template Files]], [[Template Tags]] and other PHP code. <br /> <br /> '''What Pages are Not:'''<br /> <br /> * Pages are not Posts, nor are they excerpted from larger works of fiction. They do not cycle through your blog's main page. ('''Note:''' You can include Posts in Pages by using the [http://aralbalkan.com/wordpress/ Inline Posts Plugin].) <br /> * Pages cannot be associated with Categories and cannot be assigned Tags. The organizational structure for Pages comes only from their hierarchical interrelationships, and not from Tags or Categories.<br /> * Pages are not files. They are stored in your database just like Posts are.<br /> * Although you can put Template Tags and PHP code into a Page Template, you cannot put these into the content of a Page and expect them to run. ('''Note''': You can achieve this by using a PHP evaluating Plugin such as [http://wordpress.org/extend/plugins/exec-php/ Exec-PHP] or [http://dev.wp-plugins.org/wiki/RunPHP RunPHP].) &lt;!-- The page has been deleted, commenting out link. See also the list of [[Plugins/Posts Formatting|Posts Formatting Plugins]].) --&gt;<br /> <br /> ==Creating Pages==<br /> <br /> To create a new Page, log in to your WordPress installation with sufficient admin privileges to create new articles. In the [[Administration Panels|Administration Panel]], choose the [[Administration_Panels#Write_-_Make_some_content|Write]] tab and then choose the [[Write Page SubPanel|Page]] subtab to access the page where you can create your new Page.<br /> <br /> ==Changing the URL (or &quot;Slug&quot;) of Your Pages==<br /> With 2.5, changing the page URL became less intuitive. If you have Permalinks enabled, and you have selected the '''Day and Name''' option (Click the '''Settings''' tab, and then click the '''Permalinks''' subtab), then the permalink automatically shows up below your post title when you start typing in the body of your post (not just the title).<br /> <br /> However, if you have a different permalink option selected, or if you don't have permalinks enabled at all, you must do the following to edit your page URL:<br /> # Write a page by going to '''Write &gt; Page'''.<br /> # Click the '''Publish''' button to publish your page.<br /> # Go to '''Manage &gt; Pages'''.<br /> # Click '''Edit''' next to your page.<br /> # See the permalink under the title, and click the '''Edit''' link to change it.<br /> <br /> Thus, if you don't have the right permalink option enabled, you have to publish your pages before you can set the URLs.<br /> <br /> ==Listing Your Pages on Your Site==<br /> <br /> WordPress is able to ''automatically'' generate a list of Pages on your site, for example within the sidebar, using a [[Template Tags|Template Tag]] called &lt;tt&gt;wp_list_pages()&lt;/tt&gt;. See the [[Template Tags/wp_list_pages|wp_list_pages]] page for information on how to do the following:<br /> *Sort the list of Pages (to fully customize the order in which the Pages are listed, you might find the &quot;Page Order&quot; section on the Write &gt; Page administration panel &lt;!-- [[USER:MDAWaffe/Write Page SubPanel]] --&gt;useful),<br /> *[[Template Tags/wp_list_pages#Exclude Pages from List|exclude]] (or 'hide') a Page from the list,<br /> *Control which Pages are displayed (i.e., all Pages or just certain SubPages), and<br /> *Control how deep into your Page hierarchy the list goes.<br /> <br /> Naturally, you can also link to Pages manually with an HTML link. For example, if you want your Copyright Page listed in your footer, that link might read as below: &lt;br /&gt;<br /> '''If you ''do not'' have [[Using Permalinks|Permalinks]] set up'''<br /> &lt;a title=&quot;Copyright information&quot; href=&quot;wordpress/?page_id=14&quot;&gt;Copyright 1996-2006&lt;/a&gt;<br /> '''If you ''do'' have [[Using Permalinks|Permalinks]] set up'''<br /> <br /> &lt;a title=&quot;Copyright information&quot; href=&quot;wordpress/copyright/&quot;&gt;Copyright 1996-2006&lt;/a&gt;<br /> <br /> '''Note''': Your .htaccess file ''must'' be writeable for Page Permalinks to work, otherwise you must update your .htaccess file every time you create a Page.<br /> <br /> ==Organizing Your Pages==<br /> <br /> Just as you can have Subcategories within your Categories, you can also have '''SubPages''' within your Pages, creating a hierarchy of pages.<br /> <br /> For example, suppose you are creating a WordPress site for a travel agent and would like to create an individual Page for each continent and country to which the agency can make travel arrangements. You would begin by creating a Page called &quot;Africa&quot; on which you could describe general information about travel to Africa. Then you would create a series of Pages which would be SubPages to &quot;Africa&quot; and might include &quot;Lesotho&quot;, &quot;Cameroon&quot;, &quot;Togo&quot;, and &quot;Swaziland&quot;. Another individual Page is made for &quot;South America&quot; and would feature SubPages of &quot;Brazil&quot;, &quot;Argentina&quot;, and &quot;Chile&quot;. Your site would then list:<br /> *Africa<br /> **Cameroon<br /> **Lesotho<br /> **Swaziland<br /> **Togo<br /> *South America<br /> **Argentina<br /> **Brazil<br /> **Chile<br /> <br /> To begin the process, go to [[Administration_Panels|Administration]] &gt; [[Administration_Panels#Write_-_Make_some_content|Write]] &gt; [[Write_Page_SubPanel|Write Page]] panel&lt;!-- [[USER:MDAWaffe/Write Page SubPanel]] --&gt;, in the upper right corner of the panel and click the &quot;Page Parent&quot; drop-down menu. The drop-down menu contains a list of all the Pages already created for your site. To turn your current Page into a SubPage, or &quot;Child&quot; of the &quot;Parent&quot; Page, select the appropriate Page from the drop-down menu. If you specify a Parent other than &quot;Main Page (no parent)&quot; from the list, the Page you are now editing will be made a Child of that selected Page. When your Pages are [[#Listing Your Pages on Your Site|listed]], the Child Page will be nested under the Parent Page. The [[Using Permalinks|Permalinks]] of your Pages will also reflect this Page hierarchy. <br /> <br /> In the above example, the [[Using Permalinks|Permalink]] for the Cameroon Page would be:<br /> <br /> &lt;nowiki&gt;http://example.com/africa/cameroon/&lt;/nowiki&gt;<br /> <br /> ==Page Templates==<br /> <br /> Individual Pages can be set to use a specific custom '''Page Template''' (a PHP template file, e.g., snarfer.php) you create within your Theme (see [[#Creating Your Own Page Templates|Creating your own Page Templates]] below on how to create a custom template). This new Page Template will then override the default &lt;tt&gt;page.php&lt;/tt&gt; Page Template included with your Theme. See [[#What Template is used to Display a Particular Page?|What Template is used to Display a Particular Page?]] below, to find out exactly which Template will be used, but read the following first, so you understand the answer &lt;tt&gt;:)&lt;/tt&gt;<br /> <br /> WordPress can be configured to use '''different Page Templates for different Pages.''' Toward the bottom of the Write &gt; Page administration panel (or on the sidebar, depending on which version of WordPress you are using) is a drop-down labeled &quot;Page Template.&quot; From there you can select which Template will be used when displaying this particular Page. <br /> <br /> '''NOTE:''' In order to access the Page Template selector, there must be at least one custom Page Template available in the active theme (see [[#Creating Your Own Page Templates|Creating your own Page Templates]] below to learn how to create one).<br /> <br /> ===Default Theme Page Templates===<br /> <br /> The Default theme contains three Page Templates for your use:<br /> <br /> * &lt;tt&gt;page.php&lt;/tt&gt; - Default Page Template: displays Page content <br /> * &lt;tt&gt;archives.php&lt;/tt&gt; - ignores Page content and instead displays a list of Archives by Month and Archives by Subject (by Category)<br /> * &lt;tt&gt;links.php&lt;/tt&gt; - ignores Page content and instead displays your links using [[Template_Tags/get_links_list | get_links_list]]<br /> <br /> ===What Template is used to Display a Particular Page?===<br /> <br /> WordPress will look for several template files in your active Theme. The first one it finds will be used to display any given Page. WordPress will look for files in the following order: <br /> <br /> #The Page's selected &quot;Page Template&quot;<br /> #&lt;tt&gt;page.php&lt;/tt&gt;<br /> #&lt;tt&gt;index.php&lt;/tt&gt;<br /> <br /> ===Creating Your Own Page Templates===<br /> <br /> The files defining each Page Template are found in your [[Using Themes|Themes]] directory. To create a new Custom Page Template for a Page you must create a file. Let's call our first Page Template for our Page &lt;tt&gt;snarfer.php&lt;/tt&gt;. At the top of the &lt;tt&gt;snarfer.php&lt;/tt&gt; file, put the following:<br /> <br /> &lt;?php<br /> /*<br /> Template Name: Snarfer<br /> */<br /> ?&gt;<br /> <br /> The above code defines this &lt;tt&gt;snarfer.php&lt;/tt&gt; file as the &quot;Snarfer&quot; Template. Naturally, &quot;Snarfer&quot; may be replaced with most any text to change the name of the Page Template. This Template Name will appear in the Theme Editor as the link to edit this file.<br /> <br /> The file may be named ''almost'' anything with a &lt;tt&gt;.php&lt;/tt&gt; extension (see [[Theme Development#Theme Template Files List|reserved Theme filenames]] for filenames you should ''not'' use; these are special file names WordPress reserves for specific purposes).<br /> <br /> What follows the above five lines of code is up to you. The rest of the code you write will control how Pages that use the Snarfer Page Template will display. See [[Template Tags]] for a description of the various WordPress Template functions you can use for this purpose. You may find it more convenient to copy some other Template (perhaps &lt;tt&gt;page.php&lt;/tt&gt; or &lt;tt&gt;index.php&lt;/tt&gt;) to &lt;tt&gt;snarfer.php&lt;/tt&gt; and then add the above five lines of code to the beginning of the file. That way, you will only have to ''alter'' the HTML and PHP code, instead of creating it all from scratch. Examples are shown [[#Examples|below]]. Once you have created the Page Template and placed it in your Theme's directory, it will be available as a choice when you create or edit a Page. ('''Note''': when creating or editing a Page, the Page Template option does not appear unless there is at least one template defined in the above manner.)<br /> <br /> == Examples of Pages and Templates ==<br /> &lt;span id=&quot;Examples_of_Pages&quot;&gt;&lt;/span&gt;&lt;span id=&quot;Examples&quot;&gt;&lt;/span&gt;<br /> <br /> The following is a list of instructional examples. Feel free to make additions.<br /> <br /> ===Archives with Content===<br /> A Page Template that shows the Page's content at the top, and then displays a list of archive months and categories below it. This is designed to work with WordPress's Default theme (aka Kubrick), but will probably work with many other themes with a little modification.<br /> <br /> Save this to &lt;tt&gt;arc-cont.php&lt;/tt&gt;:<br /> <br /> &lt;nowiki&gt;<br /> &lt;?php<br /> /*<br /> Template Name: Archives with Content<br /> */<br /> ?&gt;<br /> <br /> &lt;?php get_header(); ?&gt;<br /> <br /> &lt;div id=&quot;content&quot; class=&quot;widecolumn&quot;&gt;<br /> <br /> &lt;?php if (have_posts()) : while (have_posts()) : the_post();?&gt;<br /> &lt;div class=&quot;post&quot;&gt;<br /> &lt;h2 id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;&lt;?php the_title();?&gt;&lt;/h2&gt;<br /> &lt;div class=&quot;entrytext&quot;&gt;<br /> &lt;?php the_content('&lt;p class=&quot;serif&quot;&gt;Read the rest of this page &amp;amp;raquo;&lt;/p&gt;'); ?&gt;<br /> &lt;/div&gt;<br /> &lt;/div&gt;<br /> &lt;?php endwhile; endif; ?&gt;<br /> &lt;?php edit_post_link('Edit this entry.', '&lt;p&gt;', '&lt;/p&gt;'); ?&gt;<br /> <br /> &lt;/div&gt;<br /> &lt;div id=&quot;main&quot;&gt;<br /> <br /> &lt;?php include (TEMPLATEPATH . '/searchform.php'); ?&gt;<br /> <br /> &lt;h2&gt;Archives by Month:&lt;/h2&gt;<br /> &lt;ul&gt;<br /> &lt;?php wp_get_archives('type=monthly'); ?&gt;<br /> &lt;/ul&gt;<br /> <br /> &lt;h2&gt;Archives by Subject:&lt;/h2&gt;<br /> &lt;ul&gt;<br /> &lt;?php wp_list_cats(); ?&gt;<br /> &lt;/ul&gt;<br /> <br /> &lt;/div&gt;<br /> &lt;?php get_footer(); ?&gt;<br /> &lt;/nowiki&gt;<br /> <br /> == WordPress as a CMS ==<br /> <br /> You can use WordPress for basic content management. If you do, you'll probably create a large number of pages for your content.<br /> <br /> === Using a Page as the Front Page ===<br /> <br /> WordPress 2.1 introduced the Option to conveniently set any Page as your Front Page. Go to '''Settings &gt; Reading''' in the Wordpress Admin interface. Under the Front Page Category, you can choose to set any (published) Page or Posts Page as the Front Page. The default setting shows your blog with the latest blog posts.<br /> <br /> === Alternate Methods for Setting the Front Page ===<br /> <br /> If you don't want to use the built-in feature to set the home page as a static page, you have two other options. Using the [http://www.semiologic.com/projects/static-front/ Static Front Page Plugin], it is possible to set any Page as the &quot;front page&quot; of your site. The Plugin modifies the home page query and sticks the Page with a Page slug of &quot;home&quot; to the front page. <br /> <br /> When the Page is being displayed as the homepage, if a Page Template with the filename &lt;tt&gt;home.php&lt;/tt&gt; exists for your active Theme, the Plugin will override the Page's set Page Template and use &lt;tt&gt;home.php&lt;/tt&gt; instead. The Page's set Page Template will still apply if the Page is visited like a standard Page (e.g., &lt;tt&gt;&lt;nowiki&gt;http://example.com/home/&lt;/nowiki&gt;&lt;/tt&gt;)<br /> <br /> As an alternative to the Plugin, WordPress will recognize a &quot;home.php&quot; document in your template directory and use it rather than index.php to theme your front page. However, if your home page isn't your blog, be advised that the home.php template will always apply to the blog page whether you like it or not. Using the [[Template Tags/query posts | query_posts()]] template tag, you can call on any page before you invoke [[The Loop]]. For instance:<br /> &lt;pre&gt;<br /> &lt;?php <br /> query_posts('pagename=home'); <br /> ?&gt;<br /> &lt;/pre&gt;<br /> <br /> Will call up only the post with the pagename &quot;home.&quot; See [[Template Tags/query posts | query_posts()]] for more examples of the template tag in action.<br /> <br /> == Including a Page ==<br /> <br /> You might also want to include Pages in various places on your site. That way, you can have an easy way to edit elements of your website. There is a Plugin called [http://www.vtardia.com/improved-include-page/ Improved Include Page] that makes doing this easy.<br /> <br /> == The Dynamic Nature of WordPress &quot;Pages&quot; ==<br /> <br /> A web page can be ''static'' or ''dynamic.'' Static pages, such as a regular HTML page that you might create with Dreamweaver, are those which have been created once and do not have to be regenerated every time a person visits it. In contrast, dynamic pages, such as those you create with WordPress, do need to be regenerated every time they are viewed; code for what to generate has been specified by the author, but not the actual page itself. These use extensive PHP code which is evaluated each time the page is visited, and the content is thus generated on the fly, upon each new visit.<br /> <br /> Almost everything in WordPress is generated dynamically, including '''Pages'''. Everything you and others write in WordPress (Posts, '''Pages''', Comments, Blogrolls, Categories, etc.) is stored in your [[Glossary#MySQL|MySQL]] database. When your site is accessed, that database information is then used by your WordPress [[Theme Development#Theme Templates|Templates]] from your current [[Using Themes|Theme]] to generate the web page being requested. Thus, WordPress information is dynamic, including the information contained in your '''Pages'''.<br /> <br /> An example of a static page might be an [[Glossary#HTML|HTML]] document (without any [[Glossary#PHP|PHP]] code) you've written as an addition to your dynamically generated WordPress pages, perhaps an &quot;About Me&quot; page. The problem with purely static pages is that they are difficult to maintain. Changes you make to your WordPress settings, [[Using Themes|Themes]] and [[Theme Development#Theme Templates|Templates]] will not be propagated to pages coded only in HTML. The '''Page''' feature of WordPress was developed, in part, to alleviate this problem. By using '''Pages''', users no longer have to update their static pages every time they change the style of their site. Instead, if written properly, their dynamic '''Pages''' will update themselves along with the rest of your blog.<br /> <br /> Despite the dynamic nature of '''Pages''', many people refer to them as being static. In the context of web publishing, static and dynamic mean what has been described above. More generally, however, static can mean &quot;characterized by a lack of change&quot;. It is easy to see how this definition influenced the word's use in describing types of web pages. It is also easy to see why people think of '''Pages''' as being static; Posts come and go, but '''Pages''' are here to stay since '''Pages''' are typically used to display information about your site which is constant (e.g., information about yourself, description of your site).<br /> <br /> In other words, a '''Page''' contains ''static information'' but is ''generated dynamically''. Thus, either &quot;static&quot; or &quot;dynamic&quot; may be validly used to describe the nature of the WordPress '''Page''' feature. However, in order to avoid confusion, and because '''Pages''' ''themselves'' are dynamic while it is only their ''contents'' which are in some way static, this document does not refer to '''Pages''' as being static.<br /> <br /> Related content:<br /> *[[Making Your Blog Appear in a Non-Root Folder]]</div> Kazama