How to the video field for group type?

Support MB Group How to the video field for group type?Resolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8793
    alishaalisha
    Participant

    Hello,
    How are you doing?Hope doing well.Now let you know my problem.
    Simply, I cannot display video field using group type.
    I am using following code to create meta box:
    https://pastebin.com/G2wbrww4
    I am using following codes to show the video but no result:
    https://pastebin.com/AnzedNNE
    It shows following error:
    Warning: Illegal string offset 'src' in C:\wamp\www\wordpress\wp-content\themes\skeleton\framework\about-us\facility.php on line 41
    please help me.
    Thanks

    #8805
    Anh TranAnh Tran
    Keymaster

    Hi,

    Thanks. I'm good 🙂

    Regarding the video field, when getting from the group, it's just the IDs of the uploaded videos. To output the videos, you can do like this:

    <?php
    foreach ( $facilities_videos as $facilities_video ) {
        $facilities_video = RWMB_Video_Field::file_info( $facilities_video );
        ?>
        <video src="<?php echo $facilities_video['src']; ?>">
    <?php } ?>
    #18683
    DanielMametDanielMamet
    Participant

    Hello,

    I want to output a video player with playlist but how to do that using MB Builder and MB Views, in detail the video custom field within a group field?

    What are the steps or what is the twig code to achieve that? Can you please give a complete example. Thank you!

    #18692
    Anh TranAnh Tran
    Keymaster

    Hi Daniel,

    Currently, MB Views allows you to display videos one by one, e.g. not in a playlist. To do that, please select the video field from the inserter panel.

    To display all videos in a playlist, please use this Twig snippet below:

    {% set videos = mb.rwmb_meta( 'video_field_id', '', post.ID ) %}
    {% set video_ids = mb.implode( ',', mb.wp_list_pluck( videos, 'ID' ) ) %}
    {{ mb.wp_playlist_shortcode( {ids: video_ids, type: 'video'} ) }}
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.