WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Simple Facebook Connect Share Problem (3 posts)

  1. Mike11212
    Member
    Posted 4 years ago #

    Hello, I installed the Simple Facebook Connect and the Simple Twitter Connect.

    Both plugins allow you to share your comments with facebook or twitter when you post a comment. With STC i have no issues doing this, however SFC shares the wrong post.

    We have a list of post on the sidebar and according to the FAQ we probably wrote the code for it incorrectly.

    Could someone take a look at the code for me and tell me if its missing something.

    This is the code in the sidebar

    <ul>
    				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    					<?php $youtubevidid = get_post_meta($post->ID, 'youtubevidid', TRUE); ?>
    					<li id="post-<?php the_ID(); ?>">
    						<span class="video-thumb"><a href="<?php the_permalink() ?>"><img src="http://i2.ytimg.com/vi/<?php echo $youtubevidid; ?>/default.jpg" alt="<?php the_title(); ?>" / ></a></span>
    						<strong><a href="<?php the_permalink() ?>" rel="bookmark"><?php limit_title($post->post_title, 40); ?></a></strong><br />
    						<?php the_time('F jS, Y') ?>
    					</li>
    				<?php endwhile; else: ?>
    					<li>No Recent Videos</li>
    				<?php endif; ?>
    			</ul>

    This is the code in Functions.php

    <?php function limit_title($title, $n){
    if ( strlen ($title) > $n )
    {
    echo substr(the_title($before = '', $after = '', FALSE), 0, $n) . '…';
    }
    else { the_title(); }
    }
    ?>

    Thanks in advance!

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    Try adding wp_reset_query(); immediately after your sidebar Loop there.

  3. Mike11212
    Member
    Posted 4 years ago #

    Thank you sir taht fixed it, now we can go live with our new design!

Topic Closed

This topic has been closed to new replies.

About this Topic