I completed the task with fitvids.js by using the plugin FitVids for WordPress.
Chris Coyier describes the integration with WordPress in his screencast Integrating FitVids.js into WordPress (on YouTube).
My custom field name is video_url
. I used the following code in my template:
<?php if (!((get_post_meta($post->ID, 'video_url', TRUE))=='')) {
echo wp_oembed_get( get_post_meta($post->ID, "video_url", true) );
}?>
In the settings of FitVids for WordPress, simply enter the containing div class or ID which represents the maximum width of the video.
For those who need it, Integrating FitVids.js into WordPress screencast shows how to check the theme for jQuery and for the proper CSS selector.
Related Posts:
- Apply the_content filter to a custom field with multiple values
- Auto embeding Vimeo/Youtube in custom fields (tinyMCE editor)
- WP_Query – Order results by meta value
- Custom query with orderby meta_value of custom field
- Difference between meta keys with _ and without _ [duplicate]
- Orderby meta_value only returns posts that have existing meta_key
- How to enable revisions for post meta data?
- Can I query custom meta data through WP_Query
- Including custom fields in search?
- Change behavior of “Insert into Post” based on attachment metadata
- Sort posts by custom field numeric value using dropdown
- How to position a custom field before the editor
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- Order by custom field date?
- can you set a default value to a custom field
- Multiple custom fields with the same name
- Adding Properties to User Profile and Displaying in List
- use get_posts to get custom field data, but in one array
- automatically set “Featured Image” the same as the og:i that is set in a custom field
- Display value of custom field not working
- WP_query : meta_key with custom rule for specific value
- BuddyPress – Hook to Update Custom Profile Fields [closed]
- How to get the db table row that has the biggest value in the meta value?
- making sense of admin-ajax
- Add url from Custom Field as ‘Featured Image’. Code not working
- Metabox will not save
- Masking Affiliate URL using $post_slug after “/go/”
- How to update a meta field of type array in Gutenberg
- How to wrap meta values seperated by comma in ? [closed]
- Create WordPress shortcode with php code inside
- Bulk remove post meta
- Is it better practice to use ‘This Name Format’ or ‘this-name-format’ for custom fields?
- Storing a DateTime Value in a Sortable Custom Field?
- WordPress Rest API to call page data associate with custom meta
- How to show a post if was published less than two hours ago?
- Custom field as Slug
- How to save the date/time of last update of an extra user profile field?
- How to populate custom field dropdown box based on prior selection?
- Define a post’s title and slug from Custom Fields
- How can you include custom post meta in search without calling each key?
- Custom wysiwyg editor doesn’t execute shortcodes?
- How to hide a div based on contents of custom field
- Hook after meta created
- What is the largest value you can store in a custom field (as meta data for a post)?
- Where does this field get its value?
- ORDER BY custom field value out of where clause
- Get all the posts where meta field with multiple choice has several values checked
- Warn user that data may be lost for custom pages
- List custom field values in alphabetical order without repetition
- Can’t query by meta_key
- Display MP3 as media using an URL from a custom field
- WordPress custom fields feature is missing in my installation
- Print Posts if Custom Field Value Date equal or greater than Today Date
- Update post meta custom field using block editor
- If I update WordPress my custom data will be deleted from the wp_users table?
- Get emails from users by custom field SQL
- Save all custom field data into one “master” custom field
- Convert all dates stored in custom field
- Why am I getting a “Call to member function format() on a non-object” error?
- Plugin or shortcode for ISBN number?
- HM CMB: Role Select
- WP-eComerce Advance Meta Tag data in descending order [closed]
- Custom Query Fields – Altering Meta Value
- Replacing custom field with shortcode
- WPAlchemy issue when using 2 select menus with the same values inside a repeating group
- Adding re-type email and check it if the email match
- show a specific metabox dependent on the page template
- excluding posts by an ACF field in pagination
- Search & column order by meta value in admin
- Exclude URL’s from sanitize_html_classes
- Best way to insert a list of links into a post outside of the_content
- Is the use of many custom field not good for server?
- How to add a post’s view count into the WordPress API response
- How can I ‘check’ the “custom fields” box from the Screen Options?
- Can you generate a featured image from two images from custom fields?
- How to get all wp_posts in wordpress fetched from database
- Search fails when using the radio buttons
- automatically add custom fields to post title
- Custom Fields Permalink Plugin not observing hyphens
- will wp_insert_post write a new custom field to the database?
- How to repeate custom field group with bulk image field
- Extra text’n’image field in a page
- Get first URL from custom field, download and set as featured image on post publish
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- How to add an option to admin to add image that could be used as header?
- Custom Field add markup to line breaks
- Use Metabox to enter Post Title
- Include custom fields into the content of a regular page
- Bypassing a Form Options
- How to query posts that have certain post meta keys, and sort by meta key and/or value
- How to implement jquery-ui autocomplete into custom fields?
- Add image custom attribute [closed]
- i want to send email on custom post field (job_status == 2) but it is not working
- Foreach giving one too many list items, how can I remove the last empty line?
- Add custom fields to specific menus
- Add fields to edit in custom widget
- Can running a WP-Cron to update_post_meta cause performance issues?
- custom field value is blank or empty
- How to add a custom field to the comments “Quick Edit” screen?
- Multiple triggers when publishing, saving or updating a post in WordPress