Skip to content

Instantly share code, notes, and snippets.

Created November 16, 2017 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/dcac7828f506a802a3e9398b7ad76c95 to your computer and use it in GitHub Desktop.
Save anonymous/dcac7828f506a802a3e9398b7ad76c95 to your computer and use it in GitHub Desktop.
<?php
/**
* Template part for displaying posts.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package expedition
*/
?>
<?php
global $current_page_tax_term;
global $expedition_customizer_all_values;
$postID = get_the_ID();
$count_key = 'wpb_post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 1;
update_post_meta($postID, $count_key, $count);
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-meta">
<?php expedition_posted_on(); ?>
<?php expedition_entry_footer(); ?>
</div><!-- .entry-meta -->
<?php endif; ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php
$expedition_archive_layout = $expedition_customizer_all_values['expedition-archive-layout'];
$expedition_archive_image_align = $expedition_customizer_all_values['expedition-archive-image-align'];
if( 'excerpt-only' == $expedition_archive_layout ){
the_excerpt();
}
elseif( 'full-post' == $expedition_archive_layout ){
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'expedition' ), array( 'span' => array( 'class' => array() ) ) ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
) );
}
elseif( 'thumbnail-and-full-post' == $expedition_archive_layout ){
if( 'left' == $expedition_archive_image_align ){
echo "<div class='image-left'>";
the_post_thumbnail('medium');
}
elseif( 'right' == $expedition_archive_image_align ){
echo "<div class='image-right'>";
the_post_thumbnail('medium');
}
else{
echo "<div class='image-full'>";
the_post_thumbnail('full');
}
echo "</div>";/*div end*/
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'expedition' ), array( 'span' => array( 'class' => array() ) ) ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
) );
}
else{
if( 'left' == $expedition_archive_image_align ){
echo "<div class='image-left'>";
the_post_thumbnail('medium');
}
elseif( 'right' == $expedition_archive_image_align ){
echo "<div class='image-right'>";
the_post_thumbnail('medium');
}
else{
echo "<div class='image-full'>";
the_post_thumbnail('full');
}
echo "</div>";/*div end*/
the_excerpt();
echo '<a class="btn" href="'.esc_url(get_permalink()).'">'.esc_html__("Read More", "expedition").' &raquo;</a>';
}
?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'expedition' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment