WordPress as a CMS… Advanced Navigation

Wordpress
Creative Commons License photo credit: drustar

One of the things that is starting to happen at OLT is that we are creating an increasing number of WordPress based websites. Using WordPress as a content management system is not a new idea at all, there are a ton of examples out there of WordPress blogs out there that have been turned into sites. There is however, a dearth of information out there on how to do it (there are some out there… including some in amazing detail from Alan Levine).

One of the things that I couldn’t find was a stable way to create a second level navigation that stays constant for every top level section. The problem with most of the solutions on the forums and sites around is that as soon as you drill down to the third level of navigation the second level disappears. As you can see at aboriginal.ubc.ca I was able to come up with a way to keep the navigation constant. Here is the loop that I had to create:

<?php
$secondAncestor = count($post->ancestors) -1; //figure out what level of navigation we are on, subtract one because we don't want to consider the top-level
if($post->post_parent!=0) //if the page is not a top-level category
{
echo '<h2 class="widgettitle">In this section:</h2><li class="sidebarlist">';
//the following lists children of second level ancestor of the current page.
wp_list_pages("title_li=&child_of=".$post->ancestors[$secondAncestor]."&    sort_column=menu_order&echo=1");
echo '</li>';
}
else //if the page is a top-level category
{
//listing only the child pages of the current section
$children= wp_list_pages("title_li=&child_of=".$post->ID."&  sort_column=menu_order&echo=0");
if($children) //this will stop it from displaying a section heading if there are   no elements in the section (for example on the home page)
{
echo '<h2 class="widgettitle">In this section:</h2><li>';
echo $children;

echo '</li>';

}
}
?>


This is the first time I’ve blogged code, I’m not even sure if it is readable… but here’s hoping. Basically I figure out what level of navigation the user is on and then list the pages of the current page’s ancestor… that many levels up (subtracting one for the top level navigation.

I am currently doing a lot of work on using WordPress as a content management system including coming up with plugins and modifications for using WordPress MU as a multi-site manager used purely for websites and not for blogs. Will blog it all once everything is stable and working.

Zemanta Pixie

In honour of Dr, Donald Wehrung

Chan Centre for the Performing Arts.

Image via Wikipedia

Yesterday I was invited to attend a ceremony to celebrate Don Wehrung’s contribution to the International Student Initiative at UBC. It was an incredible ceremony and all the speakers did a fantastic job of highlighting what a great man Don truly is.

Don is the person who was asked to head the International Student Initiative when it started back in 1996. The goals of the program was to increase the number of international students at UBC. Don has been incredibly successful, around 10 percent of UBC students at the moment being international. One of the most important contributions that Don made (at least as it applies to me) is starting the International Leader of Tomorrow (ILOT) Award . He lobbied the university for money to provide what has become the most generous international scholarship program in Canada. At the ceremony Karen McKellin the Associate Director of the International Student Initiative told the Audience that Don risked his job to provide international scholarships at UBC. Some of the most important people at UBC including the Dean of Arts and VP Academic both told stories of how Don personally fought for funding on a case by case basis for ILOT winners. The dedication, care and selflessness that he has shown concerning less privileged international students is remarkable.

Don’s actions and initiatives have shaped almost every aspect of my life. The staff that he hired and the recruitment program that he developed have directly influenced how I see the university and what I have experienced. Damara Klaassen who came to my school in Ghana and showed me all the pretty pictures that sold me on UBC. Badre Hassani, who on my first day at UBC made me feel so completely at home, taking me into his office, serving me tea and even giving me an international calling card so that I could contact my parents. Karen McKellin who on my third day alone in this strange country/city/campus helped me to transport all of my possessions from one side of campus to the other. All these people, Don’s staff, their kindness and caring created a love and awe for UBC that lingers with me still.

The ILOT award that I was lucky enough to receive has allowed me to come here, to form this great life that I have. At UBC I have found new passions, friends and interests, all of which are incredibly dear to me. Everything that I own, everything that I do, all the relationships that I have made would not have been possible without Don, his staff and their never-ending commitment to my success. I lack the  necessary eloquence to truly describe just how grateful I  am to them for all that I have. That gratitude is there though, in overwhelming amounts for not only me, but also for the many other students that he has helped.

Thank you Don.

Zemanta Pixie

Opening the Irving K. Barber Learning Center

A few weeks ago, I was asked by Julie Mitchel if I would be able to speak at the opening of the Irving K. Barber Learning Center. She wanted me to give a student’s perspective of what the Learning Center means to the students of UBC. I accepted, not really understanding what I was getting myself into. As the weeks went by subsequent meetings with Julie made me see that the ceremony was a lot more important than I ever could have imagined. For a great description of what the ceremony was actually about, Phillip Jeffrey wrote an excellent post here. I am still unable to express just how terrifying it was to speak after people like Professor Stephen Toope and Gordon Campbell. It went off pretty well though and I think my speech was well received. Pictures of the event (courtesy of Philip Jeffrey) can be found here. A video of it can also be found here (I talk right at the end).

It was an amazing experience and I feel so honored to have been a part of it.