• Hi guys,

    I recently edited my child theme so that post excerpts show up on the front page. Everything looks good, however is it possible to have post excerpts show up on tag pages, archives, category pages, and author pages as well?

    My website it futbolpulse.com.

    Thanks!

Viewing 15 replies - 1 through 15 (of 18 total)
  • Hi Daniel,

    you can put content.php in your child folder. Then find this code (it should be on line 54):

    the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) );

    and replace it with:

    the_excerpt();

    I hope this helps!

    Hi, not so sure if i can add on to this thread. let me know if I shd start a new thread instead.

    I’ve done the above and my website now shows the excerpt. except that it is […] instead of [continue reading].

    How do I enable it to be a link [continue reading]?

    thanks

    Hi Trisha,

    you can add this to your child function.php:

    function my_continue_reading_link() {
    	return ' <a href="'. esc_url( get_permalink() ) . '">' . __( '[Continue reading <span class="meta-nav">]</span>', 'my' ) . '</a>';
    }
    function my_auto_excerpt_more( $more ) {
    	return ' ...' . my_continue_reading_link();
    }
    add_filter( 'excerpt_more', 'my_auto_excerpt_more' );

    Oops sry kaniamea, Can i go back to your previous solution of replacing the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) );

    with
    the_excerpt();

    I just noticed that when I do this, although I see […], I realise that both the post title and the […] are no more links. I am unable to click on them. Do you know what went wrong here?

    thanks again!

    Hi Trisha,
    when I try to replace

    the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) );

    with

    the_excerpt();

    I can see that the post title is linked correctly. Only […] is not linked but once you add the function I posted above in your child functions.php, you will be able to see the [Continue reading] link instead.

    hahhaha you are right! my bad, no idea why I didnt get that earlier on. I re did everything and it’s fine now.

    thank you again!

    Can I ask another question, hope you don’t mind.

    How do I style my Continue Reading link?

    Do i style it in my child functions.php or style.css? and which part should I be changing? I need to know where I should start from.

    thank you very much

    Ok great!

    You can style your [Continue reading] link in your child style.css:

    .entry-content a, .entry-summary a, .page-content a, .comment-content a {
        //  YOUR CODE HERE
    }

    once again, thank you kaniamea!!!
    it works perfectly.

    Great! ??

    Oops so sry for not noticing before.

    When I styled the Continue reading link, I ended up editing the rest of the link format on my website.

    Is there any way I can just amend the continue reading link alone? without affecting the rest of the links on my website

    thanksss

    To rephrase what I said above,

    By “rest of the links on my website”, I meant the links on the center content bar and not those on the left and right side bars.

    Could you please post your URL, Trisha?

    UPDATE:

    By the way, I found a better solution of how to have post excerpts show up on tag pages, archives, category, etc.

    Open child content.php and find <?php if ( is_search() ) : ?> it should be around line 47. Replace with:

    <?php if ( is_search() || is_home() || is_category() || is_archive() || is_tag()) : ?>

    Then add this to your child functions.php file:

    function new_excerpt_more($more) {
    global $post;
    return ' <a class="moretag" href="'. get_permalink($post->ID) . '">[Continue reading]</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    Then add this to your child style.css:

    .moretag {
        ADD YOUR STYLES !important; // this will style the [Continue reading] link the way you wish
    }

    Reference: https://johngirdwood.com/blog/2013/12/14/how-to-display-excerpt-on-blog-page-wordpress-twenty-fourteen-theme/

    Thread Starter danielwp

    (@danielwp)

    Thanks so much for the help! Really appreciate it!!!

    Thread Starter danielwp

    (@danielwp)

    Wait, one last (very minor) thing. Prior to doing the post excerpts, whenever I hovered over each featured image on the home page, light diagonal bars appeared over it (it still does this to the images in the grid on top). However, once I started doing the post excerpts, the featured images that I hover over on the home page just seem to get lighter. I liked the other effect better, is there any way to restore it?

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Post Excerpts’ is closed to new replies.