View difference between Paste ID: AeH6vx9b and MpQ7vfn6
SHOW: | | - or go back to the newest paste.
1
<?php
2-
function product_template() { // Здесь можно использовать любые template tags
2+
function product_template() { 
3
?>
4
	<li class="category-content-wrap">
5
		<center> 
6
			<div class="category-content">
7
				<a href="<?php the_permalink();?>" rel="bookmark" title="<?php the_title_attribute(); ?>" style="text-decoration:none;">
8
9
					<div class="category-content-image">
10
						<?php the_post_thumbnail( "category-content-thumb" ) ;?>
11
					</div>
12
					<div class="category-content-name">
13
						<h3>
14
							<?php the_title ()?>
15
						</h3>
16
					</div>							
17
						
18
				</a>	
19
				<span class="additional">
20
					<?php comments_popup_link( __( '0 comments'), __( '1 Comment'), __( '% Comments') ); ?>					
21
				<?php edit_post_link( __( 'Edit'), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
22
				</span>
23
			</div>
24
		</center>
25
	</li>
26
27
<?php
28
}
29
$ctax = 'category';
30
$ptype = 'post'; 
31
$posts_per_page = 4;
32
 
33
$categories = get_categories( array ( 'taxonomy' => $ctax ) );
34
foreach ( $categories as $par_cat )
35
{
36
    if ( $par_cat->parent < 1 ) 
37
    {       
38
        $par_catname = $par_cat->name;
39
        $par_catid = $par_cat->term_id;
40
        echo "<h2>$par_catname</h2>"; 
41
        query_posts( array( 'post_type' => $ptype, $ctax => $par_catname, 'posts_per_page' => $posts_per_page, 'order'=>'DESC', 'category__in'=>$par_catid ) );
42
        if ( have_posts() ) : while ( have_posts() ) : the_post();
43
            product_template();
44
        endwhile; endif; wp_reset_query();
45
    }
46
47
}
48
?>