Show an excerpt from a meta box?

Support General Show an excerpt from a meta box?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1570
    cbournakcbournak
    Participant

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

    #1572
    Tan NguyenTan 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 TranAnh 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 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Show an excerpt from a meta box?’ is closed to new replies.