WordPress.org

Forums

Loop compatibility (4 posts)

  1. glaughton
    Member
    Posted 8 years ago #

    I have a theme which uses the old-style loop i.e.

    if ($posts) : foreach ($posts as $post) : start_wp();

    as opposed to the new-style loop i.e.

    if (have_posts()) : while (have_posts()) : the_post();

    Will this theme work with WP 2.1? or should I modify the loop code in the theme (is this easy?) or should I go back to old version of WP - I'm not sure when the loop code was altered)?

    Any help or advice would be greatly appreciated.

  2. moshu
    Member
    Posted 8 years ago #

    Since 1.5 the "new style" is in use.
    This might help to figure out where the Loop starts and ends:
    http://codex.wordpress.org/The_Loop

  3. glaughton
    Member
    Posted 8 years ago #

    OK, thanks. I guess I want to avoid modifying the loop in all the php files if possible. So the question is, will the old-style PHP loop code work with WP 2.1?

  4. moshu
    Member
    Posted 8 years ago #

    Good question. I guess nobody tested it yet. It worked up till the 2.0.x versions.

Topic Closed

This topic has been closed to new replies.

About this Topic