Support » Fixing WordPress » Get a "limited" Excerpt from Custom Field Text?

  • Resolved arthurdent2003

    (@arthurdent2003)


    Hi!

    I have a qustion about an excerpt from a custom field.

    How can I limit the number of words from a text out of a custom field?

    I would like to use this text as kind of excerpt.

    I know how to limit the number of words for the excerpt – but I don’t know how to make it work out a custom field – any Idea?

    THANK YOU! 🙂

    AD

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

    (@arthurdent2003)

    Got it working: Maybe you may need it: Thanks to the forum:

    <?php $trim_length = 450;  //desired length of text to display
    		$custom_field = 'Custom Field';
    		$value = get_post_meta($post->ID, $custom_field, true);
    		if ($value) {
    		  echo rtrim(substr($value,0,$trim_length));
    		}
    		?>

    thanks for reply

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get a "limited" Excerpt from Custom Field Text?’ is closed to new replies.