2012-08-27 74 views
0

我需要一些幫助來解決這個問題,但目前,當我在Wordpress網站的Manhusay主題上發佈帖子時,它會重複3次並替換其他帖子。該網站是www.pcrmj.com。如果有人有任何建議或糾正方法,這裏是目前在那裏的腳本。在Wordpress主題和縮略圖上不重複發佈

<?php get_header(); ?> 

<div id="content"> 

    <div class="postgroup"> 
     <?php for($i=1;$i<4;$i++) : ?> 
     <?php 
      $latest = get_option('mahusay_category_' . $i); 
      $latcat = (empty($latest)) ? 1 : get_category_by_slug($latest); 
      query_posts('showposts=1&cat='.$latcat->cat_ID); 
     ?> 

     <?php while (have_posts()) : the_post(); ?> 
     <div class="post indexpost" id="post-<?php the_ID(); ?>"> 
      <?php 
       $customfields = get_post_custom(); 
       $scrp = get_bloginfo('wpurl') . '/tt-scripts/timthumb.php?'; 
       if (empty($customfields['paddimage'][0])) { 
        $imgpath = $scrp . 'src=' . get_bloginfo('wpurl') . '/wp-content/themes/mahusay/images/thumbnail.png' . '&amp;w=125&amp;h=125&amp;zc=1'; 
       } else { 
        $imgpath = $scrp . 'src=' . get_bloginfo('wpurl') . $customfields['paddimage'][0] . '&amp;w=125&amp;h=125&amp;zc=1'; 
       } 
      ?> 
      <div class="title"> 
       <p> 
        <span class="date"><?php the_time('F j, Y'); ?></span> 
        <span class="nodisplay">|</span> 
        <span class="comments"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></span> 
        <span class="nodisplay">|</span> 
        <span class="categories"><?php echo $latcat->cat_name; ?></span> 
       </p> 
      </div> 
      <img class="header" src="<?php echo $imgpath; ?>" alt="<?php the_title(); ?>" /> 
      <div class="entry"> 
       <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> 
       <?php themefunction_content(400,'');?> 
      </div> 
     </div> 
     <?php endwhile; ?> 
     <?php endfor; ?> 
    </div> 


    <div class="extra"> 
     <div class="box box-popular"> 
      <h2>Popular</h2> 
      <div class="interior"> 
       <ul> 
       <?php akpc_most_popular(5,'<li><span>','</span></li>'); ?> 
       </ul> 
      </div> 
     </div> 
     <div class="box box-recent"> 
      <h2>Recent</h2> 
      <div class="interior"> 
       <?php themefunction_recent_post(); ?> 
      </div> 
     </div> 
     <div class="clearer"></div> 
    </div> 

</div> 

<?php get_sidebar(); ?> 
<?php get_footer(); ?> 

另外,Thumbnail.png沒有出現。如果任何人都可以提供幫助,那會很棒。

回答

0

首先要做的是以下行後...

<?php endfor; ?> 

添加...

<?php wp_reset_query(); ?> 

這將重置查詢回到了該頁面查詢應該和意志停止任何影響頁面上其他循環的query_posts函數。

+0

我試過了,它沒有工作....你有任何其他的建議嗎?它仍然在循環。 – Jen

相關問題