ID ); $exclude_types = array( '' ); $exclude_types = apply_filters( 'eat_exclude_types', $exclude_types ); // do nothing if the post has already a featured image set if ( $already_has_thumb ) { return; } // do the job if the post is not from an excluded type if ( ! in_array( $post_type, $exclude_types ) ) { // get first attached image $img = rv_auto_featured_image_catch_that_image( $post ); $attachment_id = attachment_url_to_postid( $img ); if ( $attachment_id ) { // add attachment ID add_post_meta( $post->ID, '_thumbnail_id', $attachment_id, true ); } } } // set featured image before post is displayed (for old posts) add_action( 'the_post', 'rv_auto_featured_image_add_thumbnail' ); // hooks added to set the thumbnail when publishing too add_action( 'new_to_publish', 'rv_auto_featured_image_add_thumbnail' ); add_action( 'draft_to_publish', 'rv_auto_featured_image_add_thumbnail' ); add_action( 'pending_to_publish', 'rv_auto_featured_image_add_thumbnail' ); add_action( 'future_to_publish', 'rv_auto_featured_image_add_thumbnail' ); function rv_auto_featured_image_catch_that_image( $post ) { // Find the images in the post_content. $output = preg_match_all( '//i', $post->post_content, $matches ); $first_img = isset( $matches[1][0] ) ? $matches[1][0]:''; // if no images found, do nothing if ( empty ( $first_img ) ) { return false; } return $first_img; } }North America – Tripadorn
7 Top-rated destinations in Monterrey

7 Top-rated destinations in Monterrey

Located at the foothills of the majestic Sierra Madre Oriental, capital of the extremely biodiverse North-Eastern and historically rich state of Nuevo Leon, Monterrey is universally recognized as one of Mexico’s best... Read more »
Ad Widget
Beautiful Sights of Upstate New York

Beautiful Sights of Upstate New York

When you hear New York, crowded streets, towering skyscrapers, and the magic of Broadway may be the first things that come to mind. However, New York is much more than the metropolis... Read more »
A Brief Guide To The ABC Islands – Aruba, Bonaire, and Curaçao

A Brief Guide To The ABC Islands – Aruba, Bonaire, and Curaçao

Aruba, Bonaire, and Curaçao are the three islands that make up the ABC Islands in the Lesser Antilles. Located just off the Venezuelan coast, each island offers a wonderful experience whether on... Read more »
Ocho Rios | Waterfalls, Reggae, and Beyond

Ocho Rios | Waterfalls, Reggae, and Beyond

It may be hard to believe now, but Ocho Rios was once little more than a sleepy Jamaican fishing town. Though that image is at odds with the tourist hotspot it has... Read more »
Big Sky | A Winter Haven in a Vast Wilderness

Big Sky | A Winter Haven in a Vast Wilderness

American ski resorts have always been the wilder cousins to their European counterparts, and nowhere exemplifies this better than Big Sky Ski Resort in Montana. Located just outside Yellowstone National Park, Big... Read more »
Washington D.C. – Exploring America’s Capital

Washington D.C. – Exploring America’s Capital

The epicenter of American politics, the District of Columbia is teeming with invigorating history and gorgeous monuments. While walking through the open space of the National Mall, you can feel the presence... Read more »
Revelstoke Mountain Resort – A Goldmine for Thrill Seekers

Revelstoke Mountain Resort – A Goldmine for Thrill Seekers

Whistler. Lake Louise. Banff. These are the names you often hear when mentioning the top ski destinations in the Great White North. These are all majestic places for a top-notch winter getaway,... Read more »
Top Things to Do in Yucatan Peninsula

Top Things to Do in Yucatan Peninsula

The Yucatan Peninsula is one of Mexico’s most treasured regions and visited by travelers from all over the globe. With its sun-kissed beaches, tropical rainforests, Mayan ruins, and diverse marine life, it’s... Read more »
Snorkeling Adventure at Grand Turk Island

Snorkeling Adventure at Grand Turk Island

One of the most thrilling adventures in my life came along the shores of the popular Caribbean port of Grand Turk Island in the Turks and Caicos. My cruise ship was only... Read more »
The Great Smoky Mountains

The Great Smoky Mountains

Straddling the states of Tennessee and North Carolina, the Great Smoky Mountains drew in over 11 million visitors in 2018. The diverse landscape is one of the most versatile in North America... Read more »
A note to our visitors

This website has updated its privacy policy in compliance with changes to European Union data protection law, for all members globally. We’ve also updated our Privacy Policy to give you more information about your rights and responsibilities with respect to your privacy and personal information. Please read this to review the updates about which cookies we use and what information we collect on our site. By continuing to use this site, you are agreeing to our updated privacy policy.