Hello friends, Can someone could help me with a little code in my wordpress website? My website: www.estapessoa.com Theme: Gallery from UpThemes Please visit my website, when you pass with your mouse over an image, you will see the post title below. I want to replace that (title) with a facebook share button. I already have the facebook code, only need help adding the code Please take a look at the code: <div id="post-<?php the_ID() ?>" <?php echo post_class($vidclass); ?>> <div class="entry-content"> <?php childtheme_post_header() ?> <a href="<?php echo the_permalink() ?>"> <span class="slide-title"><?php echo the_title(); ?></span> <?php $thumbnail = get_post_meta($post->ID, 'thumbnail', true); if( $thumbnail ): echo '<img class="attachment-thumbnail" src="' .get_post_meta($post->ID, 'thumbnail', true) . '" width="125" height="125" alt="' . get_the_title() .'" /></a>'; elseif( has_post_thumbnail() ): the_post_thumbnail('thumbnail'); else: echo '<img class="attachment-thumbnail" src="' . get_bloginfo('stylesheet_directory') . '/images/thumbnail-default.jpg" width="125" height="125" alt="' . get_the_title() .'" />'; endif; ?> </a> </div> </div><!-- .post --> Code (markup): This is the code line that makes the title appear: <span class="slide-title"><?php echo the_title(); ?></span> Code (markup): Can someone please help me? I tried to replaced with this: <span class="slide-title"><a name="fb_share"></a> <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"> </script></span> Code (markup): But didnt work... Also tried this wordpress plugin but got same problem: http://wordpress.org/extend/plugins/facebook-share-new/ Can someone please help me? Thank you!
Most of your problem is because the like button you are using is the wrong size. I didn't get it to show the button but it certainly showed the space it needs and seemed quite happy to have the javascript in there.
Try putting the javascript into the header section or somewhere outside the div: <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"> </script> </head> <body> <span class="slide-title"><a name="fb_share"></a></span> Code (markup): The only other thing I would say is, FaceBook plan to drop the share button in favour of the like button
You need to find a smaller like option and it'll work fine. However... when I used <div id="fb-root"></div><script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=155536651124160"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> Code (markup): <div class="fb-like" data-href="http://www.estapessoa.com/" data-send="true" data-layout="button_count" data-width="125" data-show-faces="false" data-colorscheme="dark"></div> Code (markup): I got this message According to http://forum.developers.facebook.net/viewtopic.php?id=70773 So that gives you something to be getting on with