• Resolved wp_alba

    (@wp_alba)


    Hey,

    I’ve got some custom meta boxes created in my post/page admin panel. I was wondering if there is a filter that allows me to enable shortcodes to work inside the new meta boxes?

    I know the following gets it to work in widgets;

    add_filter('widget_text', 'do_shortcode');

    but cant seem to find a solution for custom meta boxes.

Viewing 2 replies - 1 through 2 (of 2 total)
  • This is what I used to call a shortcode from custom fields. This might help get you headed in the right direction.

    I used this to pull a short code out of my post custom meta boxes and make it happen. It is a if than because I wanted it to default to the original setup (insert picture) if there was no video to add.

    <?php if( get_post_meta($post->ID, "video", true) ): ?>
    <?php $values = get_post_custom_values('video');
    $shortcode_output = do_shortcode($values[0]);/
    print $shortcode_output; ?>
    <?php else: ?>
    <a href="<?php the_permalink() ?>" class="open"><?php woo_get_image('image','438', '295','alignleft slider-image',90,get_the_id(),'img'); ?></a>
    <?php endif; ?>
    Thread Starter wp_alba

    (@wp_alba)

    Thanks,

    This did the trick.
    <?php echo apply_filters('the_content', get_post_meta($post->ID, 'meta_box_name', true)); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcodes in Custom Meta Boxes’ is closed to new replies.