123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <?php
- function get_page_box($attrs){
- global $count2 ;
- $box_title = "Collettivi/Progetti";
- if( !empty($attrs['title']) )
- $box_title = $attrs['title'];
- $Posts = 12;
- if( !empty($attrs['num']) )
- $Posts = $attrs['num'];
-
- $page_ids=Array();
- if( !empty($attrs['ids']) )
- $page_ids=explode(",",$attrs['ids']);
-
- $home_layout = '';
- if( !empty($attrs['layout']) )
- $home_layout = $attrs['layout'];
-
- $offset = '';
- if( !empty($attrs['offset']) )
- $home_layout = $attrs['offset'];
-
- $args=Array(
- 'post_type'=> 'page',
- 'post__in' => $page_ids,
- 'posts_per_page' => $Posts,
- 'offset'=> $offset,
- 'orderby' => 'rand'
- );
-
- if ( !empty( $attrs['paged'] ) && $attrs['paged'] == 'y' )
- $args[ 'paged' ] = get_query_var('paged');
- else $args[ 'no_found_rows' ] = 1 ;
-
- $cat_query = new WP_Query($args);
- $count = 0;
- ?>
- <?php if( $home_layout == '2c'): //************** 2C ****************************************************** ?>
- <?php $count2++; ?>
- <section class="cat-box column2 <?php if($count2 == 2) { echo 'last-column'; $count2=0; } ?>">
- <div class="cat-box-title">
- <h2><?php echo $box_title ; ?></h2>
- <div class="stripe-line"></div>
- </div>
- <!-- post-thumbnail /-->
- <div class="cat-box-content">
-
- <?php if($cat_query->have_posts()): ?>
- <ul>
- <?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
- <?php if($count == 1) : ?>
- <li <?php tie_post_class('first-news'); ?>>
- <div class="inner-content">
- <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
- <div class="post-thumbnail">
- <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
- <?php tie_thumb( 'tie-medium' ); ?>
- <span class="overlay-icon"></span>
- </a>
- </div><!-- post-thumbnail /-->
- <?php endif; ?>
-
- <h2 class="post-box-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
-
- <div class="entry">
- <?php tie_excerpt_home() ?>
- <a class="more-link" href="<?php the_permalink() ?>"><?php _e( 'Read More »', 'tie' ) ?></a>
- </div>
- </div>
- </li><!-- .first-news -->
- <?php else: ?>
- <li <?php tie_post_class(); ?>>
- <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
- <div class="post-thumbnail">
- <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php tie_thumb(); ?><span class="overlay-icon"></span></a>
- </div><!-- post-thumbnail /-->
- <?php endif; ?>
- <h3 class="post-box-title">
- <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
- </h3>
- <div class="entry">
- <?php tie_excerpt_home() ?>
- </div>
- </li>
- <?php endif; ?>
- <?php endwhile;?>
- </ul>
- <div class="clear"></div>
- <?php endif; ?>
- </div><!-- .cat-box-content /-->
- </section> <!-- Two Columns -->
-
-
- <?php elseif( $home_layout == '1c' ): //************** 1C ****************************************************** ?>
- <section class="cat-box wide-box">
- <div class="cat-box-title">
- <h2><?php echo $box_title ; ?></h2>
- <div class="stripe-line"></div>
- </div><!-- post-thumbnail /-->
- <div class="cat-box-content">
-
- <?php if($cat_query->have_posts()): ?>
- <ul>
- <?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
- <?php if($count == 1) : ?>
- <li <?php tie_post_class( 'first-news' ); ?>>
- <div class="inner-content">
- <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
- <div class="post-thumbnail">
- <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
- <?php tie_thumb( 'tie-large' ); ?>
- <span class="overlay-icon"></span>
- </a>
- </div><!-- post-thumbnail /-->
- <?php endif; ?>
-
- <h2 class="post-box-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
- <div class="entry">
- <?php tie_excerpt_home() ?>
- <a class="more-link" href="<?php the_permalink() ?>"><?php _e( 'Read More »', 'tie' ) ?></a>
- </div>
- </div>
- </li><!-- .first-news -->
- <?php else: ?>
- <li <?php tie_post_class(); ?>>
- <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
- <div class="post-thumbnail">
- <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php tie_thumb(); ?><span class="overlay-icon"></span></a>
- </div><!-- post-thumbnail /-->
- <?php endif; ?>
- <h3 class="post-box-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
- <div class="entry">
- <?php tie_excerpt_home() ?>
- </div>
- </li>
- <?php endif; ?>
- <?php endwhile;?>
- </ul>
- <div class="clear"></div>
- <?php endif; ?>
- </div><!-- .cat-box-content /-->
- </section><!-- Wide Box -->
- <?php else : //************** list ********************************************************************************** ?>
-
- <section class="cat-box list-box">
- <div class="cat-box-title">
- <h2><?php echo $box_title ; ?></h2>
- <div class="stripe-line"></div>
- </div><!-- post-thumbnail /-->
- <div class="cat-box-content">
-
- <?php if($cat_query->have_posts()): ?>
- <ul>
- <?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
- <?php if($count == 1) : ?>
- <li <?php tie_post_class( 'first-news' ); ?>>
- <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
- <div class="post-thumbnail">
- <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
- <?php tie_thumb( 'tie-medium' ); ?>
- <span class="overlay-icon"></span>
- </a>
- </div><!-- post-thumbnail /-->
- <?php endif; ?>
-
- <h2 class="post-box-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
-
- <div class="entry">
- <?php tie_excerpt_home() ?>
- <a class="more-link" href="<?php the_permalink() ?>"><?php _e( 'Read More »', 'tie' ) ?></a>
- </div>
- </li><!-- .first-news -->
- <?php else: ?>
- <li <?php tie_post_class( 'other-news' ); ?>>
- <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
- <div class="post-thumbnail">
- <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php tie_thumb(); ?><span class="overlay-icon"></span></a>
- </div><!-- post-thumbnail /-->
- <?php endif; ?>
- <h3 class="post-box-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
- <div class="entry">
- <?php tie_excerpt_home() ?>
- </div>
- </li>
- <?php endif; ?>
- <?php endwhile;?>
- </ul>
- <div class="clear"></div>
- <?php endif; ?>
- </div><!-- .cat-box-content /-->
- </section><!-- List Box -->
- <?php endif; ?>
- <?php if ( !empty($attrs['paged'] )){
- if( $attrs['paged'] == 'y' && empty($offset) && $cat_query->max_num_pages > 1){?>
- <div class="recent-box-pagination"><?php tie_pagenavi($cat_query , $Posts); ?> </div>
- <?php } else if(is_array(parse_url($attrs['paged']))){ ?>
- <div class="recent-box-pagination">
- <div class="pagination">
- <a class="current pages" href="<?echo $attrs['paged']?>">Mostra tutti»</a>
- </div>
- </div>
- <? }
- }?>
- <div class="clear"></div>
- <?php } ?>
|