Viewing 1 replies (of 1 total)
  • This involves editing the plugin, but it is what I needed as well, so here is how-to:

    Edit the file: child-pages-shortcode.php

    Replace:

    if (isset($p['disabled_excerpt_filters']) && $p['disabled_excerpt_filters']) {
                $tpl = str_replace('%post_excerpt%', $post->post_excerpt, $tpl);
            } else {
                $tpl = str_replace('%post_excerpt%', get_the_excerpt(), $tpl);
            }

    With:

    if (isset($p['disabled_excerpt_filters']) && $p['disabled_excerpt_filters']) {
                $tpl = str_replace('%post_excerpt%', preg_replace('/((\w+\W*){24}(\w+))(.*)/', '${1}', $post->post_excerpt), $tpl);
            } else {
                $tpl = str_replace('%post_excerpt%', preg_replace('/((\w+\W*){24}(\w+))(.*)/', '${1}', get_the_excerpt()), $tpl);
            }

    Adjust the number 24 in the new code to how many words you desire -1. For instance the 24 will give 25 words.

Viewing 1 replies (of 1 total)
  • The topic ‘Limit length of excerpt’ is closed to new replies.