Custom Fields
Re-Envisioned
Support General Show an excerpt from a meta box?

This topic contains 2 replies, has 3 voices, and was last updated by  Anh Tran 3 years, 9 months ago.

  • Creator
    Topic
  • #1570

    cbournak
    Participant

    Is there a way to show an excerpt from a meta box?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #1572

    Tan Nguyen
    Participant

    Did you means limit words retrieved from a field? If so, you can follow this guide:

    http://stackoverflow.com/questions/965235/how-can-i-truncate-a-string-to-the-first-20-words-in-php

    #1573

    Anh Tran
    Keymaster

    If you just want to show, then you can use the custom_html field. This field can show any content in your meta box. You just need to pass $post->post_excerpt to its std attribute, like this:

    global $post;
    
    // Define meta box
    ...
    'fields' => array(
        array(
            'type' => 'custom_html',
            'std'  => $post->post_excerpt,
        ),
    )
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Show an excerpt from a meta box?’ is closed to new replies.