Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- get_header();
- $categoryPosts = get_posts( array(
- 'posts_per_page' => -1,
- 'category' => get_query_var( 'cat' ),
- ));
- $categoryPostsImages = array();
- $categories = get_categories( array(
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'parent' => 52,
- 'hide_empty' => 0
- ));
- if ( $categoryPosts ) {
- foreach ( $categoryPosts as $post ){
- $postImages = get_attached_media( 'image', $post->ID );
- if ( $postImages ) {
- $postImages = array_slice( $postImages, 0, 5 );
- $categoryPostsImages ? $categoryPostsImages = array_merge( $categoryPostsImages, $postImages ): $categoryPostsImages = $postImages;
- }
- }
- }
- ?>
- <div class="container">
- <?php echo category_description( get_query_var( 'cat' ) ); ?>
- </div>
- <div class="rowproduse">
- <div class="col-md-3">
- <?php if( $categories ): ?>
- <ul class="main-categ">
- <?php foreach ( $categories as $kCat => $vCat ): ?>
- <li id="main-item-class" class="main-item <?php echo get_category( $vSub->cat_ID ) == $vCat->slug ? 'active' : ''; ?>"><?php
- $subCategories = get_categories( array(
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'parent' => $vCat->cat_ID,
- 'hide_empty' => 0
- ));?>
- <a class="main-link" href="#<?php echo $vCat->slug; ?>" data-cat="<?php echo $vCat->slug; ?>"><?php echo $vCat->name; ?></a>
- <?php if( $subCategories ): ?>
- <ul class="subcateg">
- <?php foreach ( $subCategories as $kSub => $vSub ): ?>
- <li><a href="<?php echo esc_url( get_category_link( $vSub->cat_ID ) ); ?>"><i class="fa fa-angle-double-right"></i> <?php echo $vSub->name; ?></a></li>
- <?php endforeach; ?>
- </ul>
- <?php endif; ?>
- </li>
- <?php endforeach; ?>
- </ul>
- <?php endif; ?>
- </div>
- <div class="col-md-9">
- <?php if ( $categoryPosts ): ?>
- <div class="row">
- <?php $i = 1; while(have_posts()) : the_post();?>
- <div class="col-md-6 rand-produse">
- <div class="preview-panel">
- <div class="row">
- <div class="col-md-6 image"><a href="<?php if( $post->ID == 80 ) echo get_site_url() . "/comanda-online/?p=" . $post->post_title; else the_permalink(); ?>"><img src="<?php the_post_thumbnail_url( 'full' ); ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"></a></div>
- <div class="col-md-6">
- <h4><?php the_title(); ?></h4>
- <div class="text-produs-paragraf"><?php $excerpt= get_the_excerpt();echo substr($excerpt, 0, 170),'...'; ?></div>
- <a href="<?php if( $post->ID == 80 ) echo get_site_url() . "/comanda-online/?p=" . $post->post_title; else the_permalink(); ?>" class="btn btn-primary" role="button"><?php echo $post->ID == 80 ? 'Comandă Online':'Vezi Detalii'; ?> <span><i class="fa fa-angle-double-right"></i></span></a>
- </div>
- </div>
- </div>
- </div>
- <?php if ( $i % 2 === 0 ) { echo '</div><div class="row">'; } ?>
- <?php $i++; endwhile; wp_reset_query(); ?>
- </div>
- <?php endif; ?>
- </div>
- </div>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement