• Resolved ruls

    (@ruls)


    Well, so I installed Simple Facebook Connect and everything runned smooth until I commented on a post login with facebook connect and when the “share on facebook” window came up the article that was “sharing” was not the one I was commenting on but other one.

    After a lot of research in the plugin creator’s website, I found that the problem was caused by the Popular/Latest Widget that comes with my theme, so that the last article that shows up in the latest post list is the one that is appearing in the “sharing” window. Apparently this is bad coding of The Loop and Query stuff.

    So the author of the plugin said to come here to the wordpress forums to ask for help… please, forum gods of code, help this not so good for coding user get his blog on track.

    The code in the Latest Post Widget is:

    <ul>
    				<?php
    					$the_query = new WP_Query('cat=' . $ex_feat . '&showposts=10&orderby=post_date&order=desc');
    					while ($the_query->have_posts()) : $the_query->the_post(); $do_not_duplicate = $post->ID;
    				?>
    				<li>
    					<?php woo_get_image('image',35,35,'thumbnail',90,$post->ID,'src',1,0,'','',true,false,false); ?>
    					<a title="<?php _e('Permalink to ',woothemes); ?> <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
    					<div class="fix"></div>
    				</li>
    				<?php endwhile; ?>
    			</ul>

    The code of the Popular Widget, which is before the LatestPost one and becomes the one making the problem if I take down the other one:

    <?php
    $pop_posts = get_option('woo_popular_posts');
    if (empty($pop_posts) || $pop_posts < 1) $pop_posts = 5;
    $now = gmdate("Y-m-d H:i:s",time());
    $lastmonth = gmdate("Y-m-d H:i:s",gmmktime(date("H"), date("i"), date("s"), date("m")-24,date("d"),date("Y")));
    $popularposts = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'stammy' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' AND post_date < '$now' AND post_date > '$lastmonth' AND comment_status = 'open' GROUP BY $wpdb->comments.comment_post_ID ORDER BY stammy DESC LIMIT ".$pop_posts;
    $posts = $wpdb->get_results($popularposts);
    $popular = '';
    if($posts){
    	foreach($posts as $post){
    		$post_title = stripslashes($post->post_title);
    		$guid = get_permalink($post->ID);
    ?>
    		<li>
    			<?php
    				woo_get_image('image',35,35,'thumbnail',90,$post->ID,'src',1,0,'','',true,false,false);
    			?>
                <a href="<?php echo $guid; ?>" title="<?php echo $post_title; ?>"><?php echo $post_title; ?></a>
        		<div style="clear:both"></div>
    
            </li>
    <?php
    	}
    }
    ?>

    All help will be very much appreciated

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Try adding this after the extra loop you’re using:

    <?php wp_reset_query(); ?>

    That resets the query back to its proper operation.

    Thread Starter ruls

    (@ruls)

    you are awesome, it worked perfectly… thanks!!

    Thread Starter ruls

    (@ruls)

    Otto, sorry to bother you again but now I tried to instal the Simple Twitter Connect and when you click on the button to log in with twitter or to comment with twitter, it takes you to a blank page and that’s it.

    I went to check the one in your site and saw that it works perfectly (taking you to twitter and back).

    Do you know what could be the problem with the one in my site?

    Thanks for all your help

    Thread Starter ruls

    (@ruls)

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Well, obviously something is failing in your PHP, but without errors being turned on, I have no way to tell. Try turning on debug mode on your site. Just add define('WP_DEBUG', true); to your wp-config.php file, see if this makes it spit out an error message instead of nothingness.

    Thread Starter ruls

    (@ruls)

    Added the debug line to wp-config.php but nothing different happened.

    Any other ideas?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Nope. Sorry. Without getting some kind of error, I have no way to debug what the problem with your site is.

    Try disabling other plugins, perhaps one is interfering or something.

    The problem isn’t with the plugin, BTW. That particular piece of code is the simplest possible code. It just redirects to Twitter. Nothing special about it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Popular/Latest Widget problem with Simple Facebook Connect’ is closed to new replies.