• hello,
    I’m trying to retrieve a custom field value $summary and limit its characters to about 40, but I always get “Array” as output, not sure why. I have searched for days in the forum and through Google and I can’t get this to work.

    Here’s the code:

    <?php $recent = new WP_Query("cat=3&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>
    <?php $image = get_post_custom_values("imageThumb"); ?>
    <?php $imageURL = get_post_custom_values("imageBig"); ?>
    <?php $summary = get_post_custom_values("articleSummary"); ?>
    <div id="articleSnippet">
        <div id="articleImage"><a href="<?php the_permalink() ?>"><img src="<?php echo $imageURL[0]; ?>" width="156" height="78" /></a></div>
        <div id="articleSummary"><a href="<?php the_permalink() ?>"><strong><?php the_title() ?></strong>
        <br /><?php if (strlen(utf8_decode($summary)) > 40) { echo substr(get_post_custom($before = '', $after = '', FALSE), 0, 40) . '...'; } else { echo $summary[0]; } ?></a></div>
    </div>
    <?php endwhile; ?>

    Any help is greatly appreciated. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘custom strlen function help please?’ is closed to new replies.