| 1 |
<?php |
| 2 |
/** |
| 3 |
* Portfolio Post |
| 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_post'] ) { |
| 17 |
$attachments = get_attached_media( 'image', $attributes['custom_post'] ); |
| 18 |
|
| 19 |
if ( $attachments && count( $attachments ) > $attributes['number_items'] ) { |
| 20 |
$attachments = array_slice( $attachments, 0, $attributes['number_items'] ); |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
if ( isset( $attachments ) && $attachments ) { |
| 25 |
?> |
| 26 |
<div class="<?php echo esc_attr( $class_name ); ?>"> |
| 27 |
|
| 28 |
<div class="sight-portfolio-area__outer"> |
| 29 |
<div class="sight-portfolio-area__main" <?php sight_portfolio_area_main_attrs( $attributes, $options ); ?>> |
| 30 |
<?php |
| 31 |
// Start the Loop. |
| 32 |
foreach ( $attachments as $attachment ) { |
| 33 |
|
| 34 |
// Get item project. |
| 35 |
if ( wp_get_attachment_image( $attachment->ID ) ) { |
| 36 |
|
| 37 |
$portfolio_entry = new Sight_Entry( $attributes, $options ); |
| 38 |
|
| 39 |
// Set settings. |
| 40 |
$portfolio_entry->attachment_id = $attachment->ID; |
| 41 |
|
| 42 |
// Init portfolio entry. |
| 43 |
$portfolio_entry->init(); |
| 44 |
|
| 45 |
require apply_filters( 'sight_portfolio_item_path', SIGHT_PATH . 'render/handler/portfolio-entry.php', $attributes, $options, $portfolio_entry ); |
| 46 |
} |
| 47 |
} |
| 48 |
?> |
| 49 |
</div> |
| 50 |
</div> |
| 51 |
</div> |
| 52 |
<?php |
| 53 |
} else { |
| 54 |
require SIGHT_PATH . 'render/handler/post-area-none.php'; |
| 55 |
} |
| 56 |
|
| 57 |
wp_reset_postdata(); |
| 58 |
|