First post full length, the rest excerpts
-
Hi there!
Do you know how I could modify the loop.php page to make the homepage show the latest blog in full and the rest as excerpts?
Thank you so much!
Liz
-
To make only the first post on homepage show the full content you can first create a child theme (http://themify.me/docs/child-themes) and copy
includes/loop.phpfile to<child-theme>/includes/loop.phpand open it up, now find:<?php if ( is_single() ) : ?>And replace it with:
<?php global $themify_post_shown; if ( is_single() || ( is_home() && false == $themify_post_shown ) ) : $themify_post_shown = true; ?>Hope this helps 😉
Totally worked for me. Thank you 🙂
What I’d love to do is change the size/style of the featured image for the excerpt style posts — any tips on doing that? For the first post and for single posts, I have the featured image set to be large (100%) and then for the excerpts, I’d like to have them displayed smaller (like medium sized).
The theme uses the “Medium” image size (configurable in Settings > Media from the admin menu) for the index pages. Can you please provide your website’s URL address? This would help better understand what you mean.
I’d send you the site, but it’s not live yet — I have an under construction mask up.
I’ve pasted the code from loop.php which might help.
The style I’m trying to emulate in terms of output is picklesnhoney.com.
Thanks!
Liz
<?php /** * Template for generic post display. * @package themify * @since 1.0.0 */ // Enable more link if ( ! is_single() ) { global $more; $more = 0; } ?> <?php themify_post_before(); // hook ?> <article id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?>> <?php themify_post_start(); // hook ?> <?php themify_before_post_image(); // Hook ?> <?php if ( has_post_thumbnail() ) : ?> <?php endif; // has post thumbnail ?> <?php themify_after_post_image(); // Hook ?> <div class="post-content"> <time datetime="<?php the_time('o-m-d') ?>" class="post-date"><?php the_time(apply_filters('themify_loop_date', 'M j, Y')) ?></time> <?php themify_before_post_title(); // Hook ?> <h1 class="post-title"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> </h1> <?php themify_after_post_title(); // Hook ?> <?php if ( ! is_attachment() ) : ?> <p class="post-meta"> <span class="post-author"><?php the_author_posts_link(); ?></span> <?php the_terms( get_the_ID(), 'category', ' <span class="post-category">', ', ', '</span>' ); ?> <?php the_tags( ' <span class="post-tag">', ', ', '</span>' ); ?> <?php if ( comments_open() ) : ?> <span class="post-comment"> <?php comments_popup_link( __( '0 Comments', 'themify' ), __( '1 Comment', 'themify' ), __( '% Comments', 'themify' ) ); ?> </span> <?php endif; //post comment ?> </p> <figure class="post-image"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> <?php the_post_thumbnail( 'large' ); ?> </a> </figure> <!-- /.post-meta --> <?php endif; ?> <?php global $themify_post_shown; if ( is_single() || ( is_home() && false == $themify_post_shown ) ) : $themify_post_shown = true; ?> <?php the_content(); ?> <?php else : ?> <?php the_excerpt(); ?> <?php endif; // single or archive ?> <?php edit_post_link(__('Edit', 'themify'), '<span class="edit-button">[', ']</span>'); ?> </div> <!-- /.post-content --> <?php themify_post_end(); // hook ?> </article> <!-- /.post --> <?php themify_post_after(); // hook ?>[Moderator Note: No bumping, thank you.]
Sorry for the late response.
To achieve the same grid style first add this bit to your child theme’s style.css file:#loops-wrapper > .post { width: 48%; float: left; margin-left: 2%; } #loops-wrapper > .post:nth-child(2n+2) { margin-left: 0; clear: left; } #loops-wrapper > .post:first-child { float: none; width: auto; margin-left: 0; }The images resize automatically to fit inside the available space.
This worked!!! 🙂 You’re the best. Thank you so much, shazdah!
The topic ‘First post full length, the rest excerpts’ is closed to new replies.
