WordPress.org

Ready to get started?Download WordPress

Forums

the_content is wrecking the loop? (3 posts)

  1. Rein Aris
    Member
    Posted 3 years ago #

    I never had this before (and using WordPress for more then 4 years now) but i think the_content is wrecking my loop!

    In my index.php i just run a simple loop, a default one, no strange things at all.

    But when i try to limit this loop to 2 posts per page with:
    query_posts('posts_per_page=2');
    it shows my first post twice and then it just loops on and on, so it doesn't listen to the query_posts.

    If i remove the_content(); from the loop it runs fine! When the_content is in there it goes wrong!

    I'm using WordPress 3.1.2 running as a multisite

  2. Mark Jaquith
    WordPress Lead Dev
    Posted 3 years ago #

    I don't know what's going on there, but you should probably use a better method of changing the posts per page. By doing it the way you're doing it, you're creating a second query.

    Try a plugin like this: http://wordpress.org/extend/plugins/cbnet-different-posts-per-page/

  3. Rein Aris
    Member
    Posted 3 years ago #

    Thanks for you answer Mark!

    I was a little bit complicated. Some plugin (Sexybookmarks) was calling the wp_title() within the loop while an other plugin (WordPress SEO) hooked an filter to the wp_title() which called wp_reset_query()...

    The whole thing was called by the_content because that called the apply_filters functions and on and on and on... :)
    So an investigation of two hour brought me to the problem, i reported the issue by both of the plugin programmers.

    Thanks anyway, problem solved!

Topic Closed

This topic has been closed to new replies.

About this Topic