wpmetabox / meta-box

The best plugin for WordPress custom fields and custom meta boxes
https://metabox.io
1.19k stars 422 forks source link

Help oembed list div class #805

Closed luizaraujoofficial closed 8 years ago

luizaraujoofficial commented 8 years ago

Hello need personal help.

I have metabox already registered, must list the oEmbed that has enabled the clone ie they are several.

I have the way down he put me list inside a div ul li and I want to edit this order for can include my way div class taking the ul li

<?php
$url = rwmb_meta( 'trades_mb_media_videos_link', 'type=oembed' );
        echo $url;
?>

tranks

funkatron82 commented 8 years ago

if it's a clone field, then rwmb_meta would probably return an array. You would need to use a for loop to print the multiple oEmbeds

luizaraujoofficial commented 8 years ago

hello can give me a simple example with oEmbed because with images I can as follows

<?php
            $images = rwmb_meta( 'trades_mb_media_photos_img', 'type=image&size=YOURSIZE' ); // Prior to 4.8.0
            if ( !empty( $images ) ) {
                foreach ( $images as $image ) {
                    echo "<div class='col-xs-3 col-sm-2'><a class='fancybox' href='{$image['full_url']}' data-fancybox-group='gallery' ><img class='img-responsive center-block' src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></a></div>";
                    }
                }
            ?>
luizaraujoofficial commented 8 years ago

Hello, following my solution, if someone else needs to take doubts.

$url = get_post_meta( get_the_ID(), 'metabox_id', true ); // Prior to 4.8.0 $open = ('<div class="col-xs-3"><iframe frameborder="0" allowfullscreen src="'); $close = ('"></iframe></div>'); $value = "$open" . implode("$close $open", $url) . "$close"; echo $value;

Thank you all