0

Is there a way! when click on facebook share button from post the image should be top of post title and description instead of left to on facebook share window.

i have tried this code as a Wordpress plugin

add_image_size('fb-preview', 190, 190, true); // get image preview function ST4_get_FB_image($post_ID){ $post_thumbnail_id = get_post_thumbnail_id( $post_ID ); if ($post_thumbnail_id){ $post_thumbnail_img = wp_get_attachment_image_src( $post_thumbnail_id, 'fb-preview'); return $post_thumbnail_img[0]; } } // get post description function ST4_get_FB_description($post){ if ($post->post_excerpt){ return $post->post_excerpt; } else { // post excerpt is not set, we'll take first 55 words from post content $excerpt_length = 55; // clean post content $text = str_replace("\r\n"," ", strip_tags(strip_shortcodes($post->post_content))); $words = explode(' ', $text, $excerpt_length + 1); if (count($words) > $excerpt_length) { array_pop($words); $excerpt = implode(' ', $words); return $excerpt; } } } function ST4FB_header(){ global $post; $post_featured_image = ST4_get_FB_image($post->ID); $post_description = ST4_get_FB_description($post); if ( (is_single()) AND ($post_featured_image) AND ($post_description) ){ ?> <link rel="image_src" href="<?php echo $post_featured_image; ?>" /> <meta name="title" content="<?php echo $post->post_title; ?>" /> <meta name="description" content="<?php echo $post_description; ?>" /> <?php } } add_action('wp_head','ST4FB_header'); 

and facebook share button on post page.

ID)); ?>&t=post_title); ?>">Share on Facebookenter image description here

1
  • You don't get to muck with Facebook dialogs. Commented Nov 27, 2013 at 5:00

1 Answer 1

1

i would suggest reading the facebook api docs and taking the mindset that they don't want you to mess with their stuff.

https://developers.facebook.com/docs/reference/dialogs/feed/

even without that mindset everything here suggests that you get no control over this, and if you do it is an undiscovered bug that fb would want to fix (and hence break whatever you find).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.