Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm really a rookie to PHP, i'm using the customfield fields&meta boxes plugin for wordpress. Normaly when i register a customfield,

i display them by using:

<?php if ( get_post_meta($post->ID, '_wenc_soundcloud', true)) : ?>
blahblah
<?php endif; ?>

But when i register a customfield that has multi values, like for instance a multicheckbox, and i checked all boxes it won't display all values in de page, it only display one value.

This is the metabox that i register:

$meta_boxes[] = array(

        'id'         => 'Contactinvoervelden',
        'title'      => 'Sidebar',
        'pages'      => array( 'page'), // Post type
        'context'    => 'side',
        'priority'   => 'high',
        'show_names' => true, // Show field names on the left
        'fields'     => array(
            array(
                'name' => 'Contact kolom',
                'desc' => 'Selecteer',
                'id'   => $prefix . 'content_invoer_titel',
                'type' => 'title',
            ),
            array(
                'name'    => 'Socialmedia',
                'desc'    => 'Socialmedia iconen weergeven?',
                'id'      => $prefix . 'socialmediaiconen',
                'type'    => 'multicheck',
                'options' => array(
                    'facebook' => 'Facebook',
                    'twitter' => 'Twitter',
                    'soundcloud' => 'Soundcloud',
                ),
            ),
            ),
        );

I tried different things to display them like:

<?php if ( get_post_meta($post->ID, '_wenc_socialmediaiconen', true)=='facebook' ) : ?>
blahblah
<?php endif; ?>

<?php if ( get_post_meta($post->ID, '_wenc_socialmediaiconen', true)=='Twitter' ) : ?>
blahblah
<?php endif; ?>

<?php if ( get_post_meta($post->ID, '_wenc_socialmediaiconen', true)=='Soundcloud' ) : ?>
blahblah
<?php endif; ?>

But it will only display one of the three values that has been checked... I want to use one registered multicheck and display the checked value individually.

I would be really really great if someone helped me out on this!

share|improve this question
1  
What does that true value do in the get_post_meta calls? Research that and you might come a little closer to understanding part of your problem. –  t31os May 9 '13 at 11:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.