• Resolved dijxtra

    (@dijxtra)


    I have a category template here: http://referendum-autoceste.hr/category/vijesti/ If you look at the source, first 4 <article> elements are inside div#content section#primary main#main, which is excellent. But then, the rest of the <article> elements show up *after* </main></section></div>. I looked into archive.php (that’s where category Loop is defined), and everything looks as expected: The Loop (<?php while ( have_posts() ) : the_post(); ?>) is inside <div><section><main>. But, when the page is rendered, first 4 <article> elements are inside those tags, and next 6 <article> elements are outside. That makes absolutely no sense.

    Moreover, if you click on “older posts” and go to page http://referendum-autoceste.hr/category/vijesti/page/2/, then everything is just fine! All 10 <article> elements are inside <div><section><main> and everything looks fine.

    I’m completely confused by this. How come the template works fine on page 2, but not on page 1? How do the <article> elements end up outside their parent tags? That just shouldn’t be possible. Has anybody every seen anything like this?

    Kind regards,
    Nikola

Viewing 3 replies - 1 through 3 (of 3 total)
  • If you add a new post to that category does it still break at 4 or does the break now happen on 5?

    My guess is that there is something that is conditional in the theme file that is prematurely closing a div in that 4th post that’s not being closed in the other posts. It’s a very rough guess to start troubleshooting.

    I might also set that 4th post to a draft to see if the issue persists with it out of the loop.

    If you determine it’s the fourth post no matter what that post is my next step would be to make sure that your theme or a plugin isn’t trying to inject or do something every 4th post. Again, these are just various troubleshooting steps I would take to try and narrow it down.

    Perhaps you could also post the code of the template file so we can see if anything there might be causing the issue.

    Thread Starter dijxtra

    (@dijxtra)

    Turns out that the fourth post had one </div> too much at the end of the post. And something (wordpress? browser?) nicely closed the children tags of that <div>. I removed the last </div> from the fourth post, and now everything is cool.

    James, thanks for your prompt response! You’re great!

    You are very welcome.

    It was probably your browser. Chrome is notorious for assuming what you meant in your markup and finishing it off for you if something is missing. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘The Loop: article leaking outside of div.section.main’ is closed to new replies.