Guest User

BOOK/ACF Queries

a guest
Jul 21st, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.85 KB | None | 0 0
  1. <!-- ~~~~~~~~~~~ START BOOK ~~~~~~~~~~~~~~~~ -->
  2. <?php while(have_posts()): the_post() ?>
  3.  
  4.     <div id="ContentWrapper">
  5.         <div id="BookWrapper">
  6.  
  7.             <?php
  8.             if ( has_post_thumbnail() ) {
  9.                     global $post;
  10.                     $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, '' );
  11.                     echo'<div class="bookHeader coverPhoto ratio" style="background-image:url('.$src[0].') !important">';
  12.             }
  13.             else { echo'<div class="bookHeader">';}
  14.             ?>
  15.  
  16.                 <h1><?php the_title()?></h1>
  17.                 <div class="modDate">Last Updated: <?php the_modified_date()?></div>
  18.             </div>
  19.  
  20.             <div class="bookContent">                        
  21.                 <?php the_content()?>
  22.             </div>                
  23.  
  24.             <!-- ~~~~~~~~~~~ START CHAPTER ~~~~~~~~~~~~~~~~ -->
  25.                 <?php
  26.  
  27.                 $chapter_query = new WP_Query(
  28.                      array(            
  29.                             'post_type' => 'page',
  30.                             'post_parent' => $post->ID,            
  31.                             'orderby' => 'menu_order',
  32.                             'order' => 'ASC',
  33.                      ) );
  34.                 ?>
  35.  
  36.                 <?php if ($chapter_query->have_posts() ) : ?>
  37.  
  38.                     <?php while($chapter_query->have_posts()): $chapter_query->the_post() ?>
  39.  
  40.                         <div class="chaptersWrapper">
  41.  
  42.                             <div class="chapter">
  43.  
  44.                                 <div class="chapterHeader">
  45.                                     <h1><?php the_title()?></h1>
  46.                                     <div class="modDate">Last Updated: <?php the_modified_date()?></div>
  47.                                 </div>
  48.  
  49.                                 <div class="chapterContent">
  50.                                     <?php the_content()?>
  51.                                    
  52.                                     <!-- ~~~~~~~~~~~ START SUB-CHAPTER ~~~~~~~~~~~~~~~~ -->
  53.                                         <?php
  54.  
  55.                                         $subChapter_query = new WP_Query(
  56.                                              array(            
  57.                                                     'post_type' => 'page',
  58.                                                     'post_parent' => $post->ID,            
  59.                                                     'orderby' => 'menu_order',
  60.                                                     'order' => 'ASC',
  61.                                              ) );
  62.                                         ?>
  63.  
  64.                                         <?php if ($subChapter_query->have_posts() ) : ?>
  65.  
  66.                                             <?php while($subChapter_query->have_posts()): $subChapter_query->the_post() ?>
  67.                                    
  68.                                                     <?php the_content?>
  69.                                                     <!-- ~THIS IS WHERE WE WOULD PUT THE INCLUDES FOR THE CUSTOM FIELDS IF WE KNEW HOW TO DETECT WHICH FORM WAS BEING USED~ -->
  70.                                                    
  71.                                             <?php endwhile?>
  72.  
  73.                                         <?php endif;wp_reset_query()?>
  74.  
  75.                                     <!-- ~~~~~~~~~~~ END SUB-CHAPTER ~~~~~~~~~~~~~~~~ -->                                    
  76.                                 </div>
  77.                             </div>
  78.                         </div>
  79.  
  80.                     <?php endwhile;?>
  81.  
  82.                 <?php endif; wp_reset_query() ?>
  83.             <!-- ~~~~~~~~~~~ END CHAPTER ~~~~~~~~~~~~~~~~ -->
  84.  
  85.         </div>
  86.     </div>
  87.  
  88. <?php endwhile;?>
  89. <!-- ~~~~~~~~~~~ END BOOK ~~~~~~~~~~~~~~~~ -->
Advertisement
Add Comment
Please, Sign In to add comment