WordPress.org

Ready to get started?Download WordPress

Forums

Facebook Like (Excerpt as Thumbnail) (3 posts)

  1. Anton2k
    Member
    Posted 2 years ago #

    Hi guys this is my first post, be nice.

    Ok, So on my wordpress site (my home page) I have a list of posts, I don't know the correct term given to a list of posts so for now I will refer to them as a list of posts.

    On each of my posts in the list I have a facebook "Like" button. Here is the code for that like button.

    <iframe align="right" src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&
    width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:24px;"></iframe>

    Now when I click this "Like" button on any of my listed posts it works fine, it posts to my facebook wall. The problem is that it is posting the wrong thumbnail to my facebook wall. For some weird reason it is posting a random image from my site to the wall. Is there any noob friendly approach to fix this? iv seen many different solutions on google but was not able to follow them as i have limited php knowledge and I would prefer to not use plugins.

    Here is what my index.php files looks like.

    <?php get_header(); ?>
    <div id="wrapper">
        <div id="contentwrapper">
        	<div id="content">
    			<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <div id="item">
    
                <!-- FACEBOOK LIKE BUTTON CODE -->
    <iframe align="right" src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&
    width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:24px;"></iframe>
    			<!-- FACEBOOK LIKE BUTTON CODE -->
    
                	<div id="covershot"><a href="<?php the_permalink() ?>" class="thetip" Title="<?php the_title() ?> :: Click here to view this video"><?php the_excerpt(); ?></a></div>
                    <div id="post-title"><a href="<?php the_permalink() ?>"><h3><?php the_title() ?></h3></a></div>
                    <div id="description"><p><?php the_content_rss('', TRUE, '', 50); ?></p></div>
                  	  <div id="meta">
                    	<div id="ratings"><?php the_tags(); ?><?php if(function_exists('the_ratings')) { the_ratings(); } ?></div>
                        <div id="commentslink" align="right"><a href="<?php comments_link(); ?>">Comments (<?php comments_number('0', '1', '%'); ?>)</a></div>
                      </div>
                   </div>
    			<?php endwhile; ?>
                <?php else : ?>
                <div id="item">
                	<h3>No matching results</h3>
                    <p>You seem to have found a mis-linked page or search query with no associated results. Please trying your search again. If you feel that you should be staring at something a little more concrete, feel free to email the author of this site or browse the archives.</p>
                </div>
                <?php endif; ?>
                <div id="pagination">
                	<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
                </div>
            </div>
            <?php get_sidebar(); ?>
        </div>
    </div>
    <?php get_footer(); ?>

    Please note I am not trying to get the "Like" button working on each individual post in the list of posts that appear on my home page (not inside a single post like most people) And again I want to stress that it is the posts excerpts in my lists of posts that i want to use as my facebook like thumb nails, If that makes sense. Its kinda hard to explain.

    Thanks For Reading.
    Best Regards, Antony J Lawlor.

    P.s. I said I have a limited php knowledge but if you have a php/any other language solution please post it, any thing is worth a try at this point.

  2. vbcommunication
    Member
    Posted 2 years ago #

    hi did you find a solution ?

  3. vbcommunication
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic