• Skip to content
  • Skip to primary sidebar
  • Skip to footer

Foliovision

Making the web work for you

Main navigation

  • Weblog
    • FV Player
    • WordPress
    • Video of the Week
    • Case Studies
    • Business
  • About
    • Testimonials
    • Meet the Team
    • We Support
    • Careers
    • Contact
    • Pricing
  • Products
  • Support
    • FV Player Docs
    • Pro Support
  • Login
  • Basket is empty
Affordable VAST/VPAID for Wordpress has arrived. Serve ads with your videos starting today!
    • Docs
      • Installation
      • Configuration
      • User guide
      • Downgrading
      • Changelog
    • FAQ
    • Support
      • Free Support
      • Pro Support
    • PRO

    Setting up Video Custom Fields

    Sometimes it's necessary to showcase your video in some other part of the page than in the article content, or you just want your users to fill in the videos in a more structured way.

    First, activate the function Enable profile videos in Settings > FV Player > Setup tab > Integrations/Compatibility. Then use this code in your theme's functions.php file to add a new "Film Videos" box with meta key "film_videos" to all of your posts (not pages though):

    /**
     * FV Player Video Custom Fields
     */
    if( class_exists('FV_Player_MetaBox') ) {
      new FV_Player_MetaBox( array(
          'name' => 'Film Videos',
          'meta_key' => 'film_videos',
          'post_type' => 'post',
          'display' => true,
          'multiple' => true,
          'labels' => array(
            'edit' => 'Edit Video',
            'remove' => 'Remove Video'
          )
        )
      );
    }

    The videos will appear automatically at the end of the post.

    Then you get a new meta box on the post editing screen - it lets you insert new videos and also shows a preview of the video that is stored:


    Click for a preview of the full posting interface

    You can also omit the "display" parameter to get more control over how the videos are displayed:

    if( class_exists('FV_Player_MetaBox') ) {
      new FV_Player_MetaBox( array(
          'name' => 'Film Videos',
          'meta_key' => 'film_videos',
          'post_type' => 'post'
        )
      );
    }

    Then you can use this PHP code to show these videos in your post template:

    if( class_exists('FV_Player_Custom_Videos') ) {
      global $post;
      $objVideos = new FV_Player_Custom_Videos( array('id' => $post->ID, 'meta' => 'film_videos', 'type' => 'post' ) );
      $objVideos->get_form();
      if( $objVideos->have_videos() ) {
        foreach( $objVideos->get_videos() AS $video ) {
          echo do_shortcode($video);
        }
      }
    }

    Please note that in the arguments passed to contructor of FV_Player_Custom_Videos the "type" field doesn't refer to the "post_type", but switches between using post meta and user meta.

    Share
    Tweet
    Share
    0 Shares

    Reader Interactions

    Primary Sidebar

    Advanced

    1. Download | Buy
    2. Basic Setup
    3. Demos
    4. Advanced
      1. How to use FV Player Database
      2. How to use FV Player Widget
      3. Integrations/Compatibility Options
      4. Setting up Video Custom Fields
      5. Timeline Previews
      6. Using Google Analytics with FV Player
      7. AB Loop Function
      8. How to Create Subtitles
      9. Interactive Video Transcript
      10. How to Use Custom Start/End Time
      11. Sticky Video
      12. CSS Tips and Fixes
      13. Using FV Player with Minify Plugins
      14. How to use built-in S3 browser
      15. How to Use the Speed Buttons
      16. Using FV Player with Chromecast
      17. Using FV Player with Sub-domains and Multi-Domains
      18. FV Player Profile Videos
      19. Video Downloading With Simple History Support
      20. Email Subscription Form Pop-ups
      21. How to create membership site with RCP and FV Player
      22. Using FV Player With AMP
      23. Programmer's Guide
      24. FV WordPress Flowplayer Downgrading
      25. Changelog
      26. Incompatible Plugins and Scripts
    5. Video Hosting
    6. Securing Your Video
    7. Ads
    8. VAST/VPAID Ads
    9. Additional Services
    10. Legal
    11. Settings
    12. FV Player Pay Per View
    Foliovision logo
    All materials © 2021 Foliovision s.r.o. | Panská 12 - 81101 Bratislava - Slovakia | info@foliovision.com
    • This Site Uses Cookies
    • Privacy Policy
    • Terms of Service
    • Site Map
    • Contact
    • Tel. +1 518 412 4600