I have the following code that is showing the url of a file meta key:
$images = get_post_meta( $post->ID, 'video_of_user' );
if ( $images ) {
foreach ( $images as $attachment_id ) {
$thumb = wp_get_attachment_image( $attachment_id, 'thumbnail' );
$full_size = wp_get_attachment_url( $attachment_id );
printf( '<a href="%s">%s</a>', $full_size, $thumb );
}
}
Instead of showing just the URL in an HREF, i with it to play inside the WordPress default media player.
so i am using "do_shortcode" for "[video]". what i can't seem to do is to add the:
printf( '<a href="%s">%s</a>', $full_size, $thumb );
Inside the do_shortcode. something like that:
<?php echo do_shortcode( '[video width="100%" height="472" m4v="MY-VIDEO-URL"][/video]' ); ?>
i have tried doing this:
<?php echo do_shortcode( '[video width="100%" height="472" m4v="'%s', $full_size, $thumb"][/video]' ); ?>
But it dosn't seem to work.
I have also tried:
$images = get_post_meta( $post->ID, 'video_of_user' );
if ( $images ) {
foreach ( $images as $attachment_id ) {
$thumb = wp_get_attachment_image( $attachment_id, 'full' );
$full_size = wp_get_attachment_url( $attachment_id );
echo wp_get_attachment_url( $attachment_id, 'full' );
}
}
And then:
<?php echo do_shortcode( '[video width="100%" height="472" m4v="'. wp_get_attachment_url( $attachment_id, 'full' ) .'"][/video]' ); ?>
But this also don't work.