Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hi,

    The feature is available in the current version of the plugin, but unfortunately would be needed modify the plugin’s code. I promise to publish an update for controlling this parameter visually from the plugin’s settings.

    Please, follow the steps below:

    1. Open the “/wp-content/plugins/cp-related-posts/cp-related-posts.php” file with the text editor your choice.

    2. Go to the snippet of code:

    wp_trim_words( strip_shortcodes( $related_posts[ $i ]->post_content ) )

    and pass the number of words as the second parameter. By default the wp_trim_words method returns the first 55 words of the text that is passed as first parameter. For example, if you want to display in the excerpt only the first 30 words, modifies the previous code like follow:

    wp_trim_words( strip_shortcodes( $related_posts[ $i ]->post_content ), 30 )

    and that’s all.
    Best regards.

    Thread Starter littledynamo

    (@littledynamo)

    Thank you. I was hesitant to hack the module code since the changes would be wiped out in the next upgrade but if you intend to provide the functionality in the next version then that’s awesome.

    Plugin Author codepeople

    (@codepeople)

    Hi,

    I’m sorry for delay. Yes, in the next upgrade of the plugin, I’ll include the possibility to select the number of words to display in the articles’ summaries, from the plugin’s settings.

    Best regards.

    Thread Starter littledynamo

    (@littledynamo)

    Perfect, thanks so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Provide option to trim excerpt to specific number of words’ is closed to new replies.