@steve92 Hi steve, thanks for your answer.
I fixed the code a bit because it had errors
/* INIZIO FUNZIONE */
function eve_meta() {
/* prendo il contenuto del post */
Global $wp_query;
$post = $wp_query->post;
$page_id = $post->ID;
$page_object = get_page( $page_id );
$page_content = $page_object->post_content;
/* lo ripulisco da tag e caratteri strani */
$fbdesc = wp_html_excerpt(htmlspecialchars_decode(strip_tags(strip_shortcodes(str_replace('"','',($page_content))))), 150,'...');
/* prendo immagine post */
$fbthumb = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'facebook-thumb');
?>
<?php
/*META NAME & OPEN GRAPH POST*/
if (is_single()) {
?>
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="og:image" content="<?php echo $fbthumb[0]; ?>" />
<meta property="og:description" content="<?php echo $fbdesc; ?>" />
<meta property="og:url" content="<?php the_permalink(); ?>" />
<meta name="twitter:title" content="<?php the_title(); ?>" />
<meta name="twitter:description" content="<?php echo $fbdesc; ?>" />
<meta name="twitter:image:src" content="<?php echo $fbthumb[0]; ?>" />
<?php
}
/* FINE FUNZIONE */
}
add_action('wp_head', 'eve_meta' );
But it doesn’t work.
Maybe because it’s not a post page but it’s a normal page full of photo:
https://www.scaranidesigner.com/aziende/