Support » Fixing WordPress » Facebook Share Can't Work No Matter What

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi alexkwa,

    Try these two tutorials :

    1.Post Excerpt in Facebook Link Description
    Click Here

    2. Tutorial: Show Featured Image In Facebook Click Here

    Hello,

    First of all, thank you so much for your reply. I’ve actually tried these tutorials out before.
    The first tutorial does not work for me. This is the code for single pages.

    <?php if (is_singular() || is_single() || is_page()) { ?>
    <title>
    <?php single_post_title(''); ?>
    </title>
    <?php
    global $post;
    setup_postdata($post);
    ?>
    <meta name=”description” content=”<?php the_excerpt_rss(); ?>” />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="<?php single_post_title(''); ?>" />
    <meta property="og:url" content="<?php the_permalink(); ?>"/>
    <meta property="og:image" content="<?php if ( $thumb[0] == null ) { echo $default_img; } else { echo $thumb; } ?>" />
    <?php }; ?>

    For Tutorial 2, the given code

    <span>function insert_image_src_rel_in_head() {
    	global $post;
    	if ( !is_singular()) //if it is not a post or a page
    		return;
    	if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
    		$default_image="<a class="linkclass" href="http://example.com/image.jpg">http://example.com/image.jpg</a>"; //replace this with a default image on your server or an image in your media library
    		echo '';
    	}
    	else{
    		$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
    		echo '';
    	}
    	echo "n";
    }
    add_action( 'wp_head', 'insert_image_src_rel_in_head', 5 );
    
    </span>

    causes a parse error (Parse error: syntax error, unexpected ‘<‘ in /home/alexkwa/alexkwa.com/wp-content/themes/alexkwa/functions.php on line 4)

    Appreciate any help I can get. alexkwa.com is my site btw.

    I really could appreciate any help on this. I’ve tried a long while by myself…

    alexkwa, you’re not alone – I have this problem too, and it’s only begun after I upgraded to WordPress 3.4.2
    (My secondary blog is still running on version 3.4 and sharing links to that blog work perfectly. The plugins on both my blogs are pretty much the same too, so I’m forced to conclude that it has to do with the upgrade…)

    Nothing I’ve tried seems to work, and my own request for help on the forum here hasn’t received any response as yet either – guess there’s no real solution for it, maybe? :/

    That’s just bull. 🙁 I managed to get the descript working, but not the thumbnail, even tho the source pulls the right image, the right image doesnt show when shared…

    I don’t know if this will help, but I got my chosen thumbnail to show up when I shared my site in Facebook by adding this to the header.php (in my TwentyEleven child theme), right under </title>:

    ‘<meta property=”og:image” content=”YOUR IMAGE URL HERE” />’

    I had added the thumbnail image to my media library and copied the full URL from there. It worked perfectly.

    However, I’m having trouble getting the proper title of the web site to show up when I post to Facebook. It annoying reads “Home” which is the name of the static homepage I created. AlexKwa, how did you get the description to work?

    My site is

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Facebook Share Can't Work No Matter What’ is closed to new replies.