WordPress.org

Ready to get started?Download WordPress

Forums

How To Stop Sidebar Image Repeating & Duplicating (3 posts)

  1. 99nunkey
    Member
    Posted 7 years ago #

    Hey!

    I added an image to my Sidebar code (with image rotation script - not important) but the image repeats itself all the way down the sidebar...

    See what I mean, here:

    http://younginfopreneurs.com/home/

    I only want it to appear once at the top.

    I entered this code:

    <div><img src="http://www.younginfopreneurs.com/rotatingimages1/rotator.php" alt="Young Infopreneurs"></div>

    I put it in the Sidebar code so a sample of the code looks like this now:

    <?php
    endif;

    if ( function_exists('the_recent_links') ) :
    ?>

  2. <?php the_recent_links(); ?>
  3. <?php
    endif;

    global $wpdb;

    $link_cats = $wpdb->get_results("
    SELECT
    cat_id, cat_name, COUNT( link_id ) as num_links
    FROM
    $wpdb->linkcategories
    INNER JOIN
    $wpdb->links ON link_category = cat_id
    WHERE
    link_visible = 'Y'
    GROUP BY
    cat_id
    HAVING
    num_links > 0
    ORDER BY
    cat_name
    ");

    if ( $link_cats ) :
    foreach ( $link_cats as $link_cat )
    {
    ?>
    <div><img src="http://www.younginfopreneurs.com/rotatingimages1/rotator.php" alt="Young Infopreneurs"></div>

  4. <div class="widget">
    <h2><?php echo stripslashes($link_cat->cat_name); ?></h2>

      <?php wp_get_links($link_cat->cat_id); ?>

    <?php
    }
    endif;

    } # end no widgets
    ?>

    </div>
    </div><!-- #sidebar -->

    Is there a line you add to stop the image or file repeating?

    Thanks in advance!

    Scotty

  • Medizinische Abkuerzungen
    Member
    Posted 7 years ago #

    #1 Loop ( foreach...)?

    #2 <div class="widget"> misses </div>

    #3 popups?????

  • Denis de Bernardy
    Member
    Posted 7 years ago #

    put your code outside of the foreach loop

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags