ronoc_php Posted March 8, 2012 Share Posted March 8, 2012 So on my site i have a latest tweet section, Instead of the section coming up once its appearing twice, below is the code any help would be great : ) Thanks <div id="projectnewsrss"> <h3>LATEST TWEETS</h3> <?php $rss1 = fetch_feed("http://pipes.yahoo.com/pipes/pipe.run?_id=e3ec8c711bfd1ee1e13e5b483fb37786&_render=rss"); if (!is_wp_error( $rss1 ) ) : $maxitems1 = $rss1->get_item_quantity(10); $rss_items1 = $rss1->get_items(0, $maxitems1); endif; ?> <ul> <?php if ($maxitems1 == 0) echo '<li>There is currently no new tweets.</li>'; else foreach ( $rss_items1 as $item1 ) : ?> <li> <a href='<?php echo esc_url( $item1->get_permalink() ); ?>' title='<?php echo 'Posted '.$item1->get_date('j F Y | g:i a'); ?>'> <?php echo esc_html( $item1->get_title() ); ?></a> <span class="newsdate"><?php echo $item1->get_date('j F Y')?></span> </li> <?php endforeach; ?> </ul> </div> <?php endwhile; ?> Quote Link to comment https://forums.phpfreaks.com/topic/258519-apearing-twice/ Share on other sites More sharing options...
creata.physics Posted March 8, 2012 Share Posted March 8, 2012 I don't see the while loop begin but it certainly looks like you have on started somewhere because of this at the very end of your code: <?php endwhile; ?> So you have a foreach loop inside of a while loop which is why you are getting your results twice. Quote Link to comment https://forums.phpfreaks.com/topic/258519-apearing-twice/#findComment-1325164 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.