Well, how ’bout I say this (maybe it’ll help you a bit) – The Loop is actually pretty easy to understand. You can actually break it up too, if you need to do that. For example, the default way of presenting the Loop in your files is like so:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
blah blah stuff here
<?php endwhile; ?>
more stuff - usually "next" and "previous" links
<?php endif; ?>
You can break up that first section as needed:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : ?>
<?php the_post(); ?>
And place stuff in between. If you notice at the end, the “endif” and “endwhile” *are* broken up.
Basically, what that code says is:
<?php if (have_posts()) : ?> If wordpress detects a post has been created and published…
<?php while (have_posts()) : ?> then *while* we are talking about this one specific post…
‘<?php the_post(); ?>` then display that post like this…
…and that’s where all your formatting stuff comes in for the post. Once it reaches the end (`<?php endwhile; ?>’), if there’s *another* published post, it’ll “Loop” back through the layout (thus the name “the Loop”) again and again until it comes to a point where there is no more “if” to be seen. Then it’ll move on to the next line of code – which by default (but you can take it out) is the “next” and “previous” links – which will display at the end of ALL posts (because they are not *inside* that “endwhile” statement, but still located inside the “endif” statement)
Does this make sense to you?
So when you do a query, you have to do it *outside* the Loop, because the query statement basically says “before you start looping, this is the conditional you have to meet and look for”…and then it proceeds.
So basically you original code says:
<?php $wp_query->is_single = true; ?> – if this is a single-page (meaning a page in your site that holds only one post)
<?php if (function_exists('paged_comments_template')) paged_comments_template();– and if there is a function that says comments are spread across multiple pages, then do nothing.
else comments_template(); ?> But, if the comments *don’t* spread across multiple pages, then show the template for the comments.
Now, you can create a single.php file (there’s a default one in the default theme) that shows a single post with all the comments, plus the form to submit a comments. If your current theme doesn’t have this, you can make one. Just copy the default theme’s “single.php” file and edit it to suit your theme’s style. Then, anytime someone clicks on a post title, it’ll take them to the “single page” – with one post, comments listed, and a form to add new comments. That’s already built-in.
So the question is, are you trying to make the default *index* page do this? Show only one post at a time, with comments displayed? Or is this general info you need to know for when people click on the post title and want to see everything?
If ti’s the former, then you will need the loop – but the code you have is a little extraneous. If it’s for the latter, you don’t need this code at all – you just need to make yourself a single.php file which holds the layout of your site – easily made by looking at the default themes single.php file and looking at your index.php, then combining the two.