| 1 |
<?php |
| 2 |
/** |
| 3 |
* Portfolio Custom |
| 4 |
* |
| 5 |
* @var $attributes - attributes |
| 6 |
* @var $options - options |
| 7 |
* |
| 8 |
* @link https://codesupply.co |
| 9 |
* @since 1.0.0 |
| 10 |
* |
| 11 |
* @package Sight |
| 12 |
*/ |
| 13 |
|
| 14 |
$class_name = sight_portfolio_area_classes( $attributes, $options ); |
| 15 |
|
| 16 |
if ( $attributes['custom_images'] && count( $attributes['custom_images'] ) > $attributes['number_items'] ) { |
| 17 |
$attributes['custom_images'] = array_slice( $attributes['custom_images'], 0, $attributes['number_items'] ); |
| 18 |
} |
| 19 |
|
| 20 |
if ( $attributes['custom_images'] ) { |
| 21 |
?> |
| 22 |
<div class="<?php echo esc_attr( $class_name ); ?>"> |
| 23 |
|
| 24 |
<div class="sight-portfolio-area__outer"> |
| 25 |
<div class="sight-portfolio-area__main" <?php sight_portfolio_area_main_attrs( $attributes, $options ); ?>> |
| 26 |
<?php |
| 27 |
// Start the Loop. |
| 28 |
foreach ( $attributes['custom_images'] as $attachment_id ) { |
| 29 |
|
| 30 |
// Get item project. |
| 31 |
if ( wp_get_attachment_image( $attachment_id ) ) { |
| 32 |
|
| 33 |
$portfolio_entry = new Sight_Entry( $attributes, $options ); |
| 34 |
|
| 35 |
// Set settings. |
| 36 |
$portfolio_entry->attachment_id = $attachment_id; |
| 37 |
|
| 38 |
// Init portfolio entry. |
| 39 |
$portfolio_entry->init(); |
| 40 |
|
| 41 |
require apply_filters( 'sight_portfolio_item_path', SIGHT_PATH . 'render/handler/portfolio-entry.php', $attributes, $options, $portfolio_entry ); |
| 42 |
} |
| 43 |
} |
| 44 |
?> |
| 45 |
</div> |
| 46 |
</div> |
| 47 |
</div> |
| 48 |
<?php |
| 49 |
} else { |
| 50 |
require SIGHT_PATH . 'render/handler/post-area-none.php'; |
| 51 |
} |
| 52 |
|
| 53 |
wp_reset_postdata(); |
| 54 |
|