Multiple Loops (yet again!)
-
Hi, I am having problems customising my theme to show the following on the front page (this is a two columned theme):
Main column: post(s) from all categories except one category “on the run” (ID 27)
Left column: post(s) from only the category “on the run” (ID 27)
I’ve been going around in circles looking in the codex and in the support forums — I’ve looked at using multiple loops, and using query_posts, but I just can’t seem to get this scenario to work! I’m good with html and css… but still getting to grips with php!
The code I have at the moment is:
Main Column:
`<?php
query_posts(‘cat=-27’);
?><div id=”post”>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
…the post…
<?php endwhile; else: ?>
<div id=”browsebubble”>Sorry, there seems to have been a problem. You have probably followed a link to an entry or category that no-longer or never existed!</div>
<?php endif; ?>
</div>`Left Column:
`<?php rewind_posts(); ?>
<?php
query_posts(‘cat=27’);
?><?php if (have_posts()) : while (have_posts()) : the_post(); ?>
…the post…
<?php endwhile; else: ?>
<div id=”browsebubble”>Sorry, there seems to have been a problem. You have probably followed a link to an entry or category that no-longer or never existed!</div>
<?php endif; ?>`Can anyone give me some basic pointers to get me going with this…? The problem with the code above: it displays properly on the home page, but when the links to the posts are clicked (the post titles) the link does not go to the posts page, it just reloads the homepage (even though the URL changes to the posts unique URL).
Thanks!
- The topic ‘Multiple Loops (yet again!)’ is closed to new replies.