| @@ 581-606 (lines=26) @@ | ||
| 578 | ||
| 579 | } |
|
| 580 | ||
| 581 | } elseif( $rule['value'] == 'top_level') { |
|
| 582 | ||
| 583 | // vars |
|
| 584 | $post_parent = $post->post_parent; |
|
| 585 | ||
| 586 | ||
| 587 | // override |
|
| 588 | if( $options['page_parent'] ) { |
|
| 589 | ||
| 590 | $post_parent = $options['page_parent']; |
|
| 591 | ||
| 592 | } |
|
| 593 | ||
| 594 | ||
| 595 | // compare |
|
| 596 | if( $rule['operator'] == "==" ) { |
|
| 597 | ||
| 598 | $match = ( $post_parent == 0 ); |
|
| 599 | ||
| 600 | } elseif( $rule['operator'] == "!=" ) { |
|
| 601 | ||
| 602 | $match = ( $post_parent != 0 ); |
|
| 603 | ||
| 604 | } |
|
| 605 | ||
| 606 | } elseif( $rule['value'] == 'parent' ) { |
|
| 607 | ||
| 608 | // get children |
|
| 609 | $children = get_pages(array( |
|
| @@ 626-651 (lines=26) @@ | ||
| 623 | ||
| 624 | } |
|
| 625 | ||
| 626 | } elseif( $rule['value'] == 'child') { |
|
| 627 | ||
| 628 | // vars |
|
| 629 | $post_parent = $post->post_parent; |
|
| 630 | ||
| 631 | ||
| 632 | // override |
|
| 633 | if( $options['page_parent'] ) { |
|
| 634 | ||
| 635 | $post_parent = $options['page_parent']; |
|
| 636 | ||
| 637 | } |
|
| 638 | ||
| 639 | ||
| 640 | // compare |
|
| 641 | if( $rule['operator'] == "==" ) { |
|
| 642 | ||
| 643 | $match = ( $post_parent != 0 ); |
|
| 644 | ||
| 645 | } elseif( $rule['operator'] == "!=" ) { |
|
| 646 | ||
| 647 | $match = ( $post_parent == 0 ); |
|
| 648 | ||
| 649 | } |
|
| 650 | ||
| 651 | } |
|
| 652 | ||
| 653 | ||
| 654 | // return |
|