lberelson

custom3: sidebar-classes

Jan 23rd, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1. <p style="font-weight:bold; color:#7c7c7c; font-size: .9em; margin-bottom:6px;">Click headings to see classes now offered.</p>
  2. <!-- accordion dynamic -->
  3. <div id="accordion" style="width:250px;">  
  4. <?php
  5.     $args=array(
  6.       'child_of' => 4,
  7.       'orderby' => 'name',
  8.       'order' => 'ASC',
  9.       'hide_empty' => '0'
  10.       );
  11.     $categories=get_categories($args);
  12.       foreach($categories as $category) {
  13.         echo '<h3>' . $category->name . '</h3>
  14.         <div>';
  15.             global $post;
  16.             $args = array( 'posts_per_page' => -1, 'category' => $category->term_id, 'orderby' => 'name', 'order' => 'ASC' );
  17.             //alternatively this also works:  'nopaging' => true
  18.             $courseposts = get_posts( $args );
  19.            
  20.             if (!$courseposts) {
  21.                 echo '<p style="color:#7c7c7c;">Call us and set up an appointment for personalized training.</p>';
  22.                 }
  23.             else {
  24.             foreach( $courseposts as $post ) :  setup_postdata($post);
  25.             echo  '<p>       <a href="'   . get_permalink($post->ID) . ' "style="color:#7c7c7c; font-size:1em; text-decoration:none !important;"   id="sectionTitle" >' . get_the_title($post->ID) . '</a></p>';
  26.            
  27.             endforeach;
  28.             }
  29.         echo  '</div>
  30.       ';
  31.     }
  32. ?>
  33. </div><!-- accordion -->
  34. <p>&nbsp;</p>
Advertisement
Add Comment
Please, Sign In to add comment