Created
February 13, 2020 10:09
-
-
Save nfsarmento/11c9aa173047cea19e9900a582e3a3a4 to your computer and use it in GitHub Desktop.
NS Minimal WordPress Theme - First post in full, others show excerpts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template used for displaying content | |
* | |
* @package ns-minimal | |
* @since ns-minimal 1.0.0 | |
*/ | |
?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<header class="entry-header"> | |
<?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?> | |
<?php if ( 'post' == get_post_type() ) : ?> | |
<div class="entry-meta"> | |
<?php | |
ns_minimal_posted_on(); | |
?> | |
<?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?> | |
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'ns-minimal' ), __( '1 Comment', 'ns-minimal' ), __( '% Comments', 'ns-minimal' ) ); ?></span> | |
<?php endif; ?> | |
</div><!-- .entry-meta --> | |
<?php endif; ?> | |
<?php if ( has_post_thumbnail() && ! post_password_required() && ! is_attachment() ) : ?> | |
<div class="entry-thumbnail"> | |
<a href="<?php echo esc_url( get_permalink() ); ?>"> | |
<?php the_post_thumbnail(); ?> | |
</a> | |
</div> | |
<?php endif; ?> | |
</header><!-- .entry-header --> | |
<?php if ( is_search() ) : // Only display Excerpts for Search ?> | |
<div class="entry-summary"> | |
<?php the_excerpt(); ?> | |
</div><!-- .entry-summary --> | |
<?php else : ?> | |
<div class="entry-content"> | |
<?php | |
if (is_single()) : | |
the_content(); | |
elseif ($wp_query->current_post == 0) : | |
/* translators: %s: Name of current post */ | |
the_content( __( 'Read more', 'ns-minimal' ) ); | |
else : | |
the_excerpt(); | |
endif; | |
?> | |
<?php | |
wp_link_pages( array( | |
'before' => '<div class="page-links">' . __( 'Pages:', 'ns-minimal' ), | |
'after' => '</div>', | |
) ); | |
?> | |
</div><!-- .entry-content --> | |
<?php endif; ?> | |
<footer class="entry-footer"> | |
<?php ns_minimal_entry_footer(); ?> | |
</footer><!-- .entry-footer --> | |
</article><!-- #post-## --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment