Search

Understanding WordPress Pages and the Pages API

There are differences in between WordPress posts and pages. There are times when a post is more appropriate to utilize, while for other types of material, a page is better. In this article, I’ll cover what pages are and why they are various to posts. I’ll then reveal you how to manage pages on a WordPress website. Finally, we’ll take a look at some functions in the WordPress Pages API and have a play with pages.A WordPress page is a page of material on your site, for instance a ‘Contact’ or ‘About’ page. We often see connect to these pages in the main navigation, sidebar, or the possibly in the footer of the website.The primary difference in between a post and a page is the context in time: a post is generally time-dependant, while the material within a page is often permanent.When you release

news, or even a tutorial, the context is crucial. A new feature will not be brand-new permanently, and in some cases may not exist some years later. That’s why a post is more adapted when writing this kind of content.On the other hand, if you want to describe the function

of your site, or if you desire to supply a contact form, you’ll wish to use a page. It’s the kind of fixed material that will not alter in time.Adding, Editing and Eliminating a Page If you have Editor or Administrator approvals, you can manage the pages in WordPress. To do this, go to’ Pages’ in the WordPress control panel, to see a list of all your pages or to produce a brand-new page through the’ Include New’ button.< img src=" https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2017/03/1489682640WordPress-Pages-API-1024x642.png" alt=" WordPress Pages API" width=" 1024" height=" 642" > This list resembles the list found in’ Posts ‘, and can be used in the exact same way. You can click on a page’s title to modify it and some other useful quick links appear when you move your mouse over the page’s title. When you click to modify or add a page or post you can then define the title, material even add a highlighted image if your style supports it. The’ Publish’ button permits you to publish the page, otherwise, if you’re not all set to make it live you can save it as a draft. Organizing Pages To arrange your posts, you can utilize categories and tags. However, there isn’t really a comparable way to organize pages. Pages can still be organized in

a hierarchy. In

reality, you can suggest pages as subpages of other pages. It’s exactly like creating subcategories for your categories.To develop a subpage, go to the’ Page Attributes’ box where you’ll find a dropdown list identified ‘Moms and dad’. In this list, choose the page you want as the moms and dad of the page you’re currently producing or modifying. Keep in mind, you can likewise develop sub-subpages, sub-sub-subpages, and so on to develop your own hierarchy.By default, the pages are sorted alphabetically( by their titles). You can personalize this order thanks to the’ Order’ field, in the’ Page Attributes ‘area. Then, the pages will be arranged following the number you indicate in this field. As an example, if you have 3 pages entitled’ Page 1′,’ Page 2′ and’ Page 3′, they will be shown in this order by default. If you wish to make’ Page 3′ appear initially, indicate’ 0 ‘as its order, and bigger numbers for the other pages( ‘1’ and’ 2′ for example). Displaying a List of Pages To display a list of pages, WordPress provides the wp_list_pages() function. By default, it shows the HTML code for a ul list containing all the published pages, encapsulated in a li tag with a h2 heading

suggesting ‘Pages

‘. It also accepts one criterion: an associative array listing some options to personalize the output.Filtering the Output It’s possible to restrict the number of displayed pages thanks to some choices. The very first one we will see is child_of. It allows us to show the pages that have an offered page as moms and dad. The copying shows the children of the page with ID 2.

Written by 

Related posts