page_box.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. function get_page_box($attrs){ ?>
  3. <?php
  4. global $count2 ;
  5. $box_title = "Collettivi/Progetti";
  6. if( !empty($attrs['box_title']) )
  7. $box_title = $attrs['box_title'];
  8. $Posts = 12;
  9. if( !empty($attrs['num']) )
  10. $Posts = $attrs['num'];
  11. //$page_ids_arr=Array('80','71','16');
  12. $page_ids=Array();
  13. if( !empty($attrs['ids']) )
  14. $page_ids=explode(",",$attrs['ids']);
  15. $home_layout = '';
  16. if( !empty($attrs['layout']) )
  17. $home_layout = $attrs['layout'];
  18. $args=Array(
  19. 'post_type'=> 'page',
  20. 'post__in' => $page_ids,
  21. 'no_found_rows' => 1,
  22. 'posts_per_page' =>$Posts,
  23. 'offset'=> '',
  24. 'orderby' => 'rand'
  25. );
  26. $cat_query = new WP_Query($args);
  27. $count = 0;
  28. ?>
  29. <?php if( $home_layout == '2c'): //************** 2C ****************************************************** ?>
  30. <?php $count2++; ?>
  31. <section class="cat-box column2 <?php if($count2 == 2) { echo 'last-column'; $count2=0; } ?>">
  32. <div class="cat-box-title">
  33. <h2><?php echo $box_title ; ?></h2>
  34. <div class="stripe-line"></div>
  35. </div><!-- post-thumbnail /-->
  36. <div class="cat-box-content">
  37. <?php if($cat_query->have_posts()): ?>
  38. <ul>
  39. <?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
  40. <?php if($count == 1) : ?>
  41. <li <?php tie_post_class('first-news'); ?>>
  42. <div class="inner-content">
  43. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
  44. <div class="post-thumbnail">
  45. <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
  46. <?php tie_thumb( 'tie-medium' ); ?>
  47. <span class="overlay-icon"></span>
  48. </a>
  49. </div><!-- post-thumbnail /-->
  50. <?php endif; ?>
  51. <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>
  52. <div class="entry">
  53. <?php tie_excerpt_home() ?>
  54. <a class="more-link" href="<?php the_permalink() ?>"><?php _e( 'Read More &raquo;', 'tie' ) ?></a>
  55. </div>
  56. </div>
  57. </li><!-- .first-news -->
  58. <?php else: ?>
  59. <li <?php tie_post_class(); ?>>
  60. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
  61. <div class="post-thumbnail">
  62. <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>
  63. </div><!-- post-thumbnail /-->
  64. <?php endif; ?>
  65. <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>
  66. <div class="entry">
  67. <?php tie_excerpt_home() ?>
  68. </div>
  69. </li>
  70. <?php endif; ?>
  71. <?php endwhile;?>
  72. </ul>
  73. <?php endif; ?>
  74. </div><!-- .cat-box-content /-->
  75. </section> <!-- Two Columns -->
  76. <?php elseif( $home_layout == '1c' ): //************** 1C ****************************************************** ?>
  77. <section class="cat-box wide-box">
  78. <div class="cat-box-title">
  79. <h2><?php echo $box_title ; ?></h2>
  80. <div class="stripe-line"></div>
  81. </div><!-- post-thumbnail /-->
  82. <div class="cat-box-content">
  83. <?php if($cat_query->have_posts()): ?>
  84. <ul>
  85. <?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
  86. <?php if($count == 1) : ?>
  87. <li <?php tie_post_class( 'first-news' ); ?>>
  88. <div class="inner-content">
  89. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
  90. <div class="post-thumbnail">
  91. <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
  92. <?php tie_thumb( 'tie-large' ); ?>
  93. <span class="overlay-icon"></span>
  94. </a>
  95. </div><!-- post-thumbnail /-->
  96. <?php endif; ?>
  97. <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>
  98. <div class="entry">
  99. <?php tie_excerpt_home() ?>
  100. <a class="more-link" href="<?php the_permalink() ?>"><?php _e( 'Read More &raquo;', 'tie' ) ?></a>
  101. </div>
  102. </div>
  103. </li><!-- .first-news -->
  104. <?php else: ?>
  105. <li <?php tie_post_class(); ?>>
  106. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
  107. <div class="post-thumbnail">
  108. <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>
  109. </div><!-- post-thumbnail /-->
  110. <?php endif; ?>
  111. <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>
  112. <div class="entry">
  113. <?php tie_excerpt_home() ?>
  114. </div>
  115. </li>
  116. <?php endif; ?>
  117. <?php endwhile;?>
  118. </ul>
  119. <div class="clear"></div>
  120. <?php endif; ?>
  121. </div><!-- .cat-box-content /-->
  122. </section><!-- Wide Box -->
  123. <?php else : //************** list ********************************************************************************** ?>
  124. <section class="cat-box list-box">
  125. <div class="cat-box-title">
  126. <h2><?php echo $box_title ; ?></h2>
  127. <div class="stripe-line"></div>
  128. </div><!-- post-thumbnail /-->
  129. <div class="cat-box-content">
  130. <?php if($cat_query->have_posts()): ?>
  131. <ul>
  132. <?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
  133. <?php if($count == 1) : ?>
  134. <li <?php tie_post_class( 'first-news' ); ?>>
  135. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
  136. <div class="post-thumbnail">
  137. <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
  138. <?php tie_thumb( 'tie-medium' ); ?>
  139. <span class="overlay-icon"></span>
  140. </a>
  141. </div><!-- post-thumbnail /-->
  142. <?php endif; ?>
  143. <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>
  144. <div class="entry">
  145. <?php tie_excerpt_home() ?>
  146. <a class="more-link" href="<?php the_permalink() ?>"><?php _e( 'Read More &raquo;', 'tie' ) ?></a>
  147. </div>
  148. </li><!-- .first-news -->
  149. <?php else: ?>
  150. <li <?php tie_post_class( 'other-news' ); ?>>
  151. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
  152. <div class="post-thumbnail">
  153. <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>
  154. </div><!-- post-thumbnail /-->
  155. <?php endif; ?>
  156. <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>
  157. <div class="entry">
  158. <?php tie_excerpt_home() ?>
  159. </div>
  160. </li>
  161. <?php endif; ?>
  162. <?php endwhile;?>
  163. </ul>
  164. <div class="clear"></div>
  165. <?php endif; ?>
  166. </div><!-- .cat-box-content /-->
  167. </section><!-- List Box -->
  168. <?php endif; ?>
  169. <?php } ?>