Forum Replies Created

Viewing 1 replies (of 1 total)
  • lazyandroid

    (@lazyandroid)

    The first answer from whooami actually helped me, because that was just what I was searching, to limit the characters not words. Except it did not work. After looking at bechster code and investigating a bit I came up with this:

    <?php echo substr(get_the_excerpt(),0,XY); ?>

    All that instead of <?php the_excerpt() ?> and for XY type the number of chars desired. Hope it’s helpfull to some other PHP noob like me.

    Of course my code looks a bit different:

    <?php
    	$content = get_the_content('',FALSE,'');
    	$content = apply_filters('the_content', $content);
    	$content = str_replace(']]>', ']]>', $content);
    	echo substr($content,0,262);
    ?>&hellip;

    At the end of the last paragraph a none-linking … is inserted with the code &hellip;. I have no idea why this works. Logic tells me it should appear outside the <p> tag. But it’s inside and it works (and validates), so it’s fine with me. I still would like to hear a logic answer if someone can offer one.

Viewing 1 replies (of 1 total)