Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function product_template() {
- ?>
- <li class="category-content-wrap">
- <center>
- <div class="category-content">
- <a href="<?php the_permalink();?>" rel="bookmark" title="<?php the_title_attribute(); ?>" style="text-decoration:none;">
- <div class="category-content-image">
- <?php the_post_thumbnail( "category-content-thumb" ) ;?>
- </div>
- <div class="category-content-name">
- <h3>
- <?php the_title ()?>
- </h3>
- </div>
- </a>
- <span class="additional">
- <?php comments_popup_link( __( '0 comments'), __( '1 Comment'), __( '% Comments') ); ?>
- <?php edit_post_link( __( 'Edit'), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
- </span>
- </div>
- </center>
- </li>
- <?php
- }
- $ctax = 'category';
- $ptype = 'post';
- $posts_per_page = 4;
- $categories = get_categories( array ( 'taxonomy' => $ctax ) );
- foreach ( $categories as $par_cat )
- {
- if ( $par_cat->parent < 1 )
- {
- $par_catname = $par_cat->name;
- $par_catid = $par_cat->term_id;
- echo "<h2>$par_catname</h2>";
- query_posts( array( 'post_type' => $ptype, $ctax => $par_catname, 'posts_per_page' => $posts_per_page, 'order'=>'DESC', 'category__in'=>$par_catid ) );
- if ( have_posts() ) : while ( have_posts() ) : the_post();
- product_template();
- endwhile; endif; wp_reset_query();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement