Support » Theme: Twenty Fifteen » Won't show 'summary' only 'full post' on home page posts

  • Resolved llgchristy

    (@llgchristy)


    I’m not doing a static page but ‘recent posts’ is my home page. I do not want full posts on my home page. Even though in ‘settings: reading’ I have it set for show ‘summary’ it still shows full post. Any ideas?

Viewing 15 replies - 1 through 15 (of 16 total)
  • Twenty Fifteen shows full article.If you want to show post excerpts then you need to make few changes. You may read this article for changes in code . Post excerpt in Twenty fifteen

    Cheers Verma for the link I was looking to do this myself and it works. Also lots of other help on the site.

    Took a while to see what code I needed. Reading through I found that I needed to change “content.php” from this:

    <div class="entry-content">
    		<?php
    			/* translators: %s: Name of current post */
    			the_content( sprintf(
    				__( 'Continue reading %s', 'twentyfifteen' ),
    				the_title( '<span class="screen-reader-text">', '</span>', false )
    			) );
    
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
    				'separator'   => '<span class="screen-reader-text">, </span>',
    			) );
    		?>
    	</div><!-- .entry-content -->

    to this:

    <div class="entry-content">
    		<?php
    		if ( is_single() ) :
    			/* translators: %s: Name of current post */
    			the_content( sprintf(
    				__( 'Continue reading %s', 'twentyfifteen' ),
    				the_title( '<span class="screen-reader-text">', '</span>', false )
    			) );
    
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
    				'separator'   => '<span class="screen-reader-text">, </span>',
    			) );
    			else :
    
    			/* translators: %s: Name of current post */
    			the_excerpt( sprintf(
    				__( 'Continue reading %s', 'twentyfifteen' ),
    				the_title( '<span class="screen-reader-text">', '</span>', false )
    			) );
    
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
    				'separator'   => '<span class="screen-reader-text">, </span>',
    			) );
    			endif;
    		?>
    	</div><!-- .entry-content -->

    Thank you so much Just Ard – the code you posted worked great! I just created a new content.php file in my child theme and replaced it.

    I used it but the first image not showing up just text, how to make it appear?

    Do you have featured images?

    You need a featured image for it to show above the text.

    You will see on my site that I have featured images, but on the posts without there is just text. http://www.justard.com

    I am using the code you shared above and it works great…EXCEPT if I have created a manual excerpt, in which case the ‘continue reading’ link doesn’t show. Any idea how I can get it to work for posts with and without manual excerpts?

    Thank you for this.

    Thank a million Just Ard.

    Its working. 🙂

    This works so fast.. only replace one line in the index.php

    Replace this
    get_template_part( ‘content’, get_post_format() );

    With this
    get_template_part( ‘content-search’, get_post_format() );
    se the post here http://johngirdwood.com/2014/12/27/show-excerpt-snippets-on-blog-for-wordpress-twenty-fifteen-theme/

    I also prefer to have a short summary on my front page, and was using the code posted by Just Ard above, which worked beautifully. That changed with the latest update of Twenty Fifteen (1.3). After the update was installed, I tried to use the same code in my content.php, but it no longer works, for some reason. I’m wondering if the new version of content.php won’t allow this alteration.

    I’ve also tried the fix suggested by Terkeljc, but this also had no effect. Does anybody know how to tweak the code for Twenty Fifteen v. 1.3?

    That is realy odd. I just did it today. This is a School blog. Only for repetition, to improve learning. Just started it, so it is nothing. But it works. http://tjunglow.dk/ .. Btw.. The article that i posted before have One mistake.
    It has wierd ” around the (‘content_search’) you need to use what i wrote in the previous comment 🙂

    This is how it looks in my file.. i recommend outcommenting the old line. then you can allways change back

    // Start the loop.
    while ( have_posts() ) : the_post();
    
    /*
    * Include the Post-Format-specific template for the content.
    * If you want to override this in a child theme, then include a file
    * called content-___.php (where ___ is the Post Format name) and that will be used instead.
     */
    
    get_template_part( 'content', get_post_format() ); /*THIS LINES MAKES YOU SHOW WHOLE POST ON BLOG PAGE INSTEAD OF SUMMARY*/
    
    get_template_part( 'content-search', get_post_format() ); /*THIS LINES MAKES YOU SHOW A SUMMARY POST ON THE BLOG PAGE INSTEAD OF THE WHOLE POST */
    
    // End the loop.

    Hi Terkeljc, and everybody 🙂

    Your code is great, it works on my blog page. Thanks a lot.

    But I have a problem with this code. I don’t understand how it works. So I can’t answer my own question : how to make the same thing with category pages ? (Hope this is the good word in english, my WordPress is the french version, so I can’t be sure).
    Any idea?

    Thanks

    Oh… I’m not so stupid, I’ve answer my own question. This is exactly the same code but on another file. Here’s what I’ve done.
    1/ Save the archive.php on my computer
    2/ Put it on “UTF-8 without BOM” (don’t know if it’s the same name in english, using the pad put it on ANSI instead)
    3/ Find the code
    get_template_part( ‘content’, get_post_format() );
    4/ Replace it with
    get_template_part( ‘content-search’, get_post_format() ); /*THIS LINES MAKES YOU SHOW A SUMMARY POST ON THE CATEGORY PAGE INSTEAD OF THE WHOLE POST */
    5/ Save the file as category.php
    6/ Put it in my child theme directory
    7/ Enjoy 🙂

    So it’s okay, this solution can work for different things. WordPress created something very cool with template hierarchy (see here : https://developer.wordpress.org/themes/basics/template-hierarchy/ )

    Hey guys :

    PLEASE HELP…

    I am using a theme called ‘Sylph’ – however, I used

    Replace this
    get_template_part( ‘content’, get_post_format() );

    With this
    get_template_part( ‘content-search’, get_post_format() );

    which is fine, on the page only the summary text comes up – but I can’t add the image with it, i have put it in as featured image, but it only appears after clicking into the post!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Won't show 'summary' only 'full post' on home page posts’ is closed to new replies.