function set_featured_image_from_content( $post_id ) { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( wp_is_post_revision( $post_id ) ) return; if ( has_post_thumbnail( $post_id ) ) return; $content = get_post_field( 'post_content', $post_id ); if ( ! $content ) return; $image_id = null; // Cerca immagini nel blocco galleria if ( preg_match_all( '/"id":(\d+)/', $content, $gallery_matches ) ) { foreach ( $gallery_matches[1] as $id ) { if ( wp_attachment_is_image( $id ) ) { $image_id = $id; break; } } } // Se non trovata in galleria, cerca immagini singole nel contenuto if ( ! $image_id ) { if ( preg_match_all( '/]+wp-image-(\d+)[^>]*>/i', $content, $img_matches ) ) { foreach ( $img_matches[1] as $id ) { if ( wp_attachment_is_image( $id ) ) { $image_id = $id; break; } } } } // Se non trovata, cerca per URL if ( ! $image_id ) { if ( preg_match_all( '/]+src=[\'"]([^\'"]+)[\'"][^>]*>/i', $content, $url_matches ) ) { foreach ( $url_matches[1] as $url ) { $id = attachment_url_to_postid( $url ); if ( $id ) { $image_id = $id; break; } } } } // Se trovata imposta come immagine in evidenza if ( $image_id ) { set_post_thumbnail( $post_id, $image_id ); return; } // Fallback casuale $fallback_ids = array( 45835, 45834, 45833, 45831, 45832 ); $random_id = $fallback_ids[ array_rand( $fallback_ids ) ]; set_post_thumbnail( $post_id, $random_id ); } add_action( 'save_post_post', 'set_featured_image_from_content', 10, 1 );
Skip to content Skip to sidebar Skip to footer

PLEASURE KRONOS

Imponendosi con palese comodità sul piede di 1’13” domenica 10 giugno a Torino, Pleasure Kronos è entrato nella ranking list dei cavalli più veloci della pista torinese 2012. Il suo riferimento cronometrico è il dodicesimo.
Ma ecco nel dettaglio la graduatoria
12″0 Napoleon Bar
12″2 Newyork Newyork
12″5 Martina Grif
12″6 Irving Rivarco
12″6 Louvre
12″7 Noriana Rosso
12″8 Geox
12″8 Gibartur
12″8 Next Wind
12″9 Pontiac Turbo
12″9 Narrazione
13″0 Pleasure Kronos

Rispondi

Scopri di più da Ippodromo di Vinovo

Abbonati ora per continuare a leggere e avere accesso all'archivio completo.

Continua a leggere