I am while using following code to seize a string and return a spesific quantity of figures

<div class="top_posts">
elseif($i>1 && $i<=$number_of_posts) 
$retour.= "\n" . '<li>';
if($image_url) { $retour .= '<a href="' . get_permalink() . '"><img src="' . get_bloginfo('template_directory') . '/js/timthumb.php?src=' . $image_url . '&amp;h=120&amp;w=180&amp;zc=1" alt="" /></a>'; }
$retour .= '<h6><a href="' . get_permalink() . '">' . the_title("","",false) . '</a></h6>';
$retour.= get_wpe_excerpt('wpe_popular_posts');
$retour.= "\n" . '<li class="clear">&amp;</li>'; 
return $retour;
add_shortcode('popular-posts', 'popular_posts_code');

The chunk at problem is part

$retour.= get_wpe_excerpt('wpe_popular_posts')

which calls to

function wpe_popular_posts($length) {
    return 55;

However I am still obtaining the full text string untrimmed - any help appreciated.


The get_wpe_excerpt function appears like this

function get_wpe_excerpt($length_callback='', $more_callback='') {
        add_filter('excerpt_length', $length_callback);
        add_filter('excerpt_more', $more_callback);
    $output = get_the_excerpt();
    $output = apply_filters('wptexturize', $output);
    $output = apply_filters('convert_chars', $output);
    $output = '<p>'.$output.'</p>';
    return $output;

You need to return the very first 55 figures from the string?

Try substr($input, 0, 55);

However really do not understand what's happening with this call to $retour.= get_wpe_excerpt('wpe_popular_posts');... so perhaps I'm misunderstanding what you're attempting to achieve?

Now sure the way the get_wpe_excerpt() function is performed. You might want to try the easy code I made use of in a number of WordPress styles.

implode(' ', array_slice(explode(' ', get_the_content()), 0, 55));