Loop displaying different posts
-
This is the php code of my index page
<?php query_posts('category_id=6&showposts=1'); ?> <?php $posts = get_posts('numberposts=1&offset=0'); foreach ($posts as $post) : start_wp(); ?> <?php static $count1 = 0; if ($count1 == "1") { break; } else { ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <?php echo get_the_image(array('Thumbnail','My Thumbnail'),'thumbnail'); ?> <?php the_excerpt(); ?> <?php $count1++; } ?> <?php endforeach; ?> <?php query_posts('category_id=6&showposts=5'); ?> <?php $posts = get_posts('numberposts=5&offset=2'); foreach ($posts as $post) : start_wp(); ?> <?php static $count2 = 0; if ($count2 == "5") { break; } else { ?> <?php echo get_the_image(array('Thumbnail','My Thumbnail'),'thumbnail'); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> <?php $count2++; } ?> <?php endforeach; ?> <?php query_posts($query_string . '&cat=-6'); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_category(', ') ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> <?php echo get_the_image(array('Thumbnail','My Thumbnail'),'thumbnail'); ?> <?php the_excerpt(); ?> Objavljeno: <?php the_time('d.m.Y, G:i'); ?> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">Ceo tekst »</a> <a href="<?php the_permalink() ?>#commenting" title="Komentari"><?php comments_number('0','1','%'); ?></a> <"clear1"> <!-- do stuff ... --> <?php endwhile; ?> <?php endif; ?>
This is the part of code that is causing problems
<?php query_posts('category_id=6&showposts=1'); ?> <?php $posts = get_posts('numberposts=1&offset=0'); foreach ($posts as $post) : start_wp(); ?> <?php static $count1 = 0; if ($count1 == "1") { break; } else { ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <?php echo get_the_image(array('Thumbnail','My Thumbnail'),'thumbnail'); ?> <?php the_excerpt(); ?> <?php $count1++; } ?> <?php endforeach; ?> <?php query_posts('category_id=6&showposts=5'); ?> <?php $posts = get_posts('numberposts=5&offset=2'); foreach ($posts as $post) : start_wp(); ?> <?php static $count2 = 0; if ($count2 == "5") { break; } else { ?> <?php echo get_the_image(array('Thumbnail','My Thumbnail'),'thumbnail'); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> <?php $count2++; } ?> <?php endforeach; ?>
On localhost it works fine. It’s shows 1 and 5 posts from category with id 6.
When i transfered this theme to my host and activated it, it shows posts from category with id 11.
How is that possible?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Loop displaying different posts’ is closed to new replies.