• [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin.com. As it is, the forum parser may have messed up your posted code. ]

    <?php get_header(); ?>
    
    <!-- #primary -->
    <div id="primary" class="container clearfix">
    
    <!-- #content -->
      <section id="content" role="main">
    
      <div id="page-header">
      <h2><?php __('Article Categories','framework') ?></h2>
      </div>
    
    <div id="homepage-categories" class="clearfix">
    
    <?php
    $cat_args = array(
      'orderby' => 'name',
      'order' => 'ASC',
      'child_of' => 0
    );
    
    $categories =   get_categories($cat_args); 
    
    foreach($categories as $category) {
    	$catCounter++;
    
    	if ((!is_int($catCounter / 2)) && $catCounter != 1) {
    echo '</div><div class="row">';} elseif ($catCounter == 1)
    { echo '<div class="row half-gutter">';}
    
        echo '<div class="column col-half '. $catCounter.'">';
        echo '<h3> <a>term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a><span class="cat-count">(' . $category->count.')</span></h3>';
    
         $post_args = array(
          'numberposts' => 5,
          'category' => $category->term_id
        );
    
        $posts = get_posts($post_args);
    	echo '<ul class="category-posts">';
    	foreach($posts as $post) {
    	?>
    
    <li><a>"><?php the_title(); ?></a></li>
    	<?php
    	}
    	echo '';
    	echo '</div>';
    }
    ?>
    </div>
    </div>
    
    </section>
    <!-- #content -->
    
    <?php get_sidebar(); ?>
    <!-- #sidebar -->
    </aside>
    
    </div>
    <!-- #primary -->
    <?php get_footer(); ?>

    so basically it displays each category and sub category and post within it each with its own symbol. i want the top level category to show, and then after the jump, the second lvl, and then after that jump the final lvl…. basically i need to do, Los Angeles as parent… then the cities within los angeles Venice, Santa monica, etc… then within that, Sunday-Saturday…

The topic ‘categories and sub categories’ is closed to new replies.