Things you should know when displaying pages in Wordpress

June 29th, 2007 § 24

Pages in Wordpress are displayed automatically as navigation menu items on most themes. While many people like this feature, some prefer controlling how and which page gets displayed which I shall discuss in this post.

page status

Any page having the Page Status of Published will be listed in the navigation bar according to a special Wordpress template tag placement within the theme. Some may have pages displayed at the header navigation bar while others listed on the sidebar.

page listing placement

Depending on where your pages are listed, open the header.php file if it’s at the header or the sidebar.php if it’s at the sidebar, both found in your current theme’s folder and look for the following code(use Find feature of your favourite Text Editor):


<?php wp_list_pages('title_li='); ?> (varying according to different theme)

which is wrapped around an <ul></ul> tag.

Depending on the kind of results or effect you want(for e.g listing specific pages,determining pages’ position,etc), change that template tag accordingly as described in the post, Getting the Most Out of Your Wordpress Template Tags: Listing Pages from Theme Playground.

Else to have maximum control, remove the
<?php wp_list_pages('title_li='); ?> template tag and place the link to your pages by yourself, thus deciding by your own about their position and which one appear.

To place a page link, use the following code placing it within the <ul></ul> tag.


<li><a href="link to your page" title="link description">Page title</a></li>

To obtain the page’s link, login to your Wordpress admin section. Navigate to Manage > Pages > Click on View under the Action heading for that particular page you want the link and grab that page’s link from the address bar when it’s being displayed.

Special page template

Many “good” themes come with special pages specifically made for a particular purpose like listing your archives in a structured way or providing you with a link’s page(blogroll). To create and display such page, Login to your Wordpress admin section. Navigate to Write > Write Page. At your right side among the page’s options tab, Under Page Template, click to see the options’ items under the drop down menu. You’ll there know what kind of special page your theme is currently providing you with. Select the appropriate page template you want and click Publish to get and see the results.

page template

Themes such as myJournal Hypereal and Cutline come out of the box with great page template like Archives, Links(blogroll) and Sitemap page. So next time you’re choosing a theme, look into such particular details too.

Should you be allowing discussion on Pages?

comments on pages
While I don’t like displaying the comment’s form on Pages, I wouldn’t recommend you doing this too. First because you would be keeping a page like a static content region where you don’t want people to post comments or send trackback. Most themes don’t come with comments on pages. To check whether yours come with that feature : login to your Wordpress admin section > Manage > Pages > Click Edit under any page and at your right hand side among the page’s options, at the Discussion box, check Allow Comments and Allow Pings checkbox. Save the page and get to that page on your blog. There, see whether the comment’s form is being displayed.

page discussion options

But then sometimes you would be wanting such feature, for e.g displaying the comment’s form on the contact page or about page so that people can leave you a little message if they want, without bothering to send you an email. To provide the commenting feature on pages if your theme doesn’t come with it(see above to check this), proceed as follows. In your current theme’s folder, open the page.php file, add the following code just after the <?php the_content() ?> template tag:


<?php comments_template(); ?>

Now when the options under Discussion, Allow Comments and Allow Pings are checked, the comment form should be displayed on your pages.

Current page listing effect

current page listing effect

Another effect you would want when displaying pages, is providing visitors a clue of which page they are currently on. You can accomplish this by getting over the quick tutorial, WordPress: Active Page Tabs of Nathan Rice on the subject.

Hope you enjoyed this post, please subscribe to my feeds to stay in touch with BlogoSquare. Thanks for reading. If you have got any questions or need further clarification, please do take a comment and I would be glad to help you right away.

§ 24 Responses to “Things you should know when displaying pages in Wordpress”

What's this?

You are currently reading Things you should know when displaying pages in Wordpress at BlogoSquare.

meta