Title: custom strlen function help please?
Last modified: August 19, 2016

---

# custom strlen function help please?

 *  [Haitham](https://wordpress.org/support/users/halkibsi/)
 * (@halkibsi)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/custom-strlen-function-help-please/)
 * 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)

 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/custom-strlen-function-help-please/#post-1240613)
 * > I always get “Array” as output, not sure why.
 * See: [http://codex.wordpress.org/Function_Reference/get_post_custom](http://codex.wordpress.org/Function_Reference/get_post_custom)
 *  Thread Starter [Haitham](https://wordpress.org/support/users/halkibsi/)
 * (@halkibsi)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/custom-strlen-function-help-please/#post-1240627)
 * iridiax, I have reviewed your link, thank you. But I am clueless on what to do.
   I am not a programmer and PHP is a mystery to me, specially when it gets this
   complicated.
 * Can you fix the function for me? I know I won’t be able to.
 * I got the above code from the following link:
    [How to limit character on title](http://wordpress.org/support/topic/222715?replies=11)
   I even asked for help there, but no one responded 🙁

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘custom strlen function help please?’ is closed to new replies.

## Tags

 * [character-limit](https://wordpress.org/support/topic-tag/character-limit/)
 * [strlen](https://wordpress.org/support/topic-tag/strlen/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Haitham](https://wordpress.org/support/users/halkibsi/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/custom-strlen-function-help-please/#post-1240627)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
