Skip to content

Instantly share code, notes, and snippets.

@mkrdip
Created November 24, 2014 20:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkrdip/40f5ee41a08a0d7aff05 to your computer and use it in GitHub Desktop.
Save mkrdip/40f5ee41a08a0d7aff05 to your computer and use it in GitHub Desktop.
Tweak Single Projects of Divi Theme to show post navigation in Divi Page Builder Posts
<?php
get_header();
$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 ) : ?>
<div class="et_main_title">
<h1><?php the_title(); ?></h1>
<span class="et_project_categories"><?php echo get_the_term_list( get_the_ID(), 'project_category', '', ', ' ); ?></span>
</div>
<?php
$thumb = '';
$width = (int) apply_filters( 'et_pb_portfolio_single_image_width', 1080 );
$height = (int) apply_filters( 'et_pb_portfolio_single_image_height', 9999 );
$classtext = 'et_featured_image';
$titletext = get_the_title();
$thumbnail = get_thumbnail( $width, $height, $classtext, $titletext, $titletext, false, 'Projectimage' );
$thumb = $thumbnail["thumb"];
$page_layout = get_post_meta( get_the_ID(), '_et_pb_page_layout', true );
if ( '' !== $thumb )
print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height );
?>
<?php endif; ?>
<div class="entry-content">
<?php
the_content();
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 ) : ?>
<?php if ( 'et_full_width_page' !== $page_layout ) et_pb_portfolio_meta_box(); ?>
<?php endif; ?>
<div class="nav-single clearfix">
<span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'Divi' ) . '</span> %title' ); ?></span>
<span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'Divi' ) . '</span>' ); ?></span>
</div><!-- .nav-single -->
</article> <!-- .et_pb_post -->
<?php
if ( ! $is_page_builder_used && comments_open() && 'on' == et_get_option( 'divi_show_postcomments', 'on' ) )
comments_template( '', true );
?>
<?php endwhile; ?>
<?php if ( ! $is_page_builder_used ) : ?>
</div> <!-- #left-area -->
<?php if ( 'et_full_width_page' === $page_layout ) et_pb_portfolio_meta_box(); ?>
<?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