don’t use query_posts() within a loop;
try to change this section to use ‘get_posts’ as well:
<?php
query_posts('category_name=gluten-free-living&showposts=-1'); while(have_posts()) : the_post();
?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
and add:
<?php wp_reset_postdata(); ?>
before line 93
<?php endwhile; ?>
Thread Starter
Shay
(@shaypessah)
It still duplicating: This is one of the div boxes, I have 7 of these, each with individual categories. I placed the “wp_reset_postdata90: ?> as well
Code: http://pastebin.com/ehkquwCA
please post the edited full code of the tempalte again using the pastebin http://pastebin.com/
I didn’t see 7 boxes in the first pastebin (?)
Thread Starter
Shay
(@shaypessah)
I only have 4 listed in the main code. I was making sure it worked properly before adding the other categories. I will add the 7 and repost
Thread Starter
Shay
(@shaypessah)
Here is the updated code with 6 categories (not seven, my apologies on the miscommunication)
http://pastebin.com/k7fqzbDS
the latest posted code does not repeat indefinitively – just as often as the number of posts per page setting.
what page is this template used for?
is it the index.php template?
because the seven blocks are within the main loop, they will be repeated for as many posts per page are set in the settings – reading.
—-
try to use at the start of the loop:
<?php while (have_posts()) : the_post(); ?>
<?php $count = 0; $temp = $posts; ?>
and at the end:
<?php wp_reset_postdata();
$posts = $temp; ?>
<?php endwhile; ?>
Thread Starter
Shay
(@shaypessah)
It is in the index page. I currently have the posts per page in the settings – reading area to 4.
I entered the information and its still repeating. I’m not sure if its an error elsewhere?
its still repeating
is it repeating 4 times or more ?
what else do you need to show in the index page?
there might be the need to pull your 7 blocks out of the loop.
(also keep in mind that index.php is used as the general template if the more specialized templates are not in the theme – see http://codex.wordpress.org/Template_Hierarchy )
Thread Starter
Shay
(@shaypessah)
Yes it is. I changed the reading to show 1 post and syndication feed 1 as well and now its posting the 6 containers but with the page-navigation (21 pages). How would I remove the blocks out of the loop? Would you recommend creating a static index page with the blocks?
Thread Starter
Shay
(@shaypessah)
This actually worked: http://pastebin.com/qXerQr9D
I removed the loop from the page.
Thank you so much for your help!!
Would you recommend creating a static index page with the blocks?
that would make sense – to create a page template with the code;
http://codex.wordpress.org/Pages#Page_Templates
http://codex.wordpress.org/Creating_a_Static_Front_Page