How to call custom meta-function of a field in an array

Hi i want the video link to call the custom field

This is my code:

<?php the_post_thumbnail('slider-thumb', array('class' => 'rsImg', 'data-rsvideo' => 'http://www.vimeo.com/61893383' )); ?>

      

My code:

 <?php the_post_thumbnail('slider-thumb', array('class' => 'rsImg', 'data-rsvideo' => '<?php echo get_post_meta($post->ID, video, true); ?>' )); ?>

      

There are no syntax errors. But the video doesn't work.

Please help me.

+3


source to share


1 answer


Nested PHP tags. This is not true.

And according to the correct syntax in your first example, it accepts a url.



Let's say your function is get_post_meta($post->ID, video, true);

returning the correct url, then you can change your code like this:

<?php 
    $myVidURL = get_post_meta($post->ID, 'video', true);
    the_post_thumbnail('slider-thumb', array('class' => 'rsImg', 'data-rsvideo' =>  $myVidURL )); 
?>

      

+4


source







All Articles