Advertisement
srikat

Untitled

Nov 21st, 2017
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.73 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Infinity Pro.
  5. *
  6. * This file adds the team page template to the Infinity Pro Theme.
  7. *
  8. * Template Name: Waiting Families
  9. *
  10. * @package Infinity
  11. * @author StudioPress
  12. * @license GPL-2.0+
  13. * @link http://my.studiopress.com/themes/infinity/
  14. */
  15.  
  16. add_action( 'genesis_entry_content', 'ids_custom_content' );
  17. /**
  18. * Add custom WordPress query loops below Page content.
  19. *
  20. */
  21. function ids_custom_content() { ?>
  22. <ul class="waiting-container">
  23.  
  24. <?php
  25. // WP_Query arguments.
  26. $args = array (
  27. 'post_type' => array( 'waiting_family' ),
  28. 'post_status' => array( 'publish' ),
  29. 'category_name' => 'waiting',
  30. 'nopaging' => true,
  31. );
  32.  
  33. // The Query.
  34. $query = new WP_Query( $args );
  35.  
  36. // The Loop.
  37. $order = 0;
  38.  
  39. if ( $query->have_posts() ) {
  40. while ( $query->have_posts() ) {
  41. $query->the_post();
  42.  
  43. // Gets the uploaded featured image
  44. $featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
  45. // Checks and returns the featured image
  46. $bg = (!empty( $featured_img ) ? "background-image: url('". $featured_img[0] ."');" : '');
  47. ?>
  48. <li class="waiting" style="order: <?php echo $order++; ?>;">
  49. <div class="waiting-inner">
  50. <div class="waiting-image-standoff">
  51. <div class="waiting-image" style="<?php echo $bg ; ?>">
  52. </div>
  53. </div>
  54. <div class="waiting-content">
  55. <h3><?php the_title(); ?></h3>
  56. <div class="waiting-body">
  57. <?php /* the_content(); */ echo excerpt( '24' ); ?>
  58. </div>
  59. <button id="waiting-hidden-<?php echo $order+1; ?>">Read More</button>
  60. </div>
  61. </div>
  62. </li>
  63. <?php $hidding_class = (($order + 1) % 2 == 0) ? 'odd' : 'even'; ?>
  64. <li class="waiting-hidden <?php echo $hidding_class ; ?>" id="waiting-hidden-<?php echo $order + 1;?>" style="order: <?php echo $order + 1; ?>;">
  65. <ul>
  66. <li class="pictures">
  67. <div class="gallery">
  68. <?php
  69. $gallery = (get_field('gallery') ? get_field('gallery') : null);
  70. if($gallery) :
  71. foreach($gallery as $img){ ?>
  72. <a href="<?php echo $img['url']; ?>" title="<?php echo $img['caption'] ; ?>" rel="waiting-hidden-<?php echo $order + 1;?>">
  73. <img src="<?php echo $img['sizes']['thumbnail'] ;?>">
  74. </a>
  75. <?php
  76. }
  77. else :
  78. echo 'no gallery';
  79. endif
  80. ?>
  81. </div>
  82. <a href='/contact-us/'><button>Inquire About This Family</button></a>
  83. <?php $friend = 'mailto:?subject=Adoptive Family&body=Take a look at this adoptive family. ' . get_permalink() ; ?>
  84. <a href="<?php echo $friend ; ?>"><button>Send To A Friend</button></a>
  85. </li>
  86. <li class="info">
  87. <section>
  88. <h1><?php the_title() ; ?></h1>
  89. <?php the_content(); ?>
  90. </section>
  91. </li>
  92. </ul>
  93. </li>
  94. <?php
  95. if ($order % 2 == 0) { $order = $order + 2; }
  96. }
  97. } else {
  98. // no posts found
  99. }
  100. ?>
  101.  
  102. </ul>
  103. <article>
  104. <p><a href="/waiting-families-print" target="_blank">Print waiting families</a></p>
  105. <h2 class="divider"><span>Congratulations</span></h2>
  106. </article>
  107.  
  108. <?php
  109. // Restore original Post Data.
  110. wp_reset_postdata();
  111. ?>
  112.  
  113. <ul class="waiting-container">
  114.  
  115. <?php
  116. // WP_Query arguments.
  117. $args = array (
  118. 'post_type' => array( 'waiting_family' ),
  119. 'post_status' => array( 'publish' ),
  120. 'category_name' => 'completed',
  121. );
  122.  
  123. // The Query.
  124. $query = new WP_Query( $args );
  125.  
  126. // The Loop.
  127. $order = 0;
  128. if ( $query->have_posts() ) {
  129. while ( $query->have_posts() ) {
  130. $query->the_post();
  131.  
  132. // Gets the uploaded featured image.
  133. $featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
  134. // Checks and returns the featured image
  135. $bg = (!empty( $featured_img ) ? "background-image: url('". $featured_img[0] ."');" : '');
  136. ?>
  137. <li class="waiting" style="order: <?php echo $order++; ?>;">
  138. <div class="waiting-inner">
  139. <div class="waiting-image-standoff">
  140. <div class="waiting-image" style="<?php echo $bg ; ?>">
  141. </div>
  142. </div>
  143. <div class="waiting-content">
  144. <h3><?php the_title(); ?></h3>
  145. <?php the_excerpt() ; ?>
  146.  
  147. </div>
  148. </div>
  149. </li>
  150. <?php $hidding_class = (($order + 1) % 2 == 0) ? 'odd' : 'even'; ?>
  151. <li class="waiting-hidden <?php echo $hidding_class ; ?>" id="waiting-hidden-c<?php echo $order + 1;?>" style="order: <?php echo $order + 1; ?>;">
  152. <ul>
  153. <li class="pictures">
  154. <div class="gallery">
  155. <?php
  156. $gallery = (get_field('gallery') ? get_field('gallery') : null);
  157. if($gallery) :
  158. foreach($gallery as $img){ ?>
  159. <a href="<?php echo $img['url']; ?>" title="<?php echo $img['caption'] ; ?>">
  160. <img src="<?php echo $img['sizes']['thumbnail'] ;?>">
  161. </a>
  162. <?php
  163. }
  164. else :
  165. echo 'nope';
  166. endif
  167. ?>
  168. </div>
  169. <a href='/contact-us/'><button>Inquire About This Family</button></a>
  170. <?php $friend = 'mailto:?subject=Adoptive Family&body=Take a look at this adoptive family. ' . get_permalink() ; ?>
  171. <a href="<?php echo $friend ; ?>"><button>Send To A Friend</button></a>
  172. </li>
  173. <li class="info">
  174. <section>
  175. <h1><?php the_title() ; ?></h1>
  176. <?php the_content(); ?>
  177. </section>
  178. </li>
  179. </ul>
  180. </li>
  181. <?php
  182. if ($order % 2 == 0) { $order = $order + 2; }
  183. }
  184. } else {
  185. // no posts found
  186. }
  187. ?>
  188.  
  189. </ul>
  190.  
  191. <?php
  192. // Restore original Post Data.
  193. wp_reset_postdata();
  194. }
  195.  
  196. // Load JS.
  197. wp_enqueue_script( 'panel-toggle', get_stylesheet_directory_uri() . '/js/panel-toggle.js', array( 'jquery' ), CHILD_THEME_VERSION, true );
  198.  
  199. // Run the Genesis loop.
  200. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement