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
- Iterate through posts based on array of categories
- Output ACF repeater on frontend user’s profile page (created with Ultimate Member) [closed]
- get author_name from queried post
- Displaying Woocommerce Product Category in WordPress
- Remove the first 5 characters of the_title and orderby that
- Unread Repeater field IMG alt not working
- Unable to write multiple values back to ACF user field – PHP
- How can I add extra word in permalink when someone click download button?
- Update grandchild repeater field with value per row
- Increase offset while looping
- Blog posts repeat
- How to use thumbnail size of image if I’m only using src to get image
- Slick + PHP + ACF + JQuery slide reveal not working
- How to add condition in wordpress loop? [closed]
- Woocommerce : Can’t get product info in loop
- Display custom post type title as text if post thumbnail is not available
- How to set variable, pass it to a partial file and remove it after?
- how to refresh div on template part?
- Alert Bar section within WP loop is displaying even though there are no posts
- remove post that has no content
- Display category name only once inside loop
- Can’t find infinite loop cause
- Checking array against author id in loop
- How do I Turn This Into An if statement?
- Stuck in the query loop
- Load wordpress content in other domain
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- Checkbox doesn’t stay checked, conten
- Sort by page information by Ascending Numbers
- Redirect to another page using contact form 7? [closed]
- Widgets in the loop if active
- List posts that don’t have a specific tag?
- Changing the_posts_navigation() html output
- ‘Post-thumbnails’ feature does not seem to register
- height should be set to auto to avoid pixelation in the post thumbnail function
- Can we count the WordPress Loop
- Advanced Custom Fields – display label and value only if value entered
- Get post id within comments loop
- Advanced Custom Fields not displaying
- Syntax error when I try to insert my loop into an unordered list? [closed]
- WP_Query fails despite having 1 post
- Three Questions with Twenty Eleven theme
- Display related posts without a plugin
- Add content after the first post in WP Loop
- wp_query get the 2nd post
- Loop stopped working
- Download PDF after CF7 form submission
- How to get post ID in a Page?
- Custom Pagination is Broken
- Display an image if odd number of posts in grid
- How to loop through all the attached images in a post, and get their url one by one
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- PHP Warning: strip_tags() expects parameter 1 to be string?
- WordPress function and string as variable?
- Store post content in a php variable and output them using for loop
- Resize image to specific dimension (X to Y ratio)
- How to add div blocks after certain set of post
- Echo a shortcode div after every 3 posts
- How to avoid duplicates when creating recent network posts
- How to overwrite orderby with add_query_var
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Why in my theme I can’t see all the statics content under the posts?
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- Is the 404 page automatically displayed if a loop returns nothing?
- How do I remove a category from a wordpress loop>
- Apply class to every third list item? [duplicate]
- variable value disappears in a second loop
- Last class on last headline?
- Show recent posts starting at a specific number archive
- Upload non-featured image to image field
- Automatically add images to a menu
- get_the_ID() in the footer returns wrong value
- How to get the last category name of a child category?
- HTML Special Characters in URL string [closed]
- ACF put a comma after the last repeater field value [closed]
- WordPress query undefined offset in loop
- 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
- InnerBlocks with allowedBlocks not working with acf_register_block
- How to unlink all posts from tracking same amount of views
- Issue with custom loop in Archive page
- Accessing values from ACF sub field (flexible content area) in PHP