Advertisement
sbstn_becker

Untitled

Jun 18th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.21 KB | None | 0 0
  1. <?php
  2. /**
  3.  * This template is used to display child page content
  4.  *
  5.  * @package Child of Baskerville 2
  6.  */
  7. ?>
  8. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  9.  
  10.     <?php
  11.     /**
  12.      * Post Title
  13.      */
  14.  
  15.     echo '<span class="child-title">';
  16.         the_title( $before_title, $after_title );
  17.     echo '</span>';
  18.  
  19.     /**
  20.      * Post Thumbnail
  21.      */
  22.     if ( baskerville_2_has_post_thumbnail() ) { ?>
  23.         <div class="featured-media">
  24.             <?php if ( ! is_single() ) { ?>
  25.                 <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
  26.             <?php }
  27.                 the_post_thumbnail( 'baskerville-2-post-image' );
  28.             if ( ! is_single() ) { ?>
  29.                 </a>
  30.             <?php } ?>
  31.         </div> <!-- /featured-media -->
  32.     <?php }
  33.  
  34.     /**
  35.      * Child Page Excerpts
  36.      */
  37.     $args = array(
  38.         'post_type' => 'page',
  39.         'post_parent' => get_the_ID()
  40.     );
  41.     // get child pages
  42.     $query = new WP_Query( $args );
  43.     if ( $query->have_posts() ) {
  44.         echo '<div class="posts-masonry">';
  45.         // loop through the query results
  46.         while ( $query->have_posts() ) {
  47.             $query->the_post();
  48.             echo '<div class="page-container">';
  49.  
  50.                 /**
  51.                  * Page Title
  52.                  */
  53.                 $before_title = '<header class="post-header"><h1 class="post-title entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';         
  54.                 $after_title = '</a></h1></header>';
  55.                 the_title( $before_title, $after_title );
  56.  
  57.             /**
  58.                  * Category Link
  59.                  */
  60.                  $cat = wp_get_post_categories()[0];
  61.                  echo '<div class="category {$cat->slug}">{$cat->name}</div>';
  62.  
  63.             /**  
  64.                  * Post Thumbnail
  65.                  */
  66.                 if ( baskerville_2_has_post_thumbnail() ) { ?>
  67.                     <div class="featured-media">
  68.                         <?php if ( ! is_single() ) { ?>
  69.                             <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
  70.                         <?php }
  71.                             the_post_thumbnail( 'baskerville-2-post-image' );
  72.                         if ( ! is_single() ) { ?>
  73.                             </a>
  74.                         <?php } ?>
  75.                     </div> <!-- /featured-media -->
  76.                 <?php }
  77.  
  78.                 /**
  79.                  * Page Excerpt
  80.                  */ ?>
  81.                     <div class="post-content clear">
  82.                         <?php
  83.                         echo get_more_excerpt();
  84.                         ?>
  85.                     </div><!--/.post-content-->
  86.  
  87.                 <div class="clear"></div>
  88.                 <?php
  89.  
  90.             echo '</div><!-- /.page-container -->';
  91.  
  92.         }
  93.         echo '</div><!-- .posts-masonry -->';
  94.     }
  95.     // Restore original post data.
  96.     wp_reset_postdata();
  97.     //remove_filter( 'the_content', 'get_more_excerpt', 0 );
  98.  
  99.     wp_link_pages();
  100.  
  101.     /**
  102.      * Post Meta
  103.      */
  104.     if ( is_single() ) { ?>
  105.  
  106.         <footer class="post-meta-container clear">
  107.             <?php baskerville_2_author_bio(); ?>
  108.  
  109.             <div class="post-meta clear">
  110.                 <?php baskerville_2_single_post_meta(); ?>
  111.                 <?php the_post_navigation(); ?>
  112.                 <?php edit_post_link(
  113.                     sprintf(
  114.                         /* translators: %1$s: Pencil icon, %2$s: Name of current post */
  115.                         esc_html__( '%1$s Edit %2$s', 'baskerville-2' ),
  116.                         '<i class="fa fa-pencil-square-o"></i>',
  117.                         the_title( '<span class="screen-reader-text">"', '"</span>', false )
  118.                     ),
  119.                     '<span class="edit-link">',
  120.                     '</span>'
  121.                 ); ?>
  122.             </div>
  123.         </footer> <!-- /post-meta-container -->
  124.         <?php comments_template( '', true );
  125.  
  126.     } else {
  127.         baskerville_2_post_meta();
  128.     } ?>
  129.  
  130. </article> <!-- /post-## -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement