Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Infinity Pro.
- *
- * This file adds the team page template to the Infinity Pro Theme.
- *
- * Template Name: Waiting Families
- *
- * @package Infinity
- * @author StudioPress
- * @license GPL-2.0+
- * @link http://my.studiopress.com/themes/infinity/
- */
- add_action( 'genesis_entry_content', 'ids_custom_content' );
- /**
- * Add custom WordPress query loops below Page content.
- *
- */
- function ids_custom_content() { ?>
- <ul class="waiting-container">
- <?php
- // WP_Query arguments.
- $args = array (
- 'post_type' => array( 'waiting_family' ),
- 'post_status' => array( 'publish' ),
- 'category_name' => 'waiting',
- 'nopaging' => true,
- );
- // The Query.
- $query = new WP_Query( $args );
- // The Loop.
- $order = 0;
- if ( $query->have_posts() ) {
- while ( $query->have_posts() ) {
- $query->the_post();
- // Gets the uploaded featured image
- $featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
- // Checks and returns the featured image
- $bg = (!empty( $featured_img ) ? "background-image: url('". $featured_img[0] ."');" : '');
- ?>
- <li class="waiting" style="order: <?php echo $order++; ?>;">
- <div class="waiting-inner">
- <div class="waiting-image-standoff">
- <div class="waiting-image" style="<?php echo $bg ; ?>">
- </div>
- </div>
- <div class="waiting-content">
- <h3><?php the_title(); ?></h3>
- <div class="waiting-body">
- <?php /* the_content(); */ echo excerpt( '24' ); ?>
- </div>
- <button id="waiting-hidden-<?php echo $order+1; ?>">Read More</button>
- </div>
- </div>
- </li>
- <?php $hidding_class = (($order + 1) % 2 == 0) ? 'odd' : 'even'; ?>
- <li class="waiting-hidden <?php echo $hidding_class ; ?>" id="waiting-hidden-<?php echo $order + 1;?>" style="order: <?php echo $order + 1; ?>;">
- <ul>
- <li class="pictures">
- <div class="gallery">
- <?php
- $gallery = (get_field('gallery') ? get_field('gallery') : null);
- if($gallery) :
- foreach($gallery as $img){ ?>
- <a href="<?php echo $img['url']; ?>" title="<?php echo $img['caption'] ; ?>" rel="waiting-hidden-<?php echo $order + 1;?>">
- <img src="<?php echo $img['sizes']['thumbnail'] ;?>">
- </a>
- <?php
- }
- else :
- echo 'no gallery';
- endif
- ?>
- </div>
- <a href='/contact-us/'><button>Inquire About This Family</button></a>
- <?php $friend = 'mailto:?subject=Adoptive Family&body=Take a look at this adoptive family. ' . get_permalink() ; ?>
- <a href="<?php echo $friend ; ?>"><button>Send To A Friend</button></a>
- </li>
- <li class="info">
- <section>
- <h1><?php the_title() ; ?></h1>
- <?php the_content(); ?>
- </section>
- </li>
- </ul>
- </li>
- <?php
- if ($order % 2 == 0) { $order = $order + 2; }
- }
- } else {
- // no posts found
- }
- ?>
- </ul>
- <article>
- <p><a href="/waiting-families-print" target="_blank">Print waiting families</a></p>
- <h2 class="divider"><span>Congratulations</span></h2>
- </article>
- <?php
- // Restore original Post Data.
- wp_reset_postdata();
- ?>
- <ul class="waiting-container">
- <?php
- // WP_Query arguments.
- $args = array (
- 'post_type' => array( 'waiting_family' ),
- 'post_status' => array( 'publish' ),
- 'category_name' => 'completed',
- );
- // The Query.
- $query = new WP_Query( $args );
- // The Loop.
- $order = 0;
- if ( $query->have_posts() ) {
- while ( $query->have_posts() ) {
- $query->the_post();
- // Gets the uploaded featured image.
- $featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
- // Checks and returns the featured image
- $bg = (!empty( $featured_img ) ? "background-image: url('". $featured_img[0] ."');" : '');
- ?>
- <li class="waiting" style="order: <?php echo $order++; ?>;">
- <div class="waiting-inner">
- <div class="waiting-image-standoff">
- <div class="waiting-image" style="<?php echo $bg ; ?>">
- </div>
- </div>
- <div class="waiting-content">
- <h3><?php the_title(); ?></h3>
- <?php the_excerpt() ; ?>
- </div>
- </div>
- </li>
- <?php $hidding_class = (($order + 1) % 2 == 0) ? 'odd' : 'even'; ?>
- <li class="waiting-hidden <?php echo $hidding_class ; ?>" id="waiting-hidden-c<?php echo $order + 1;?>" style="order: <?php echo $order + 1; ?>;">
- <ul>
- <li class="pictures">
- <div class="gallery">
- <?php
- $gallery = (get_field('gallery') ? get_field('gallery') : null);
- if($gallery) :
- foreach($gallery as $img){ ?>
- <a href="<?php echo $img['url']; ?>" title="<?php echo $img['caption'] ; ?>">
- <img src="<?php echo $img['sizes']['thumbnail'] ;?>">
- </a>
- <?php
- }
- else :
- echo 'nope';
- endif
- ?>
- </div>
- <a href='/contact-us/'><button>Inquire About This Family</button></a>
- <?php $friend = 'mailto:?subject=Adoptive Family&body=Take a look at this adoptive family. ' . get_permalink() ; ?>
- <a href="<?php echo $friend ; ?>"><button>Send To A Friend</button></a>
- </li>
- <li class="info">
- <section>
- <h1><?php the_title() ; ?></h1>
- <?php the_content(); ?>
- </section>
- </li>
- </ul>
- </li>
- <?php
- if ($order % 2 == 0) { $order = $order + 2; }
- }
- } else {
- // no posts found
- }
- ?>
- </ul>
- <?php
- // Restore original Post Data.
- wp_reset_postdata();
- }
- // Load JS.
- wp_enqueue_script( 'panel-toggle', get_stylesheet_directory_uri() . '/js/panel-toggle.js', array( 'jquery' ), CHILD_THEME_VERSION, true );
- // Run the Genesis loop.
- genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement