WordPress.org

Support

Support » Plugins and Hacks » Hacks » Using shortcodes to display post meta data within a page

Using shortcodes to display post meta data within a page

Viewing 1 replies (of 1 total)
  • gabrielcastillo

    @gabrielcastillo

    Try this out. I used this code to display image, and text from custom post meta box’s.

    function display_custom_meta($atts, $content = NULL){
     global $post;
     extract( shortcode_atts(array(
    
     'param' => '',
    
     ),$atts));
    
     $post_meta = get_post_meta($post->ID,'_meta_contet',TRUE);
    
     return '<div>'.$post_meta['post_meta_box_name'].'</div>';
    
    }
    add_shortcode('display_custom_meta','display_custom_meta');

    Change the meta name’s to what you need to , but this should work fine you have custom post meta on you page.

Viewing 1 replies (of 1 total)
  • The topic ‘Using shortcodes to display post meta data within a page’ is closed to new replies.
Skip to toolbar