Skip to main content
added 62 characters in body
Source Link
terminator
  • 615
  • 1
  • 6
  • 30

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want.

add_filter('the_excerpt','my_excerpt');
function my_excerpt(){
    global $post;                         
    $excerpt=get_the_excerpt();
    $content = get_the_content(); //gets the whole content
    $content =strip_tags($content) ; //strips html tags                  
    $content = explode(" ", $content); //stores each word in an array
    $size = count($content);        //counts the length of array                                
    $last="";                       //initialize an empty sting
    $i=4;                           //no of words from the last you want
    while($i>0){
        $last.= $content[$size-$i];   
        $last.=" ";
        $i--;  
    }  
    return $excerpt."......".$last;
}

Now use the_excerpt(); to output the kind excerpt you want. All the best and let me know if it worked or not.

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want.

add_filter('the_excerpt','my_excerpt');
function my_excerpt(){
    global $post;                         
    $excerpt=get_the_excerpt();
    $content = get_the_content(); //gets the whole content                 
    $content = explode(" ", $content); //stores each word in an array
    $size = count($content);        //counts the length of array                                
    $last="";                       //initialize an empty sting
    $i=4;                           //no of words from the last you want
    while($i>0){
        $last.= $content[$size-$i];   
        $last.=" ";
        $i--;  
    }  
    return $excerpt."......".$last;
}

Now use the_excerpt(); to output the kind excerpt you want. All the best and let me know if it worked or not.

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want.

add_filter('the_excerpt','my_excerpt');
function my_excerpt(){
    global $post;                         
    $excerpt=get_the_excerpt();
    $content = get_the_content(); //gets the whole content
    $content =strip_tags($content) ; //strips html tags                  
    $content = explode(" ", $content); //stores each word in an array
    $size = count($content);        //counts the length of array                                
    $last="";                       //initialize an empty sting
    $i=4;                           //no of words from the last you want
    while($i>0){
        $last.= $content[$size-$i];   
        $last.=" ";
        $i--;  
    }  
    return $excerpt."......".$last;
}

Now use the_excerpt(); to output the kind excerpt you want. All the best and let me know if it worked or not.

added 79 characters in body
Source Link
terminator
  • 615
  • 1
  • 6
  • 30

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want.

add_filter('the_excerpt','my_excerpt');
function my_excerpt(){
    global $post;                         
    $excerpt=get_the_excerpt();
    $content = get_the_content(); //gets the whole content                 
    $content = explode(" ", $content); //stores each word in an array
    $size = count($content);        //counts the length of array                                
    $last="";                       //initialize an empty sting
    $i=4;                           //no of words from the last you want
    while($i>0){
        $last.= $content[$size-$i];   
        $last.=" ";
        $i--;  
    }  
    return $excerpt."......".$last;
}

Now use the_excerpt(); to output the kind excerpt you want. All the best and let me know if it worked or not.

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want.

add_filter('the_excerpt','my_excerpt');
function my_excerpt(){
    global $post;                         
    $excerpt=get_the_excerpt();
    $content = get_the_content(); //gets the whole content                 
    $content = explode(" ", $content); //stores each word in an array
    $size = count($content);        //counts the length of array                                
    $last="";                       //initialize an empty sting
    $i=4;                           //no of words from the last you want
    while($i>0){
        $last.= $content[$size-$i];   
        $last.=" ";
        $i--;  
    }  
    return $excerpt."......".$last;
}

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want.

add_filter('the_excerpt','my_excerpt');
function my_excerpt(){
    global $post;                         
    $excerpt=get_the_excerpt();
    $content = get_the_content(); //gets the whole content                 
    $content = explode(" ", $content); //stores each word in an array
    $size = count($content);        //counts the length of array                                
    $last="";                       //initialize an empty sting
    $i=4;                           //no of words from the last you want
    while($i>0){
        $last.= $content[$size-$i];   
        $last.=" ";
        $i--;  
    }  
    return $excerpt."......".$last;
}

Now use the_excerpt(); to output the kind excerpt you want. All the best and let me know if it worked or not.

deleted 128 characters in body
Source Link
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want.

        add_filter('the_excerpt','my_excerpt');
        function my_excerpt(){
            global $post;                         
            $excerpt=get_the_excerpt();
            $content = get_the_content(); //gets the whole content                 
            $content = explode(" ", $content); //stores each word in an array
            $size = count($content);        //counts the length of array                                
            $last="";                       //initialize an empty sting
            $i=4;                           //no of words from the last you want
            while($i>0){
                $last.= $content[$size-$i];   
                $last.=" ";
                $i--;  
            }  
            return $excerpt."......".$last;
        }

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want.

        add_filter('the_excerpt','my_excerpt');
        function my_excerpt(){
            global $post;                         
            $excerpt=get_the_excerpt();
            $content = get_the_content(); //gets the whole content                 
            $content = explode(" ", $content); //stores each word in an array
            $size = count($content);        //counts the length of array                                
            $last="";                       //initialize an empty sting
            $i=4;                           //no of words from the last you want
            while($i>0){
                $last.= $content[$size-$i];   
                $last.=" ";
                $i--;  
            }  
            return $excerpt."......".$last;
        }

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want.

add_filter('the_excerpt','my_excerpt');
function my_excerpt(){
    global $post;                         
    $excerpt=get_the_excerpt();
    $content = get_the_content(); //gets the whole content                 
    $content = explode(" ", $content); //stores each word in an array
    $size = count($content);        //counts the length of array                                
    $last="";                       //initialize an empty sting
    $i=4;                           //no of words from the last you want
    while($i>0){
        $last.= $content[$size-$i];   
        $last.=" ";
        $i--;  
    }  
    return $excerpt."......".$last;
}
added 63 characters in body
Source Link
terminator
  • 615
  • 1
  • 6
  • 30
Loading
added 299 characters in body
Source Link
terminator
  • 615
  • 1
  • 6
  • 30
Loading
Source Link
terminator
  • 615
  • 1
  • 6
  • 30
Loading