Twitter Custom Image Size
-
Hello,
I am trying to set custom size images to Facebook and Twitter social sharing. I added the custom sizes and the
wpseo_opengraph_image_sizeandwpseo_twitter_image_sizecode. When I view the source code of the page or use a debugger, Facebook is pulling in the custom size, but Twitter is still pulling the default full size featured image. I believe this may be a bug in the plugin.—-
You can see the correct cropped images here:
Facebook: https://www.greaterthan.org/wp-content/uploads/2018/03/Emp-IPV_Group-5-scaled-1200×630.jpg
Twitter: https://www.greaterthan.org/wp-content/uploads/2018/03/Emp-IPV_Group-5-scaled-1024×512.jpg
—–
The code added in functions.php://Custom Image sizes for FB and TW add_action( 'after_setup_theme', 'wpdocs_theme_setup' ); function wpdocs_theme_setup() { add_image_size( 'facebook-share', 1200, 630, true ); //Facebook Link Images size add_image_size( 'twitter-share', 1024, 512, true ); } //Setting the custom sizes for Yoast to pick up function set_custom_facebook_image_size( $img_size ) { return 'facebook-share'; } add_filter( 'wpseo_opengraph_image_size', 'set_custom_facebook_image_size' ); function set_custom_twitter_image_size( $img_size ) { return 'twitter-share'; } add_filter( 'wpseo_twitter_image_size', 'set_custom_twitter_image_size' );—–
Here is what the page source code is showing. You can see the correct size for Facebook, but not for Twitter.
<meta property="og:image" content="https://www.greaterthan.org/wp-content/uploads/2018/03/Emp-IPV_Group-5-scaled-1200x630.jpg" /> <meta property="og:image:secure_url" content="https://www.greaterthan.org/wp-content/uploads/2018/03/Emp-IPV_Group-5-scaled-1200x630.jpg" /> <meta property="og:image:width" content="1200" /> <meta property="og:image:height" content="630" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:image" content="https://www.greaterthan.org/wp-content/uploads/2018/03/Emp-IPV_Group-5-scaled.jpg" />Can you please help me with this issue?
Thank you.
The page I need help with: [log in to see the link]
The topic ‘Twitter Custom Image Size’ is closed to new replies.