first commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio Entry
|
||||
*
|
||||
* @var $attributes - attributes
|
||||
* @var $options - options
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
?>
|
||||
<article <?php $portfolio_entry->item_class(); ?>>
|
||||
<div <?php $portfolio_entry->item_outer_class(); ?>>
|
||||
<?php
|
||||
$portfolio_entry->item_attachment();
|
||||
$portfolio_entry->item_content();
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio Categories
|
||||
*
|
||||
* @var $attributes - attributes
|
||||
* @var $options - options
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
$class_name = sight_portfolio_area_classes( $attributes, $options );
|
||||
|
||||
$categories = get_terms(
|
||||
array(
|
||||
'taxonomy' => 'sight-categories',
|
||||
'hide_empty' => false,
|
||||
'include' => isset( $attributes['categories_filter_ids'] ) ? $attributes['categories_filter_ids'] : '',
|
||||
'orderby' => isset( $attributes['categories_orderby'] ) ? $attributes['categories_orderby'] : 'name',
|
||||
'order' => isset( $attributes['categories_order'] ) ? $attributes['categories_order'] : 'ASC',
|
||||
'number' => isset( $attributes['number_items'] ) ? $attributes['number_items'] : null,
|
||||
)
|
||||
);
|
||||
|
||||
if ( $categories ) {
|
||||
?>
|
||||
<div class="<?php echo esc_attr( $class_name ); ?>">
|
||||
|
||||
<div class="sight-portfolio-area__outer">
|
||||
<div class="sight-portfolio-area__main" <?php sight_portfolio_area_main_attrs( $attributes, $options ); ?>>
|
||||
<?php
|
||||
// Start the Loop.
|
||||
foreach ( $categories as $category ) {
|
||||
|
||||
$attachment_id = get_term_meta( $category->term_id, 'sight_featured_image', true );
|
||||
|
||||
// Get item project.
|
||||
if ( wp_get_attachment_image( $attachment_id ) ) {
|
||||
|
||||
$portfolio_entry = new Sight_Entry( $attributes, $options );
|
||||
|
||||
// Set settings.
|
||||
$portfolio_entry->object_id = $category->term_id;
|
||||
$portfolio_entry->attachment_id = $attachment_id;
|
||||
|
||||
// Init portfolio entry.
|
||||
$portfolio_entry->init();
|
||||
|
||||
require apply_filters( 'sight_portfolio_item_path', SIGHT_PATH . 'render/handler/portfolio-entry.php', $attributes, $options, $portfolio_entry );
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
require SIGHT_PATH . 'render/handler/post-area-none.php';
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio Custom
|
||||
*
|
||||
* @var $attributes - attributes
|
||||
* @var $options - options
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
$class_name = sight_portfolio_area_classes( $attributes, $options );
|
||||
|
||||
if ( $attributes['custom_images'] && count( $attributes['custom_images'] ) > $attributes['number_items'] ) {
|
||||
$attributes['custom_images'] = array_slice( $attributes['custom_images'], 0, $attributes['number_items'] );
|
||||
}
|
||||
|
||||
if ( $attributes['custom_images'] ) {
|
||||
?>
|
||||
<div class="<?php echo esc_attr( $class_name ); ?>">
|
||||
|
||||
<div class="sight-portfolio-area__outer">
|
||||
<div class="sight-portfolio-area__main" <?php sight_portfolio_area_main_attrs( $attributes, $options ); ?>>
|
||||
<?php
|
||||
// Start the Loop.
|
||||
foreach ( $attributes['custom_images'] as $attachment_id ) {
|
||||
|
||||
// Get item project.
|
||||
if ( wp_get_attachment_image( $attachment_id ) ) {
|
||||
|
||||
$portfolio_entry = new Sight_Entry( $attributes, $options );
|
||||
|
||||
// Set settings.
|
||||
$portfolio_entry->attachment_id = $attachment_id;
|
||||
|
||||
// Init portfolio entry.
|
||||
$portfolio_entry->init();
|
||||
|
||||
require apply_filters( 'sight_portfolio_item_path', SIGHT_PATH . 'render/handler/portfolio-entry.php', $attributes, $options, $portfolio_entry );
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
require SIGHT_PATH . 'render/handler/post-area-none.php';
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Sight block template
|
||||
*
|
||||
* @var $attributes - attributes
|
||||
* @var $options - options
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
switch ( $attributes['source'] ) {
|
||||
case 'projects':
|
||||
require SIGHT_PATH . 'render/handler/post-area-projects.php';
|
||||
break;
|
||||
case 'categories':
|
||||
require SIGHT_PATH . 'render/handler/post-area-categories.php';
|
||||
break;
|
||||
case 'post':
|
||||
require SIGHT_PATH . 'render/handler/post-area-post.php';
|
||||
break;
|
||||
case 'custom':
|
||||
require SIGHT_PATH . 'render/handler/post-area-custom.php';
|
||||
break;
|
||||
default:
|
||||
require SIGHT_PATH . 'render/handler/post-area-none.php';
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio None
|
||||
*
|
||||
* @var $attributes - attributes
|
||||
* @var $options - options
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div class="sight-content-not-found">
|
||||
<p><?php esc_html_e( 'It looks like your portfolio is empty. Please add new projects to your portfolio.', 'sight' ); ?></p>
|
||||
</div>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio Post
|
||||
*
|
||||
* @var $attributes - attributes
|
||||
* @var $options - options
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
$class_name = sight_portfolio_area_classes( $attributes, $options );
|
||||
|
||||
if ( $attributes['custom_post'] ) {
|
||||
$attachments = get_attached_media( 'image', $attributes['custom_post'] );
|
||||
|
||||
if ( $attachments && count( $attachments ) > $attributes['number_items'] ) {
|
||||
$attachments = array_slice( $attachments, 0, $attributes['number_items'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $attachments ) && $attachments ) {
|
||||
?>
|
||||
<div class="<?php echo esc_attr( $class_name ); ?>">
|
||||
|
||||
<div class="sight-portfolio-area__outer">
|
||||
<div class="sight-portfolio-area__main" <?php sight_portfolio_area_main_attrs( $attributes, $options ); ?>>
|
||||
<?php
|
||||
// Start the Loop.
|
||||
foreach ( $attachments as $attachment ) {
|
||||
|
||||
// Get item project.
|
||||
if ( wp_get_attachment_image( $attachment->ID ) ) {
|
||||
|
||||
$portfolio_entry = new Sight_Entry( $attributes, $options );
|
||||
|
||||
// Set settings.
|
||||
$portfolio_entry->attachment_id = $attachment->ID;
|
||||
|
||||
// Init portfolio entry.
|
||||
$portfolio_entry->init();
|
||||
|
||||
require apply_filters( 'sight_portfolio_item_path', SIGHT_PATH . 'render/handler/portfolio-entry.php', $attributes, $options, $portfolio_entry );
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
require SIGHT_PATH . 'render/handler/post-area-none.php';
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio Projects
|
||||
*
|
||||
* @var $attributes - attributes
|
||||
* @var $options - options
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
$class_name = sight_portfolio_area_classes( $attributes, $options );
|
||||
|
||||
// Args Query.
|
||||
$args_query = array(
|
||||
'post_type' => $attributes['projects_filter_post_type'],
|
||||
'ignore_sticky_posts' => true,
|
||||
'posts_per_page' => $attributes['number_items'],
|
||||
);
|
||||
|
||||
// Filter Categories.
|
||||
if ( 'sight-projects' === $attributes['projects_filter_post_type'] ) {
|
||||
|
||||
if ( isset( $attributes['projects_filter_categories'] ) ) {
|
||||
$filter_categories = $attributes['projects_filter_categories'];
|
||||
|
||||
if ( $filter_categories ) {
|
||||
$args_query['tax_query'][] = array(
|
||||
'taxonomy' => 'sight-categories',
|
||||
'field' => 'id',
|
||||
'terms' => $filter_categories,
|
||||
);
|
||||
|
||||
$args_query['tax_query']['relation'] = 'OR';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Filter Offset.
|
||||
if ( isset( $attributes['projects_filter_offset'] ) ) {
|
||||
$args_query['offset'] = (int) $attributes['projects_filter_offset'];
|
||||
}
|
||||
|
||||
// Filter Orderby.
|
||||
if ( $attributes['projects_orderby'] ) {
|
||||
$type_post_views = sight_post_views_enabled();
|
||||
// Order by Views.
|
||||
if ( $type_post_views && 'views' === $attributes['projects_orderby'] ) {
|
||||
$args_query['orderby'] = $type_post_views;
|
||||
// Don't hide posts without views.
|
||||
$args_query['views_query']['hide_empty'] = false;
|
||||
|
||||
} else {
|
||||
$args_query['orderby'] = $attributes['projects_orderby'];
|
||||
}
|
||||
}
|
||||
|
||||
// Filter Order.
|
||||
if ( $attributes['projects_order'] ) {
|
||||
$args_query['order'] = $attributes['projects_order'];
|
||||
}
|
||||
|
||||
/** ---------------------------------- */
|
||||
/** ---------------------------------- */
|
||||
|
||||
// WP Query.
|
||||
$portfolio_list = new WP_Query( $args_query );
|
||||
|
||||
// WP Query Data.
|
||||
if ( isset( $options['pagination_type'] ) ) {
|
||||
$portfolio_list->pagination_type = $options['pagination_type'];
|
||||
} else {
|
||||
$portfolio_list->pagination_type = 'none';
|
||||
}
|
||||
|
||||
// Theme data.
|
||||
$data = array(
|
||||
'is_sight_query' => true,
|
||||
'max_num_pages' => $portfolio_list->max_num_pages,
|
||||
'pagination_type' => $portfolio_list->pagination_type,
|
||||
'query_vars' => $portfolio_list->query,
|
||||
);
|
||||
|
||||
$args = sight_portfolio_get_load_more_args( $data, $attributes, $options );
|
||||
|
||||
// Set posts per page.
|
||||
$args['posts_per_page'] = $args_query['posts_per_page'];
|
||||
|
||||
$query_data = sight_encode_data( $args );
|
||||
|
||||
if ( $portfolio_list->have_posts() ) {
|
||||
?>
|
||||
<div class="<?php echo esc_attr( $class_name ); ?>" data-items-area="<?php echo esc_attr( $query_data ); ?>">
|
||||
|
||||
<?php if ( isset( $options['filter_items'] ) && $options['filter_items'] ) { ?>
|
||||
<div class="sight-portfolio-area-filter">
|
||||
<div class="sight-portfolio-area-filter__title"><?php esc_html_e( 'Categories', 'sight' ); ?></div>
|
||||
|
||||
<ul class="sight-portfolio-area-filter__list">
|
||||
|
||||
<li class="sight-portfolio-area-filter__list-item sight-filter-all sight-filter-active">
|
||||
<a href="#" data-filter="*">
|
||||
<?php esc_html_e( 'All', 'sight' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
$categories = get_terms(
|
||||
array(
|
||||
'taxonomy' => 'sight-categories',
|
||||
'hide_empty' => false,
|
||||
'include' => isset( $filter_categories ) && $filter_categories ? $filter_categories : array(),
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $categories as $category ) {
|
||||
?>
|
||||
<li class="sight-portfolio-area-filter__list-item">
|
||||
<a href="#" data-filter="<?php echo esc_attr( $category->slug ); ?>">
|
||||
<?php echo esc_html( $category->name ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="sight-portfolio-area__outer">
|
||||
<div class="sight-portfolio-area__main" <?php sight_portfolio_area_main_attrs( $attributes, $options ); ?>>
|
||||
<?php
|
||||
// Start the Loop.
|
||||
while ( $portfolio_list->have_posts() ) {
|
||||
$portfolio_list->the_post();
|
||||
|
||||
$portfolio_entry = new Sight_Entry( $attributes, $options );
|
||||
|
||||
// Init portfolio entry.
|
||||
$portfolio_entry->init();
|
||||
|
||||
// Get item project.
|
||||
require apply_filters( 'sight_portfolio_item_path', SIGHT_PATH . 'render/handler/portfolio-entry.php', $attributes, $options, $portfolio_entry );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
require SIGHT_PATH . 'render/handler/post-area-none.php';
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
Reference in New Issue
Block a user