Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- get_header();
- $taxonomy_single = get_query_var( 'term' ) ;
- ?>
- <div id="omc-header-under">
- <span id="omc-header-overlay"></span>
- <?php
- $theme_options = get_option('option_tree');
- $header_image_upload = get_option_tree( 'header_image_upload', $theme_options, false );
- $header_image_select = get_option_tree( 'header_image_select', $theme_options, false );
- $blog_header = get_option_tree( 'blog_page_header', $theme_options, false );
- $products_upload = get_option_tree( 'products_upload', $theme_options, false );
- $skin = get_option_tree( 'skin', $theme_options, false );
- if ($products_upload !='') { ?>
- <img width="1020" src="<?php echo($products_upload);?>" alt="header image" class="omc-header-image fix-height" />
- <?php } elseif ($header_image_upload !='') { ?>
- <img width="1020" src="<?php echo($header_image_upload);?>" alt="header image" class="omc-header-image fix-height" />
- <?php } elseif ($header_image_select !='') { ?>
- <img src="<?php echo(get_template_directory_uri());?>/images/headers/<?php echo($header_image_select);?>.jpg" alt="header image" class="omc-header-image fix-height" />
- <?php } else {?>
- <img height="200" width="1020" src="<?php echo(get_template_directory_uri());?>/images/skins/<?php echo($skin);?>/default_header.jpg" alt="header image" class="omc-header-image" />
- <?php } ?>
- <div id="omc-ribbon">
- <h1><span class="omc-ribbon-left"></span><span class="omc-ribbon-middle"><?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?></span><span class="omc-ribbon-right"></span></h1>
- <div id="omc-breadcrumb">
- <?php if(function_exists('bcn_display')) { bcn_display();}?>
- </div><!-- /omc-breadcrumb -->
- </div>
- </div><!-- /omc-header-under -->
- <div class="omc-inner-page-content-wrapper right-sidebar">
- <?php if ( is_active_sidebar( 8 ) ) { ?>
- <div id="omc-sidebar" class="omc-right">
- <ul class="xoxo">
- <?php dynamic_sidebar( 'Products Sidebar' ); ?>
- </ul>
- </div>
- <?php } else { get_sidebar(); } ?>
- <div id="omc-main-left-column" class="omc-content">
- <span class="product-margin"></span>
- <?php
- wp_reset_query();
- //var_dump( $terms );
- $defaults = array(
- 'product_cats' => ''
- );
- $args = wp_parse_args( $query_string, $defaults );
- $current_cat = get_term_by('slug', $args['product_cats'], 'product_cats');
- // Gets every "category" (term) in the current taxonomy to get the respective posts
- $terms = get_terms( 'product_cats', 'child_of='.$current_cat->term_id );
- $count = count($terms);
- // if the term has no children then show its content
- if ( $count == 0 ):
- $posts = new WP_Query( "taxonomy=product_cats&term=$current_cat->slug" );
- ?>
- <div class"clear"></div>
- <br class="clear">
- <h2 style="border-bottom:1px solid #CCC;margin-top:0px;"><?php echo $current_cat->name; ?></h2>
- <?php
- $i = 0;
- $style = '';
- if( $posts->have_posts() ) :
- while( $posts->have_posts() ) : $posts->the_post();
- $i++;
- // fixes the margin of each 3rd product in the loop (instead of using jQuery)
- if (($i % 3) == 0) $style = ' style="margin-right: 0px;" '; else $style = '';
- $price = get_post_meta(get_the_ID(), 'inception_price', true);
- ?>
- <div class="omc-product-listing" <?php echo $style; ?>>
- <a href="<?php the_permalink();?>">
- <?php
- if(has_post_thumbnail()) {
- the_post_thumbnail('product', array('class' => 'omc-product-frame'));
- } else {
- ?>
- <img src="<?php echo get_template_directory_uri() ;?>/images/no-image.png" width="170" height="170" class="omc-product-frame" alt="no photo" />
- <?php } ?>
- </a>
- <span class="omc-listing-header"><a href="<?php the_permalink();?>"><?php the_title();?></a></span>
- <span class="omc-listing-price"><?php echo($price);?></span>
- <span class="omc-listing-more"><a href="<?php the_permalink();?>">»</a></span>
- </div><!-- /omc-product-listing -->
- <?php
- endwhile;
- else:
- echo 'no results';
- endif; wp_reset_query();
- // if the term has children then loop through them
- else:
- // fix the H3 issue
- $father_is_here = false;
- foreach( $terms as $term ) :
- // if this term has child term, then ignore it
- $child_terms = get_terms( 'product_cats', 'child_of='.$term->term_id );
- $count_children = count($child_terms);
- //var_dump( $term->name );
- if ( $count_children > 0 ):
- $father_is_here = true;
- ?>
- <div class"clear"></div>
- <br class="clear">
- <h2 style="border-bottom:1px solid #CCC;margin-top:0px;"><?php echo $term->name; ?></h2>
- <?php
- continue;
- endif;
- //query_posts($query_string . '&posts_per_page=9&paged=' . $paged);
- $posts = new WP_Query( "taxonomy=product_cats&term=$term->slug" );
- ?>
- <div class"clear"></div>
- <br class="clear">
- <?php if ( $father_is_here ):?>
- <h3><?php echo $term->name; ?></h3>
- <?php else :?>
- <h2 style="border-bottom:1px solid #CCC;margin-top:0px;"><?php echo $term->name; ?></h2>
- <?php endif;?>
- <?php
- $i = 0;
- $style = '';
- if( $posts->have_posts() ) :
- while( $posts->have_posts() ) : $posts->the_post();
- $i++;
- // fixes the margin of each 3rd product in the loop (instead of using jQuery)
- if (($i % 3) == 0) $style = ' style="margin-right: 0px;" '; else $style = '';
- ?>
- <div class="omc-product-listing" <?php echo $style; ?>>
- <a href="<?php the_permalink();?>">
- <?php
- if(has_post_thumbnail()) {
- the_post_thumbnail('product', array('class' => 'omc-product-frame'));
- } else {
- ?>
- <img src="<?php echo get_template_directory_uri() ;?>/images/no-image.png" width="170" height="170" class="omc-product-frame" alt="no photo" />
- <?php } ?>
- </a>
- <span class="omc-listing-header"><a href="<?php the_permalink();?>"><?php the_title();?></a></span>
- <span class="omc-listing-price"><?php echo($price);?></span>
- <span class="omc-listing-more"><a href="<?php the_permalink();?>">»</a></span>
- </div><!-- /omc-product-listing -->
- <?php
- endwhile;
- else:
- echo 'no results';
- endif; wp_reset_query();
- endforeach;
- endif; // End looping through children terms
- ?>
- <br class="clear" />
- <div class="product-pagination">
- <?php kriesi_pagination(); ?>
- </div>
- </div><!-- /omc-main-left-column -->
- <br class="clear" />
- </div><!-- /omc-inner-page-content -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement