WPIntell

Source evidence

Provide option to trim excerpt to specific number of words

CP Related Posts · support · 2015-05-31T19:51:00+00:00

mixedsentiment
highseverity
0.88relevance
4replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

4 / 32 rows with source links

12.5% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

28 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
littledynamo resolved
It would be great if we could trim the excerpt to a specific number of words. Would you consider adding this feature? Either as a setting or as a hook to allow other themes to set the number of words. Thanks! https://wordpress.org/plugins/cp-related-posts/ 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. 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. 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. Perfect, thanks so much!

Comments

4 shown
codepeople 2015-05-31T20:13:00+00:00

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.

littledynamo 2015-06-02T20:36:00+00:00

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.

codepeople 2015-06-24T18:45:00+00:00

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.

littledynamo 2015-06-24T21:12:00+00:00

Perfect, thanks so much!