Facebook not publicizing a photo from my wordpress site
-
Hi there,
having a problem for a while now with Facebook not publicizing a photo from my wordpress site
here’s my post on my site
https://www.cescoemmanuel.com/?p=426
Here’s how it looks on facebook
https://www.facebook.com/cesco.emmanuel?ref=tn_tnmn
any ideas?
Thanks
Cesco
-
Give us a screenshot of the Facebook post not a link to your profile as we aren’t friends with you. Then we can help debug the problem.
Hi, I saved the screenshot but not seeing how to attach it here …..
sorry but I’m not good at this kinda stuff…..
any ideas?
One way to post the screenshot is to simply upload it to somewhere in your WordPress site and paste a link into a reply here.
But here is something else to try and see if it fixes your problem (it fixed a similar problem that I had):
Open up the
functions.php
file in your theme’s directory using an (S)FTP client to access the web server ([WP-HOME]/wp-content/themes/THEME-NAME), or create it if it doesn’t yet exist (in this case be sure to add<?php
at the top of the file and?>
at the bottom of the file), and add the following:// remove autogenerated facebook open graph metadata remove_action('wp_head','jetpack_og_tags'); // manually add facebook open graph metadata function insert_fb_in_head() { global $post; if ( !is_singular()) //if it is not a post or a page return; //simply don't add og metadata to the header echo '<meta property="og:title" content="' . get_the_title() . '"/>'; echo '<meta property="og:type" content="article"/>'; echo '<meta property="og:url" content="' . get_permalink() . '"/>'; echo '<meta property="og:site_name" content="' . get_bloginfo('name') . '"/>'; if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image echo '<meta property="og:image" content="[URL TO DEFAULT IMAGE FOR POSTS]"/>'; } else { // the post has a featured image so go and use it $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' ); echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>'; } } add_action( 'wp_head', 'insert_fb_in_head', 5 );
Where I put “[URL TO DEFAULT IMAGE FOR POSTS]” replace that with the URL to a 100×100 pixel png file you upload to your web server that will be used if the post contains no image. If the post has an image this code will instead use it.
What this tells your site to do is disable Jetpack’s automated addition of Facebook metadata to posts and replaces it with your own implementation, which uses the image found in any post that contains an image but otherwise uses an image you explicitly choose in the block of code itself. I found that this stopped me from having Jetpack’s publicize use some random picture that wasn’t even real and instead now uses my site’s favicon (in a larger format).
Hope this helps.
ok, I inserted that at the top of the functions.php and now I am getting this message when I try to save it and I can’t even get back into my site
Parse error: syntax error, unexpected T_FUNCTION, expecting T_STRING or T_VARIABLE or ‘$’ in /home/fraemm/cescoemmanuel.com/wp-content/themes/piano-black/functions.php on line 12
PLEASE HELP???
And this is but one reason you never edit the original theme’s files… child theme’s are your friend. The fix is the same however.
You’re using the WordPress.COM SVN version of that theme (are you on Dreamhost?) so this gets a little trickier then just getting the theme from the repo here.
https://wpcom-themes.svn.automattic.com/piano-black/
Try this to get working for now.
-
Using FTP or whatever filemanagement tools your host has provided you with navigate to the
wp-content/themes
directory. -
Once there locate and download to your PC or Mac the entire
piano-black
directory. This is to keep it as a backup and you can put it back later. Do not skip this step. -
After you have that directory backed up then delete it. Just the
piano-black
directory and nothing else. -
Try and re-login to your WordPress dashboard.
https://www.cescoemmanuel.com/wp-admin/themes.php
You should get a message about “Theme missing, switching to the Twenty Twelve theme”. That will let you back into your installation.
If that works then you’ll need to get a good copy of that
functions.php
file and then re-upload that directory (with the originalfunctions.php
file) back to your web server.If your host provided you with that copy then they may be able to get the unedited file back for you.
Hi, it’s not letting me delete it from the directory
Can you delete the files in that directory? An empty
piano-black
directory should work too.You do have those files backed up right?
yes, I saved it to my mac….
I can access my FTP directory, but when I click on the Piano-Black theme and press ‘Command Delete’, nothing is happening….
I can highlight all the files in the directory for Piano Black, but again, can’t delete
Can you move that directory outside of
themes
to saywp-content
? If not then you may need to speak with your host for help.no I can’t do that either
Oh boy….how could one little thing cause so much trouble
Are there any other options?
It’s that
functions.php
file that’s causing you grief. If you could revert it back using a copy from https://wpcom-themes.svn.automattic.com/piano-black/ then it should just work.Unless you can fix that file you’re stuck…
There is a way to edit the mysql database options table and change it there but I’m couldn’t explain that well. You could end up getting deeper into trouble.
ok, I still cannot get a photo of me published to Facebook unless I use manually paste the link on my wall….
I uninstalled the sharing option with Jetpack and it is still not working….
any ideas?
I checked your site, and it seems you have 2 different sets of Open Graph Meta tags in the head: one of them is added by a plugin named “WP Facebook Like Send & Open Graph Meta”, and the other is added by Jetpack.
However, none of these sets of Open Graph meta tags include an image meta tag that would tell Facebook which image to use in its post preview.
To solve this issue, I would suggest the following:
- Disable the WP Facebook Like Send & Open Graph Meta plugin to remove the duplicate set of meta tags. You can add a Facebook Like button by changing your sharing settings to “Official buttons” under Settings > Sharing in your dashboard.
- Insert an image into your post, or define a Featured Image, as explained here:
https://codex.www.ads-software.com/Post_Thumbnails - It’s worth noting that this image has to be larger than 200px x 200px, or Facebook will ignore it.
I hope this helps.
Hi, Jeremy, thanks so much. I deactivated the WP Like box.
The only thing, I have to set my image every time I post and it used to be done automatically. Also, the image is showing up as a huge picture on my site now before the blogpost.
Can anything be done about that?
Also, should I un-install & re-install Jetpack?
Thanks again for your help
Cesco
-
Using FTP or whatever filemanagement tools your host has provided you with navigate to the
- The topic ‘Facebook not publicizing a photo from my wordpress site’ is closed to new replies.