WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Fourteen
[closed] Post Excerpts (19 posts)

  1. danielwp
    Member
    Posted 7 months ago #

    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!

  2. kaniamea
    Member
    Posted 7 months ago #

    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!

  3. Trisha.Blogs
    Member
    Posted 7 months ago #

    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

  4. kaniamea
    Member
    Posted 7 months ago #

    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' );
  5. Trisha.Blogs
    Member
    Posted 7 months ago #

    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!

  6. kaniamea
    Member
    Posted 7 months ago #

    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.

  7. Trisha.Blogs
    Member
    Posted 7 months ago #

    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

  8. kaniamea
    Member
    Posted 7 months ago #

    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
    }
  9. Trisha.Blogs
    Member
    Posted 7 months ago #

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

  10. kaniamea
    Member
    Posted 7 months ago #

    Great! :)

  11. Trisha.Blogs
    Member
    Posted 7 months ago #

    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

  12. Trisha.Blogs
    Member
    Posted 7 months ago #

    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.

  13. kaniamea
    Member
    Posted 7 months ago #

    Could you please post your URL, Trisha?

  14. kaniamea
    Member
    Posted 7 months ago #

    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: http://johngirdwood.com/blog/2013/12/14/how-to-display-excerpt-on-blog-page-wordpress-twenty-fourteen-theme/

  15. danielwp
    Member
    Posted 7 months ago #

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

  16. danielwp
    Member
    Posted 7 months ago #

    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?

  17. Trisha.Blogs
    Member
    Posted 7 months ago #

    Thanks kaniamea, your latest codes worked great! :)

    @danielwp sorry can't help you here :/ because mine looks to be the same

  18. kaniamea
    Member
    Posted 7 months ago #

    @Trisha.Blogs, you are welcome!

    @danielwp, please start a new thread about the other issue.

  19. esmi
    Forum Moderator
    Posted 6 months ago #

    Do not edit the Twenty Fourteen theme. It is the current default WordPress theme and having access to an original, unedited, copy of the theme is vital in many situations. First create a child theme for your changes. Or install a custom CSS plugin.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic