Skip to content

Instantly share code, notes, and snippets.

@jimboobrien
Created May 19, 2016 01:12
Show Gist options
  • Save jimboobrien/3a5af9241f9a38fc27261141bc1ae294 to your computer and use it in GitHub Desktop.
Save jimboobrien/3a5af9241f9a38fc27261141bc1ae294 to your computer and use it in GitHub Desktop.
<?php
/*
Template Name: Sub-pages Template
*/
get_header();
global $more;
$is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() ); ?>
<div id="main-content">
<?php if ( ! $is_page_builder_used ) : ?>
<div class="container">
<div id="content-area" class="clearfix">
<div id="left-area">
<?php endif; ?>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( ! $is_page_builder_used ) : ?>
<h1 class="main_title"><?php the_title(); ?></h1>
<?php
$thumb = '';
$width = (int) apply_filters( 'et_pb_index_blog_image_width', 1080 );
$height = (int) apply_filters( 'et_pb_index_blog_image_height', 675 );
$classtext = 'et_featured_image';
$titletext = get_the_title();
$thumbnail = get_thumbnail( $width, $height, $classtext, $titletext, $titletext, false, 'Blogimage' );
$thumb = $thumbnail["thumb"];
if ( 'on' === et_get_option( 'divi_page_thumbnails', 'false' ) && '' !== $thumb )
print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height );
?>
<?php endif; ?>
<?php /* ECHO THE CONTENT */
the_content();
?>
<div class="entry-content special-sub-pages-list">
<div class="et_pb_section">
<div class="et_pb_row">
<div class="et_pb_column ">
<?php
$children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
</div>
</div>
</div>
<?php
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ?>
<? /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ?>
<?php
if ( ! $is_page_builder_used )
wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'Divi' ), 'after' => '</div>' ) );
?>
</div> <!-- .entry-content -->
<?php
if ( ! $is_page_builder_used && comments_open() && 'on' === et_get_option( 'divi_show_pagescomments', 'false' ) ) comments_template( '', true );
?>
</article> <!-- .et_pb_post -->
<?php endwhile; ?>
<?php if ( ! $is_page_builder_used ) : ?>
</div> <!-- #left-area -->
<?php get_sidebar(); ?>
</div> <!-- #content-area -->
</div> <!-- .container -->
<?php endif; ?>
</div> <!-- #main-content -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment