Skip to main content
Indentation
Source Link
Maruti Mohanty
  • 2.4k
  • 1
  • 19
  • 21

You can use the wp_trim_excerpt() to get the excerpt of the content.

You can use it inside your loop to get the excerpt of each post

the string provided to a maximum of 55 words if it is more then a [...] will be added to the end of the string.

<?php
    $recent_posts = wp_get_recent_posts(array('post_type'=>'jokes'));
    foreach( $recent_posts as $recent ){
        echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
        $excerpt = wp_trim_excerpt( $recent['post_content']); // $excerpt contains the excerpt of the concerned post
        echo $excerpt;
    }
?>

echo $excerpt; } ?>

You can use the wp_trim_excerpt() to get the excerpt of the content.

You can use it inside your loop to get the excerpt of each post

the string provided to a maximum of 55 words if it is more then a [...] will be added to the end of the string.

<?php
    $recent_posts = wp_get_recent_posts(array('post_type'=>'jokes'));
    foreach( $recent_posts as $recent ){
        echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
        $excerpt = wp_trim_excerpt( $recent['post_content']); // $excerpt contains the excerpt of the concerned post

echo $excerpt; } ?>

You can use the wp_trim_excerpt() to get the excerpt of the content.

You can use it inside your loop to get the excerpt of each post

the string provided to a maximum of 55 words if it is more then a [...] will be added to the end of the string.

<?php
    $recent_posts = wp_get_recent_posts(array('post_type'=>'jokes'));
    foreach( $recent_posts as $recent ){
        echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
        $excerpt = wp_trim_excerpt( $recent['post_content']); // $excerpt contains the excerpt of the concerned post
        echo $excerpt;
    }
?>

You can use the wp_trim_excerpt() to get the excerpt of the content.

You can use it inside your loop to get the excerpt of each post

the string provided to a maximum of 55 words if it is more then a [...] will be added to the end of the string.

<?php
    $recent_posts = wp_get_recent_posts(array('post_type'=>'jokes'));
    foreach( $recent_posts as $recent ){
        echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
        $excerpt = wp_trim_excerpt( $recent['post_content']); // $excerpt contains the excerpt of the concerned post
    }
?>

echo $excerpt; } ?>

You can use the wp_trim_excerpt() to get the excerpt of the content.

You can use it inside your loop to get the excerpt of each post

the string provided to a maximum of 55 words if it is more then a [...] will be added to the end of the string.

<?php
    $recent_posts = wp_get_recent_posts(array('post_type'=>'jokes'));
    foreach( $recent_posts as $recent ){
        echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
        $excerpt = wp_trim_excerpt( $recent['post_content']); // $excerpt contains the excerpt of the concerned post
    }
?>

You can use the wp_trim_excerpt() to get the excerpt of the content.

You can use it inside your loop to get the excerpt of each post

the string provided to a maximum of 55 words if it is more then a [...] will be added to the end of the string.

<?php
    $recent_posts = wp_get_recent_posts(array('post_type'=>'jokes'));
    foreach( $recent_posts as $recent ){
        echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
        $excerpt = wp_trim_excerpt( $recent['post_content']); // $excerpt contains the excerpt of the concerned post

echo $excerpt; } ?>

Source Link
Maruti Mohanty
  • 2.4k
  • 1
  • 19
  • 21

You can use the wp_trim_excerpt() to get the excerpt of the content.

You can use it inside your loop to get the excerpt of each post

the string provided to a maximum of 55 words if it is more then a [...] will be added to the end of the string.

<?php
    $recent_posts = wp_get_recent_posts(array('post_type'=>'jokes'));
    foreach( $recent_posts as $recent ){
        echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
        $excerpt = wp_trim_excerpt( $recent['post_content']); // $excerpt contains the excerpt of the concerned post
    }
?>