@@ 465-483 (lines=19) @@ | ||
462 | // If post_id has changed, this is most likely an archive loop |
|
463 | if( $change == 'post_id' ) { |
|
464 | ||
465 | if( empty($_post_id) && $sub_exists ) { |
|
466 | ||
467 | // case: Change in $post_id was due to this being a nested loop and not specifying the $post_id |
|
468 | // action: move down one level into a new loop |
|
469 | $new_child_loop = true; |
|
470 | ||
471 | } elseif( $prev && $prev['post_id'] == $post_id ) { |
|
472 | ||
473 | // case: Change in $post_id was due to a nested loop ending |
|
474 | // action: move up one level through the loops |
|
475 | reset_rows(); |
|
476 | ||
477 | } else { |
|
478 | ||
479 | // case: Chang in $post_id is the most obvious, used in an WP_Query loop with multiple $post objects |
|
480 | // action: leave this current loop alone and create a new parent loop |
|
481 | $new_parent_loop = true; |
|
482 | ||
483 | } |
|
484 | ||
485 | } elseif( $change == 'selector' ) { |
|
486 | ||
@@ 487-505 (lines=19) @@ | ||
484 | ||
485 | } elseif( $change == 'selector' ) { |
|
486 | ||
487 | if( $prev && $prev['selector'] == $selector && $prev['post_id'] == $post_id ) { |
|
488 | ||
489 | // case: Change in $field_name was due to a nested loop ending |
|
490 | // action: move up one level through the loops |
|
491 | reset_rows(); |
|
492 | ||
493 | } elseif( $sub_exists ) { |
|
494 | ||
495 | // case: Change in $field_name was due to this being a nested loop |
|
496 | // action: move down one level into a new loop |
|
497 | $new_child_loop = true; |
|
498 | ||
499 | } else { |
|
500 | ||
501 | // case: Chang in $field_name is the most obvious, this is a new loop for a different field within the $post |
|
502 | // action: leave this current loop alone and create a new parent loop |
|
503 | $new_parent_loop = true; |
|
504 | ||
505 | } |
|
506 | ||
507 | } |
|
508 |