コード例 #1
0
							<ol class="items_list child_items">

								<?php 
            foreach ($children as $child_position => $item_data) {
                ?>

									<li class="item sub_item item_type_<?php 
                echo esc_attr($item_type);
                ?>
" data-id="<?php 
                echo (double) $child_position;
                ?>
">
										<?php 
                si_front_end_line_item($line_items[$child_position], $child_position, $prev_type, false);
                ?>
									</li>
									
									<?php 
                $prev_type = $item_type;
                ?>

								<?php 
            }
            ?>

							</ol>

						<?php 
        }
コード例 #2
0
function si_line_item_build($position = 0, $line_items = array(), $children = array())
{
    _deprecated_function(__FUNCTION__, '8.0', 'si_get_front_end_line_item()');
    $first_key_position = (int) current(array_keys($line_items));
    if (is_array($position)) {
        $position = (double) $position['key'];
    }
    $item_data = $line_items[$position];
    $prev_type = '';
    if (strpos($position, '.') !== false) {
        // child items don't get the header
        $prev_type = $item_data['type'];
    } elseif ((int) $position === $first_key_position) {
        // Don't add the header for the first line item since it was already added
        $prev_type = $item_data['type'];
    } elseif ($first_key_position < (int) $position) {
        // check to see what the previous line item was
        $prev_pos = (int) $position - 1;
        $prev_type = $line_items[$prev_pos]['type'];
    }
    $has_children = !empty($children) ? true : false;
    si_front_end_line_item($item_data, $position, $prev_type, $has_children);
}