How to call custom field post meta function in array

Hi I want video link will call custom field

This is my code:

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

My code is:

 <?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 video is not running.

Please help me.

Related posts

Leave a Reply

1 comment

  1. You are nesting PHP tags. That’s not correct.

    And as per the correct syntax in your first example, it accepts a URL.

    Let’s say your function get_post_meta($post->ID, video, true); returns a proper URL, then you can modify your code like this –

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