Last year, I wrote a number of posts to TechNotes (the Smith College technology blog for students) about copyright infringement and the Acceptable Use Policy, but the posts were scattered chronologically, and other than searching by tag, there was no good way to gather all the information/announcements together in one place. With the new semester and a whole new batch of eager students, ready to download re-runs of Sex & The City and Usher songs on LimeWire — it’s time we gathered all that information and make it available to the students.
So, instead of making a fresh design and hand-coding a new site just for 5 or 6 pages of content, I decided to adjust the TechNotes theme for this “sub-site” so that it would look similar to TechNotes, be easy to update, and bring students to TechNotes if they haven’t seen it before. Thus, File Sharing @ Smith was born.
The need for a site that fits in with the current TechNotes site but has it’s own header, sidebar, etc got me to play around with if statements in a WordPress theme for the first time.
To accomplish this, I edited three files (sidebar.php, header.php, style.css) and created a simple template, filesharing.php. All of the pages on this sub-site use the File Sharing template (filesharing.php).
filesharing.php calls get_header(), “the loop”, get_sidebar(), and get_footer() with the appropriate wrappers and classes for my theme.
The TechNotes theme uses a Photoshop image map (the original theme has a bunch of links on a “stickie-note” and this was the simplest way to get it to look right in IE etc… so much for table-less design), so I changed the include in header.php from
The sidebar for TechNotes doesn’t use widgets, it’s hard-coded (mostly because I designed this theme before I knew as much as I do now about theming WordPress, but also because it doesn’t really ever need to change). So, I added the following code to the top of sidebar.php:
Lines 7 – 16 of the code above gather all of the File Sharing pages on TechNotes (including the parent page) and write them out as a an unordered list (modified the code found in the WordPress codex, wp_list_pages(): List subpages even if on subpage)
As for the stylesheet, I added #sidebar-fs to style the File Sharing sidebar seperately from the “normal” sidebar on TechNotes (#sidebar).
Now that I’ve done this once, I’ll probably use this technique for a number of projects.
Last year, I wrote a number of posts to TechNotes (the Smith College technology blog for students) about copyright infringement and the Acceptable Use Policy, but the posts were scattered chronologically, and other than searching by tag, there was no good way to gather all the information/announcements together in one place. With the new semester and a whole new batch of eager students, ready to download re-runs of Sex & The City and Usher songs on LimeWire — it’s time we gathered all that information and make it available to the students.
So, instead of making a fresh design and hand-coding a new site just for 5 or 6 pages of content, I decided to adjust the TechNotes theme for this “sub-site” so that it would look similar to TechNotes, be easy to update, and bring students to TechNotes if they haven’t seen it before. Thus, File Sharing @ Smith was born.
The need for a site that fits in with the current TechNotes site but has it’s own header, sidebar, etc got me to play around with if statements in a WordPress theme for the first time.
To accomplish this, I edited three files (sidebar.php, header.php, style.css) and created a simple template, filesharing.php. All of the pages on this sub-site use the File Sharing template (filesharing.php).
filesharing.php calls get_header(), “the loop”, get_sidebar(), and get_footer() with the appropriate wrappers and classes for my theme.
The TechNotes theme uses a Photoshop image map (the original theme has a bunch of links on a “stickie-note” and this was the simplest way to get it to look right in IE etc… so much for table-less design), so I changed the include in header.php from
<?php include('TechNotesBlogFileTransferBanner.html'); ?>to read
<?php if ( is_page_template('filesharing.php') ) { include('TechNotesBlogFileTransferBanner.html') ; } else { include('TechNotesBlogBanner.html') ; } ?>The sidebar for TechNotes doesn’t use widgets, it’s hard-coded (mostly because I designed this theme before I knew as much as I do now about theming WordPress, but also because it doesn’t really ever need to change). So, I added the following code to the top of sidebar.php:
<?php if (is_page_template('filesharing.php') ) { ?> <div id="sidebar-fs"> <div class="left"> <ul> <?php if($post->post_parent) $children = wp_list_pages("title_li=&include=".$post->post_parent."&echo=0") . wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&include=".$post->ID."&echo=0") . wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <li><h2>File Sharing @ Smith</h2> <ul><?php echo $children; ?></ul> </li> <?php } ?> <!-- File Sharing Quick Links --> <?php wp_list_bookmarks('category=286'); ?> <!-- Copyright Links --> <?php wp_list_bookmarks('category=287'); ?> </ul> </div> </div> <?php } else { ?>Lines 7 – 16 of the code above gather all of the File Sharing pages on TechNotes (including the parent page) and write them out as a an unordered list (modified the code found in the WordPress codex, wp_list_pages(): List subpages even if on subpage)
As for the stylesheet, I added #sidebar-fs to style the File Sharing sidebar seperately from the “normal” sidebar on TechNotes (#sidebar).
Now that I’ve done this once, I’ll probably use this technique for a number of projects.