211 lines
8.5 KiB
PHP
211 lines
8.5 KiB
PHP
<?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 } ?>
|