I think all you need is this:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
if (get_field('channel') == 'Youtube') {
echo get_field('youtube_video_id');
} elseif (get_field('channel') == 'Vimeo') {
echo get_field('vimeo_video_id');
} elseif ( has_post_thumbnail()) {
the_post_thumbnail();
}
That should use a Youtube video, then a Vimeo video, then the thumbnail, and do nothing otherwise.
Related Posts:
- WordPress loop specific thumbnail size
- Advanced Custom Fields: Post Object – Not returning data [closed]
- How can I show the post thumbnail from the most recent of a certain post type, in widget?
- How can I add pagination and how can I change thumbnail size?
- How can I add multiple ‘tax_query’ arrays via a loop?
- ACF page while loop breaks footer while loop
- Using Advanced Custom Fields to create a per page slider
- post thumbnail, conditions, else wont work
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- How to pick “full/thumbnail” images in the loop?
- ACF – Get ID of relationship field in flexible content
- How to output values from a loop into a javascript array
- ACF background-color per post in a WordPress loop
- Thumbnail wouldn’t scale to size properly
- PHP for loop not working as intended
- ACF loop and php formatting
- How to display thumbnail if post is assigned one otherwise not
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- How to add active class to custom menu using while loop and wp_list_pages
- Print html when custom field has value inside while loop
- delete an array element when its date expires
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- How to get Poster (thumbnail) Image of Video
- How do I display the function the_content in this loop?
- Featured image fallback link to permalink
- How to get to a specific position in wp_query?
- Facebook “like” open graph meta in header.php
- Importing hard coded custom field into acf field
- Using foreach loop breaks
- Randomly Assign an Image’s Alt Text Based on Data From Post
- Loop with slider (slider not loading)
- How to hide all child pages with post_query?
- How to sort posts based on the value (number) of a post’s metadata?
- Saving an array of dynamic repeater data as post_meta
- Displaying Woocommerce Product Category in WordPress
- Unread Repeater field IMG alt not working
- How can I add extra word in permalink when someone click download button?
- Blog posts repeat
- Slick + PHP + ACF + JQuery slide reveal not working
- Woocommerce : Can’t get product info in loop
- Checkbox doesn’t stay checked, conten
- Can we count the WordPress Loop
- Advanced Custom Fields not displaying
- Add content after the first post in WP Loop
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Apply class to every third list item? [duplicate]
- Last class on last headline?
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- Form search query – displaying ACF “Post Object” field as results
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Conditional multidimensional arrays and array_map
- Help Fallback (thumbnail)
- Echoing a CSS class based on category of post in a list
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Get featured image with custom size outside WordPress
- How to add post thumbnail dynamically using Jquery?
- How to change thumbnail src attribute?
- Advanced Custom Fields [closed]
- Get the featured image url of clicked post
- ACF Unexpected T_CONSTANT_ENCAPSED_STRING [closed]
- How to Make Thumbnail of Post Stay Animated
- How to Fix an Archive.php That Displays All Posts?
- Php code error in wordpress if else statements [closed]
- pagination broken – clicking next displays “page not found”
- Foreach loop is unexpectedly outputting an extra empty a tag
- How to store checkbox data for individual users?
- How do I get pagination for get_posts() in WordPress or do I have to rewrite the whole code?
- wp_query – Exclude the first thumbnail from lazy loading on archives
- Check if current post in loop is last on current page
- If Statement is Ignored?
- Query on a repeater date (acf)
- ACF values to Script with auto refresh
- Possible to edit custom date field and display?
- ACF Gallery field images donwload
- adding or removing endforeach; throws error!
- Adding PHP to an if else loop
- How to link featured images in single.php for only non-logged-in users?
- Filter loop by ‘price’ with meta_query
- Position a repeated article blocks
- ACF + WP + Slick Slider Repeater Slide Group PHP not Displaying [closed]
- Adding custom PHP to existing loop in Genesis
- Problems with the WordPress loop [closed]
- WordPress while loop with aphabetic counting like one, two, three
- Add post class in custom loop (WP_QUERY)
- Loop returns more items than exist?
- ACF field not appearing correctly in loop
- How to correctly add the featured immage (thumbnails) support in a WP theme? Why I can’t add a featured immage?
- I want my wordpress loop to only display posts of the standard format
- Automatically create a loop for post ID
- Overwriting a Shortcode
- why is this content-template not showing any of my blog-entries?
- Advanced Taxonomy query, with 3 post types
- Custom single.php files for different post formats
- Troubleshooting “loopback requests that take too long”
- Order woo products, but first products must be with acf fields
- Help with if/else loop [closed]
- Show button in header when product custom field is not empty
- How do I exclude the current post from the upcoming post query