Created
July 28, 2011 11:26
-
-
Save mattboon/1111408 to your computer and use it in GitHub Desktop.
Sitemap of doom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php foreach($primary_nav_items as $level_one_page_id) : | |
// LOOP LEVEL ONE ?> | |
<section> | |
<h2> | |
<a href="<?= get_permalink($level_one_page_id); ?>"> | |
<?= get_the_title($level_one_page_id); ?> | |
</a> | |
</h2> | |
<?php if($level_one_page_id==12): | |
// TEST FOR BLOG SECTION ?> | |
<?php $cats = get_categories(); | |
// GET ALL POST CATEGORIES ?> | |
<ul class="level-2 type-posts-category"> | |
<?php foreach ($cats as $cat): | |
// LOOP ALL POST CATEGORIES ?> | |
<li> | |
<h3 class="section-title level-2-head"> | |
<a href="/blog/category/<?= $cat->slug; ?>"> | |
<?= $cat->name; ?> | |
</a> | |
</h3> | |
<ul class="level-3 type-posts"> | |
<?php | |
global $post; | |
$myposts = get_posts('category='.$cat->cat_ID.''); | |
// GET ALL POSTS IN CATEGORY | |
foreach($myposts as $post) : setup_postdata($post); | |
// LOOP ALL POSTS ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endforeach; | |
// END LOOP ALL POSTS ?> | |
</ul> | |
</li> | |
<?php endforeach; | |
// END LOOP ALL POST CATEGORIES ?> | |
</ul> | |
<?php elseif($level_one_page_id==10): | |
// TEST FOR CASE STUDIES SECTION ?> | |
<?php $client_categories = get_categories(array( 'taxonomy' => 'client-category' )); | |
// GET ALL CLIENT CATEGORIES ?> | |
<?php foreach($client_categories as $category): | |
// LOOP ALL CLIENT CATEGORIES ?> | |
<?php query_posts(array( 'post_type' => 'client', 'showposts' => -1, 'client-category' => $category->slug, 'orderby' => 'title', 'order' => 'ASC', 'meta_key' => 'client_case_study', 'meta_value' => 1 )); | |
// GET ALL CASE STUDIES IN CATEGORY ?> | |
<?php if (have_posts()) : | |
// TEST FOR CASE STUDIES ?> | |
<ul class="level-2 type-case-study-category"> | |
<li> | |
<h3 class="section-title level-2-head"> | |
<?= $category->name; ?> | |
</h3> | |
<ul class="level-3 type-case-studies"> | |
<?php while (have_posts()) : the_post(); | |
// LOOP ALL CASE STUDIES ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endwhile; | |
// END LOOP ALL CASE STUDIES ?> | |
</ul> | |
</li> | |
</ul> | |
<?php endif; | |
// END TEST FOR CASE STUDIES ?> | |
<?php wp_reset_query(); ?> | |
<?php endforeach; | |
// END LOOP ALL CLIENT CATEGORIES ?> | |
<?php else: | |
// OTHERWISE, STANDARD PAGE ?> | |
<?php $level_two = get_pages('child_of='.$level_one_page_id.'&parent='.$level_one_page_id.'&sort_column=menu_order&sort_order=asc&exclude='.$excluded_pages_string.''); | |
// GET ALL LEVEL TWO PAGES ?> | |
<?php if($level_two): | |
// TEST FOR LEVEL TWO PAGES ?> | |
<ul class="level-2"> | |
<?php foreach($level_two as $level_two_page): | |
// LOOP LEVEL TWO ?> | |
<?php $level_three = get_pages('child_of='.$level_two_page->ID.'&parent='.$level_two_page->ID.'&sort_column=menu_order&sort_order=asc&exclude='.$excluded_pages_string.''); | |
// GET ALL LEVEL THREE PAGES ?> | |
<li> | |
<?= $level_three || $level_two_page->ID==36 || $level_two_page->ID==544 || $level_two_page->ID==540 || $level_two_page->ID==483 ? '<h3 class="section-title level-2-head">' : '' ?> | |
<a href="<?= get_page_link($level_two_page->ID); ?>"> | |
<?= $level_two_page->post_title; ?> | |
</a> | |
<?= $level_three || $level_two_page->ID==36 || $level_two_page->ID==544 || $level_two_page->ID==540 || $level_two_page->ID==483 ? '</h3>' : '' ?> | |
<?php if($level_two_page->ID==36): | |
// TEST FOR FAQS SECTION ?> | |
<?php $faq_categories = get_categories(array( 'taxonomy' => 'question-category' )); | |
// GET ALL FAQ CATEGORIES ?> | |
<?php foreach($faq_categories as $category): | |
// LOOP ALL FAQ CATEGORIES ?> | |
<?php query_posts(array( 'post_type' => 'question', 'showposts' => -1, 'question-category' => $category->slug, 'order' => 'ASC' )); | |
// GET ALL FAQS IN CATEGORY ?> | |
<?php if (have_posts()) : | |
// TEST FOR FAQS ?> | |
<ul class="level-3 type-faq-category"> | |
<li> | |
<h4 class="section-title level-3-head"> | |
<?= $category->name; ?> | |
</h4> | |
<ul class="level-4 type-faqs"> | |
<?php while (have_posts()) : the_post(); | |
// LOOP ALL FAQS ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endwhile; | |
// END LOOP ALL FAQS ?> | |
</ul> | |
</li> | |
</ul> | |
<?php endif; | |
// END TEST FOR FAQS ?> | |
<?php wp_reset_query(); ?> | |
<?php endforeach; | |
// END LOOP ALL FAQ CATEGORIES ?> | |
<?php elseif($level_two_page->ID==544): | |
// TEST FOR BOOKS SECTION ?> | |
<?php query_posts(array( 'post_type' => 'publication', 'showposts' => -1, 'orderby' => 'title', 'order' => 'ASC' )); | |
// GET ALL BOOKS ?> | |
<?php if (have_posts()) : | |
// TEST FOR BOOKS ?> | |
<ul class="level-3 type-books"> | |
<?php while (have_posts()) : the_post(); | |
// LOOP BOOKS ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endwhile; | |
// END LOOP BOOKS ?> | |
</ul> | |
<?php endif; | |
// END TEST FOR BOOKS ?> | |
<?php wp_reset_query(); ?> | |
<?php elseif($level_two_page->ID==540): | |
// TEST FOR MANUALS SECTION ?> | |
<?php $manual_series = get_categories(array( 'taxonomy' => 'manual-series' )); | |
// GET ALL MANUALS SERIES' ?> | |
<?php foreach($manual_series as $category): | |
// LOOP ALL MANUALS SERIES' ?> | |
<?php query_posts(array( 'post_type' => 'manual', 'showposts' => -1, 'manual-series' => $category->slug, 'order' => 'ASC' )); | |
// GET ALL MANUALS IN SERIES ?> | |
<?php if (have_posts()) : | |
// TEST FOR MANUALS ?> | |
<ul class="level-3 type-manual-series"> | |
<li> | |
<h4 class="section-title level-3-head"> | |
<a href="/resources/manuals/<?= $series->slug; ?>"> | |
<?= $category->name; ?> | |
</a> | |
</h4> | |
<ul class="level-4 type-manuals"> | |
<?php while (have_posts()) : the_post(); | |
// LOOP ALL MANUALS ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endwhile; | |
// END LOOP ALL MANUALS ?> | |
</ul> | |
</li> | |
</ul> | |
<?php endif; | |
// END TEST FOR MANUALS ?> | |
<?php wp_reset_query(); ?> | |
<?php endforeach; | |
// END LOOP ALL MANUALS SERIES' ?> | |
<?php elseif($level_two_page->ID==483): | |
// TEST FOR GLOSSARY SECTION ?> | |
<?php query_posts(array( 'post_type' => 'term', 'showposts' => -1, 'orderby' => 'title', 'order' => 'ASC' )); | |
// GET ALL GLOSSARY TERMS ?> | |
<?php if (have_posts()) : | |
// TEST FOR GLOSSARY TERMS ?> | |
<ul class="level-3 type-glossary-terms glossary"> | |
<?php while (have_posts()) : the_post(); | |
// LOOP GLOSSARY TERMS ?> | |
<?php | |
$term_size = strtolower(get_post_meta($post->ID, 'glossary_term_importance', true)); | |
?> | |
<li class="<?= $term_size; ?>"> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endwhile; | |
// END LOOP GLOSSARY TERMS ?> | |
</ul> | |
<?php endif; | |
// END TEST FOR GLOSSARY TERMS ?> | |
<?php wp_reset_query(); ?> | |
<?php else: | |
// OTHERWISE, STANDARD PAGE ?> | |
<?php if($level_three): | |
// TEST FOR LEVEL THREE PAGES ?> | |
<ul class="level-3"> | |
<?php foreach($level_three as $level_three_page): | |
// LOOP LEVEL THREE ?> | |
<?php $level_four = get_pages('child_of='.$level_three_page->ID.'&parent='.$level_three_page->ID.'&sort_column=menu_order&sort_order=asc&exclude='.$excluded_pages_string.''); | |
// GET ALL LEVEL FOUR PAGES ?> | |
<li> | |
<?= $level_four || $level_three_page->ID==33 || $level_three_page->ID==271 ? '<h4 class="section-title level-3-head">' : '' ?> | |
<a href="<?= get_page_link($level_three_page->ID); ?>"> | |
<?= $level_three_page->post_title; ?> | |
</a> | |
<?= $level_four || $level_three_page->ID==33 || $level_three_page->ID==271 ? '</h4>' : '' ?> | |
<?php if($level_three_page->ID==33): | |
// TEST FOR EXECUTIVE DEVELOPERS SECTION ?> | |
<?php query_posts(array( 'post_type' => 'developer', 'showposts' => -1, 'order' => 'ASC', 'orderby' => 'meta_value', 'meta_key' => 'developer_surname' )); | |
// GET ALL DEVELOPERS ?> | |
<?php if (have_posts()) : | |
// TEST FOR DEVELOPERS ?> | |
<ul class="level-3 type-developers"> | |
<?php while (have_posts()) : the_post(); | |
// LOOP ALL DEVELOPERS ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endwhile; | |
// END LOOP ALL DEVELOPERS ?> | |
</ul> | |
<?php endif; | |
// END TEST FOR DEVELOPERS ?> | |
<?php wp_reset_query(); ?> | |
<?php elseif($level_three_page->ID==271): | |
// TEST FOR PUBLIC PROGRAMMES SECTION ?> | |
<?php query_posts(array( 'post_type' => 'programme', 'showposts' => -1, 'meta_key' => 'programme_dstart', 'orderby' => 'meta_value', 'order' => 'ASC' )); | |
// GET ALL PUBLIC PROGRAMMES ?> | |
<?php if (have_posts()) : | |
// TEST FOR PUBLIC PROGRAMMES ?> | |
<ul class="level-3 type-programmes"> | |
<?php while (have_posts()) : the_post(); | |
// LOOP PUBLIC PROGRAMMES ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endwhile; | |
// END LOOP PUBLIC PROGRAMMES ?> | |
</ul> | |
<?php endif; | |
// END TEST FOR PUBLIC PROGRAMMES ?> | |
<?php wp_reset_query(); ?> | |
<?php else: | |
// OTHERWISE, STANDARD PAGE ?> | |
<?php if($level_four): | |
// TEST FOR LEVEL FOUR PAGES ?> | |
<ul> | |
<?php foreach($level_four as $level_four_page): | |
// LOOP LEVEL FOUR ?> | |
<li> | |
<a href="<?= get_page_link($level_four_page->ID); ?>"> | |
<?= $level_four_page->post_title; ?> | |
</a> | |
</li> | |
<?php endforeach; | |
// END LOOP LEVEL FOUR ?> | |
</ul> | |
<?php endif; | |
// END TEST FOR LEVEL FOUR PAGES ?> | |
<?php endif; | |
// END TEST FOR ALL CTP's ?> | |
</li> | |
<?php endforeach; | |
// END LOOP LEVEL THREE ?> | |
</ul> | |
<?php endif; | |
// END TEST FOR LEVEL THREE PAGES ?> | |
<?php endif; | |
// END TEST FOR ALL CTP's ?> | |
</li> | |
<?php endforeach; | |
// END LOOP LEVEL TWO ?> | |
</ul> | |
<?php endif; | |
// END TEST FOR LEVEL TWO PAGES ?> | |
<?php endif; | |
// END TEST FOR BLOG ?> | |
</section> | |
<?php endforeach; | |
// END LOOP LEVEL ONE ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment