Need Help About Excerpt

Discussion in 'Blogging' started by MafiaBlack, Jul 17, 2014.

  1. MafiaBlack

    MafiaBlack Regular Member

    Joined:
    Mar 23, 2011
    Messages:
    354
    Likes Received:
    56
    Guys i need help about these 2 things..

    [​IMG]

    1- How to replace [...] with words like [Read More] or [Continue Reading] Etc

    2- How to make the words long like 200-300 words before [...]
     

    Attached Files:

  2. allroy

    allroy Registered Member

    Joined:
    Aug 4, 2013
    Messages:
    67
    Likes Received:
    19
    1. Change [...] string

    By default, excerpt more string at the end is set to '[...]'. To change excerpt more string using excerpt_more filter, add the following code to functions.php file in your theme:

    Code:
    function new_excerpt_more( $more ) {
        return '[Read More]';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    
    2. Change Excerpt Length

    By default, excerpt length is set to 55 words. To change excerpt length to 200 words using excerpt_length filter, add the following code to functions.php file in your theme:

    Code:
    function custom_excerpt_length( $length ) {
        return 200;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
    
     
    • Thanks Thanks x 1
  3. MafiaBlack

    MafiaBlack Regular Member

    Joined:
    Mar 23, 2011
    Messages:
    354
    Likes Received:
    56
    Thanks bro it works.. Do you know how to make 'read more' clickable? I mean we can insert post's link.. SO when reader click on read more they will redirect to the full post
     
  4. MafiaBlack

    MafiaBlack Regular Member

    Joined:
    Mar 23, 2011
    Messages:
    354
    Likes Received:
    56
    BUMP.. Need Urgent Help
     
    Last edited: Jul 19, 2014
  5. allroy

    allroy Registered Member

    Joined:
    Aug 4, 2013
    Messages:
    67
    Likes Received:
    19
    Replace
    Code:
    function new_excerpt_more( $more ) {
        return '[Read More]';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    with

    Code:
    function new_excerpt_more( $more ) {
        return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">[Read More]</a>';
    }
    add_filter( 'excerpt_more', 'new_excerpt_more' );