WordPress.org

Ready to get started?Download WordPress

Forums

Main Post Loop Shows Latest Post Twice (4 posts)

  1. fatalx
    Member
    Posted 3 years ago #

    So im creating a theme with some plugins and I have a plugin that uses the is_home() code.

    when I use

    wp_query_reset();
    
    if(is_home())
    blah blah blah

    inside my plugin the latest post on my homepage appears twice. if I remore the wp_query_reset that duplicate post doesn't appear but then is_home doesn't work... What am I missing here can anyone help?

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    more info please:

    where does the latest post appear for the second time?
    what do you expect to show?

    link to the problem?

  3. fatalx
    Member
    Posted 3 years ago #

    hey,

    sorry I have no link its on a test bed. But the most recent post appears twice right after itself. haha sry if its confusing. Just imagine the default wordpress theme and the most recent post appearing on that two times at the top of the page.

  4. fatalx
    Member
    Posted 3 years ago #

    here is my loop

    <?php
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
      query_posts("cat=4&posts_per_page=10&paged=$paged");
     ?>
      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post<?php sticky_class(); ?>" id="post-<?php the_ID(); ?>" >
    <h1 class="mma"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
    <hr></hr>
    <h2 class="mma"><?php the_time('F jS, Y') ?> at <?php the_time('g:i') ?> EST - by <?php the_author()?></h2>
    <div class="resizer">
    
    <?php the_content('&nbsp;&nbsp;&nbsp;...Continue Reading'); ?>
    </div>
    <div class="floatright">
    <img src="<?php bloginfo('template_directory'); ?>/images/balloon.png" alt="Comment(s)" />
    <?php
    if (function_exists('Comment_Handler')) {
    	$vbridge = Comment_Handler($post->ID);
    	global $vbulletin;
    }
    
    if ($vbridge[id] > 0) {
    ?>
    <a style="text-align: right;" href='<?php echo get_option('vbb_VBURL') ?>/showthread.php?t=<?php echo $vbridge[id] ?>'><?php echo intval($vbridge[count]) ?> Comment(s)</a>
    <?php
    			}
    ?>
    </div>
    </div>
    <?php endwhile; ?>
    <?php else: ?>

    and here is my plugin code

    ...
    wp_reset_query();
    
    if(is_home())
    {
    return '<div id="'.$mediaspace.'">Please Refresh or Download <a href="http://get.adobe.com/flashplayer/" target="_blank">Adobe Flash Player</a></div>
            <script type="text/javascript">
            var so = new SWFObject("'.$swfplayer.'","'.$random.'","'.$width.'","'.$height.'","9","#ffffff");
            so.addParam("allowfullscreen","true");
            so.addParam("allowscriptaccess","always");
            so.addParam("wmode","opaque");
    		so.addVariable("screencolor","#000000");
            so.addVariable("file","'.$flvurl.'");
    		so.addVariable("skin","'.$swfskin.'");
            so.addVariable("type", "video");
    		so.write("'.$mediaspace.'");
    		</script>';
    }
    else
    {
    return '<div id="'.$mediaspace.'">Please Refresh or Download <a href="http://get.adobe.com/flashplayer/" target="_blank">Adobe Flash Player</a></div>
            <script type="text/javascript">
            var so = new SWFObject("'.$swfplayer.'","'.$random.'","'.$width.'","'.$height.'","9","#ffffff");
            so.addParam("allowfullscreen","true");
            so.addParam("allowscriptaccess","always");
            so.addParam("wmode","opaque");
    		so.addVariable("plugins", "ltas");
    		so.addVariable("ltas.cc", "code");
    		so.addVariable("screencolor","#000000");
            so.addVariable("file","'.$flvurl.'");
    		so.addVariable("skin","'.$swfskin.'");
            so.addVariable("type", "video");so.addVariable("screencolor","#000000");
    		so.write("'.$mediaspace.'");
    		</script>';
    }
    }

Topic Closed

This topic has been closed to new replies.

About this Topic