Jump to content

Recommended Posts

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; ?>

Link to comment
https://forums.phpfreaks.com/topic/258519-apearing-twice/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/258519-apearing-twice/#findComment-1325164
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.