Advertisement
alchymyth

Untitled

Apr 11th, 2011
485
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. $args=array(
  2.   'orderby' => 'name',
  3.   //'parent' => '5',
  4.   'order' => 'ASC',
  5.   'hide_empty' => '0'
  6.   );
  7. $categories=get_categories($args);
  8.   foreach($categories as $category) {
  9.     echo '
  10.    <div class="' . $category->slug . '">
  11.         <h3>' . $category->name . '</h3>
  12.         <img src="' . get_bloginfo( 'template_url' ) . '/images/categories/' . $category->slug . '_feature.jpg" alt="' . $category->name .'" />
  13.         <p>' . $category->description .'</p>
  14.         <h4>Explore</h4>
  15.         <ul>';
  16.  
  17.         global $post;
  18.         $args = array( 'numberposts' => 3, 'category' => $category->term_id );
  19. $myposts = get_posts( $args );
  20. foreach( $myposts as $post ) :  setup_postdata($post);
  21.     echo  '<li><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></li>';
  22. endforeach;
  23.     echo  '
  24.         <li><a href="' . get_category_link( $category->term_id ) . '">More...</a></li>
  25.         </ul>
  26.         <br />
  27.         </div>
  28.    ';
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement