Advertisement
Guest User

Untitled

a guest
Nov 18th, 2014
361
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None
  1.  
  2.  
  3. <?php
  4. $url = explode('/',$_SERVER['REQUEST_URI']);
  5. $dir = $url[2] ? $url[2] : 'UX-Style-Guide';
  6. $result = str_replace ("?", "", $dir);
  7. $final = current(explode('=', $result));
  8. $style = str_replace ("-", " ", $final);
  9. $style = ucwords($style);
  10. $post_id = $post->ID;
  11. $class = '';
  12. ?>
  13.  
  14. <!-- THIS IS THE LEFTNAV -->
  15. <nav id="verticalNav" class="ui-side-nav-drawer">
  16. <div class="cssmenu">
  17. <div id="entry-search">
  18. <input type="text" placeholder="Search Styleguide Entries" class="fuzzy-search" />
  19. </div>
  20. <ul class="list">
  21. <?php
  22. $nav_cat_args = array(
  23. 'orderby' => 'name',
  24. 'order' => 'ASC',
  25. 'child_of' => 0,
  26. 'exclude'=> 1
  27. );
  28.  
  29. $nav_categories = get_categories($nav_cat_args);
  30. $displayedPosts = array();
  31.  
  32. foreach($nav_categories as $category) {
  33. echo "<li><span class='navAppTitle'>" . $category->name . "</span></li>\n";
  34.  
  35. $nav_post_args = array(
  36. 'numberposts' => -1,
  37. 'category' => $category->term_id,
  38. 'post_type' => $final,
  39. 'orderby' => 'name',
  40. 'order' => 'ASC',
  41. 'child_of' => 0
  42. );
  43.  
  44. $nav_posts = get_posts($nav_post_args);
  45. $childcats = get_categories('child_of=' . $nav_categories . '&hide_empty=1');
  46.  
  47. foreach($nav_posts as $post) {
  48. if (in_array($post->ID, $displayedPosts)) {
  49. continue; //Skip this post if it has already been displayed once.
  50. }
  51.  
  52. $displayedPosts[] = $post->ID;
  53. $class = '';
  54.  
  55. if ($post_id == $post->ID) {
  56. $class = 'entry-title current';
  57. } else {
  58. $class = 'entry-title';
  59. }
  60.  
  61. echo "<li class='$class'>";
  62. echo "<a class='entry-link' href='";
  63. echo the_permalink();
  64. echo "'>";
  65. echo the_title();
  66. echo '</a>';
  67. echo "</li>\n";
  68.  
  69. foreach ($childcats as $childcat) {
  70. if (1 == $childcat->category_parent) {
  71. echo "\t" . '<li><a href="' . get_category_link($childcat->cat_ID).'" title="' . $childcat->category_description . '">';
  72. echo $childcat->cat_name . '</a>';
  73. echo '</li>' . "\n";
  74. }
  75. }
  76.  
  77. }
  78. }
  79. ?>
  80.  
  81. <?php wp_reset_query(); ?>
  82. <div id="job-listings">
  83. </div>
  84. </ul>
  85. </div>
  86. </nav><!-- /END #verticalNav -->
Advertisement
RAW Paste Data Copied
Advertisement