Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = explode('/', $_SERVER['REQUEST_URI']);
- $dir = $url[2] ? $url[2] : 'UX-Style-Guide';
- $result = str_replace ("?","",$dir);
- $final = current(explode('=', $result));
- $style = str_replace ("-"," ",$final);
- $style = ucwords($style);
- $post_id = $post->ID;
- $class = '';
- function displayPosts($categoryObj, &$displayedPosts, $post_id, $final) {
- $nav_post_args = array(
- 'numberposts' => -1,
- 'category' => $categoryObj->term_id,
- 'post_type' => $final,
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'child_of' => 0
- );
- $nav_posts = get_posts($nav_post_args);
- $output = '';
- foreach($nav_posts as $post) {
- if (in_array($post->ID, $displayedPosts)) {
- continue; //Skip this post if it has already been displayed once.
- }
- $title = the_title();
- $link = the_permalink();
- if ($title === '→') {
- continue; //Help avoid output weirdness
- }
- $displayedPosts[] = $post->ID;
- $class = '';
- if ($post_id == $post->ID) {
- $class = 'entry-title current';
- } else {
- $class = 'entry-title';
- }
- $output .= "<li class='$class'>";
- $output .= "<a class='entry-link' href='$link'>$title</a>";
- $output .= "</li>\n";
- }
- return $output;
- }
- ?>
- <!-- THIS IS THE LEFTNAV -->
- <nav id="verticalNav" class="ui-side-nav-drawer">
- <div class="cssmenu">
- <div id="entry-search">
- <input type="text" placeholder="Search Styleguide Entries" class="fuzzy-search" />
- </div>
- <ul class="list">
- <?php
- $nav_cat_args = array(
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'child_of' => 0,
- 'exclude'=> 1
- );
- $nav_categories = get_categories($nav_cat_args);
- $displayedPosts = array();
- foreach($nav_categories as $category) {
- echo "<li><span class='navAppTitle'>" . $category->name . "</span></li>\n";
- echo displayPosts($category, $displayedPosts, $post_id, $final);
- $subcatArgs = array('parent' => $category->ID);
- $subCategories = get_categories($subcatArgs);
- foreach ($subCategories as $subCategory) {
- echo "<ul class='subCategoryList'>\n";
- echo "<li><span class='navAppTitle subCategory'>" . $subCategory->name . "</span></li>\n";
- echo displayPosts($subCategory, $displayedPosts, $post_id, $final);
- echo "</ul>\n";
- }
- }
- ?>
- <?php wp_reset_query(); ?>
- <div id="job-listings"></div>
- </ul>
- </div>
- </nav><!-- /END #verticalNav -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement