Ok, spent the last hour trying to get this to work and so far it’s just not.
According to the codex pages the “Loop” is between:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
and
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
I can see this code appear inside all 3 of the single.php, page.php & index.php files, so I added the code you provided to all 3 of them one at a time (starting with page.php, then added it to index.php and finally to single.php – each time reloading the homepage to see if any changes/errors appear, and yes I did clear the browser cache prior to each reload). As of yet no changes were made to the homepage.
I even completely replaced the following lines in index.php with your code:
<?php
if(is_home()||is_front_page()) echo '<div class="spacer"></div>';
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
after initially adding your code just below them, but it didn’t make any difference.
@srl_frontrange – if you’re still kickin’ about can you jump back in and explain exactly where you placed the code (which files and precisely where in each file you added it, as well as any changes you made – if any)?
@esmi – I appreciated your help but unfortunately it’s either not working on my site or I’m not following exactly what you’re saying. Until you mentioned it I had never heard of “the loop” before in this specific context. Could you maybe post or link me to an example of where the code should go (including the code that you’d expect to surround it)?
Thanks again,
LJ