Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $args=array(
- 'orderby' => 'name',
- //'parent' => '5',
- 'order' => 'ASC',
- 'hide_empty' => '0'
- );
- $categories=get_categories($args);
- foreach($categories as $category) {
- echo '
- <div class="' . $category->slug . '">
- <h3>' . $category->name . '</h3>
- <img src="' . get_bloginfo( 'template_url' ) . '/images/categories/' . $category->slug . '_feature.jpg" alt="' . $category->name .'" />
- <p>' . $category->description .'</p>
- <h4>Explore</h4>
- <ul>';
- global $post;
- $args = array( 'numberposts' => 3, 'category' => $category->term_id );
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post);
- echo '<li><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></li>';
- endforeach;
- echo '
- <li><a href="' . get_category_link( $category->term_id ) . '">More...</a></li>
- </ul>
- <br />
- </div>
- ';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement