Today I copied the page listing my activities from the current site to this blog. It was quite easy. I first opened the activities page in my browser, selected all text and pressed Ctrl-C to copy it to the clipboard. Then I logged into my blog, went into the Write > Page administration sub-panel, typed in ‘Activities’ as title and pasted the text into the visual editor. Voilá, due to the behind the scenes magic of copying and pasting the page’s HTML code into the editor, all headings and links were preserved! No further typing or editing necessary; I just published the page and it was done.

However, there were two minor issues. First, the page titles generated by the WordPress default theme are strangely enough second-level headings, like the section headings in my original page. Hence, I would have to manually decrease the level of each section heading. The second issue is that my activities list is a touch long, but the original page compensated that through an automatically generated table of contents to make the page’s structure apparent. I wasn’t able to find out how to do a table of contents in WordPress, other than by editing the page’s HTML code to create one anchor per section heading and then manually creating links to those anchors at the top of the page.

Due to these shortcomings, I decided to try another approach: a WordPress feature called sub-pages. Basically, it’s a way to organize pages in a hierarchy. I simply created one new page for each section of my activities list, using the section heading as page title, and then told WordPress that all those pages are ‘children’ of the main ‘Activities’ page. This is done in the Write > Pages panel. A bit below the visual editor, in the Advanced Options section, there is a drop down menu called ‘Parent Page’ which allows you to select which of the already existing pages is the parent of the page currently being edited.

The visible result of using sub-pages is the way they are listed on the sidebar, as you can see for yourself. In a way, the sub-pages mechanism does automatically the table of contents in the sidebar. However, WordPress doesn’t automatically change the parent page to have links to its sub-pages. I hence had to slightly edit the ‘Activities’ page to point the reader to the sidebar.

There was still one small hurdle to overcome. Sub-pages are by default listed alphabetically . This meant that the originally last section, called ‘Other’, now appeared in the middle of the activities list. The trick was to explicitly define the ‘Page Order’, which can be found below the ‘Page Parent’ option. Each page has a number stating its order of appearance. Pages with the same parent are listed by increasing order, and in case of a tie (same order number) are listed alphabetically. By default, all pages have order zero and that’s why they are listed alphabetically. I therefore only had to increase the order of ‘Other’ to one to make it appear last, while keeping the other activity sub-pages listed in alphabetical order.

Fortunately, my publications page is short and doesn’t require the creation of sub-pages. However, it does link to a PDF file with my CV. The next thing is hence to find out how to upload files to a WordPress blog.

One Comment to “Sub-pages”

  1. [...] looking at my blog’s new sidebar: the pages were listed in the wrong order. If you remember my earlier post, I had tweaked the page order number so that pages would be listed in the order I wanted. However, [...]

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free