symmetrical post snippets

Discussion in 'ButterBelly WordPress Theme' started by vesity, Aug 15, 2014.

Thread Status:
Not open for further replies.
  1. vesity

    vesity Member

    Joined:
    Oct 3, 2013
    Messages:
    241
    Likes Received:
    0
  2. Yogesh

    Yogesh Guest

    Joined:
    Aug 8, 2014
    Messages:
    2,052
    Likes Received:
    41
    Hello,

    Add these lines in functions.php file as shown in screenshot.
    Code:
    // for excerpt
    function custom_excerpt_length( $length ) {
            return 50;
        }
        add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
    This will solve your issue.

    Thanks & Regards
    Yogesh Bhade
     

    Attached Files:

  3. vesity

    vesity Member

    Joined:
    Oct 3, 2013
    Messages:
    241
    Likes Received:
    0
    Thanks for your reply; unfortunately, it does not completely fix the problem, although it helps. At "return 50" it showed no difference in my test posts, so I set it to "return 40." You can see that now the first two posts snippets are equal in size with 3 lines of text, but the 3 post has 4 lines of text. (http://www.tiffanynesbitt.com). I tried other return amounts as well, 15, 20, 30, etc., but the posts were still inconsistent.
     
  4. PankajK

    PankajK Support Staff

    Joined:
    Aug 8, 2014
    Messages:
    93
    Likes Received:
    5
    Hi vesity
    Unfortunately there is no way to limit the excerpt by line. But you can use some trick.

    1. The first thing you need to do is to add this code to your functions.php file
    PHP:
    function custom_excerpt_length$length ) {
            return 
    40;
        }
        
    add_filter'excerpt_length''custom_excerpt_length'999 );
    2. Now if you still find a post which has more lines, then edit your post and make you excerpt even shorter with "Insert Read More Tag Button".
     

    Attached Files:

  5. vesity

    vesity Member

    Joined:
    Oct 3, 2013
    Messages:
    241
    Likes Received:
    0
    Got it - excellent - thank you!
     
Thread Status:
Not open for further replies.

Share This Page