first commit
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
=== Sight – Professional Image Gallery and Portfolio ===
|
||||
Tags: portfolio, gallery, image, projects, responsive
|
||||
Requires at least: 4.0
|
||||
Tested up to: 6.0
|
||||
Requires PHP: 5.4
|
||||
Stable tag: 1.0.8
|
||||
Contributors: codesupplyco
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
== Description ==
|
||||
|
||||
**Introducing Sight — a fast & simple way to create professional looking portfolios and neatly stunning image and video galleries — all with zero coding knowledge**
|
||||
|
||||
Whether you're a photographer, designer, or creative agency looking for a fast and easy plugin to create portfolios and unlimited image and video galleries — Sight is designed for you.
|
||||
|
||||
Create clean unlimited HD image and video product galleries with a simple dashboard to transform your or your client's business. Create sleek professional-looking portfolios that simply amaze clients to secure better and more leads. _All while without ever messing with complex codes._
|
||||
|
||||
Wondering how Sight is a better help for you?
|
||||
|
||||
Have a look at the prominent features:
|
||||
|
||||
**Fast Loading** — With a faster loading site, win over your competition and make your visitors stay on your website.
|
||||
|
||||
**Adaptable with Every Device** — Sight is fully adaptable with all devices; desktops, mobiles, tabs — and allows you to choose how you want your website to look on each device.
|
||||
|
||||
**Elementor and Gutenberg Support** — With Sight , you have the freedom to creatively customize your website the way you want.
|
||||
|
||||
**Fully SEO-Friendly** — Get faster and higher rankings with Sight.
|
||||
|
||||
**Easily Customizable** — If you can send an email, you can customize with Sight — it's that easy.
|
||||
|
||||
**Simple Fast Dashboard** — Fast and simple dashboard with easy controls settings that help you seamlessly customize your portfolio or gallery.
|
||||
|
||||
**Video Support** — Showcase stunning videos of your work with the world by embedding YouTube or local videos.
|
||||
|
||||
**Lightbox Effect** — Illustrate your product or work images using lightbox effect. Fully customize the size and width and other settings to showcase your photos however you want.
|
||||
|
||||
**Multiple Color Combinations** — Alter colors of headings, captions, or hover over. Give your personal brand or enterprise a unique brandish look with a custom color layout.
|
||||
|
||||
**Multiple Column Layout** — Create galleries of your work in Grid or Justified layout that suits your products or services perfectly.
|
||||
|
||||
**Typography Settings** — Add headings, captions, and choose different sizes and colors to perfectly match your brand's voice.
|
||||
|
||||
**Query Settings** — Fine-tune your gallery through filters like post types, categories, date published, ascending or descending order. Help clients and visitors easily discover exactly what they're looking for, fast and easy.
|
||||
|
||||
**Portfolio Post Type** — Publish your amazing portfolio posts in a single categorized portfolio post type so that clients can easily discover your awesome work.
|
||||
|
||||
...And, plenty of more exciting and useful stuff is coming to every next update.
|
||||
|
||||
Sight isn't just a plugin — it's designed to work with you as a partner to help you easily and professionally showcase your stunning work, get more eyeballs, secure more leads, and win more business.
|
||||
|
||||
Get Sight now to supercharge your professional work.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.0.8 =
|
||||
* Optimized JS\CSS files
|
||||
|
||||
= 1.0.7 =
|
||||
* Added compatibility with WordPress 5.9
|
||||
|
||||
= 1.0.6 =
|
||||
* Fixed Offset Settings.
|
||||
|
||||
= 1.0.5 =
|
||||
* Improved Video Background.
|
||||
|
||||
= 1.0.4 =
|
||||
* Improved Video Settings.
|
||||
|
||||
= 1.0.3 =
|
||||
* Improved thumbnail overlay.
|
||||
|
||||
= 1.0.2 =
|
||||
* Improved plugin security.
|
||||
|
||||
= 1.0.1 =
|
||||
* Added support view more in thumbnail.
|
||||
|
||||
= 1.0.0 =
|
||||
* Initial release.
|
||||
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
/**
|
||||
* Block Renderer REST API.
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
/**
|
||||
* Controller which provides REST endpoint for rendering a block.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @see WP_REST_Controller
|
||||
*/
|
||||
class Sight_Rest_Block_Renderer_Controller extends WP_REST_Controller {
|
||||
|
||||
/**
|
||||
* Constructs the controller.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->namespace = 'wp/v2';
|
||||
$this->rest_base = 'sight-renderer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the necessary REST API routes, one for each dynamic block.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function register_routes() {
|
||||
$block_types = WP_Block_Type_Registry::get_instance()->get_all_registered();
|
||||
|
||||
foreach ( $block_types as $block_type ) {
|
||||
if ( ! $block_type->is_dynamic() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
register_rest_route(
|
||||
$this->namespace,
|
||||
'/' . $this->rest_base . '/(?P<name>' . $block_type->name . ')',
|
||||
array(
|
||||
'args' => array(
|
||||
'name' => array(
|
||||
'description' => __( 'Unique registered name for the block.' ),
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'get_item' ),
|
||||
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
||||
'attributes' => array(
|
||||
/* translators: %s is the name of the block */
|
||||
'description' => sprintf( __( 'Attributes for %s block' ), $block_type->name ),
|
||||
'type' => 'object',
|
||||
'additionalProperties' => false,
|
||||
'properties' => $block_type->get_attributes(),
|
||||
'default' => array(),
|
||||
),
|
||||
'post_id' => array(
|
||||
'description' => __( 'ID of the post context.' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given request has access to read blocks.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param WP_REST_Request $request Request.
|
||||
* @return true|WP_Error True if the request has read access, WP_Error object otherwise.
|
||||
*/
|
||||
public function get_item_permissions_check( $request ) {
|
||||
global $post;
|
||||
|
||||
$post_id = isset( $request['post_id'] ) ? intval( $request['post_id'] ) : 0;
|
||||
|
||||
if ( 0 < $post_id ) {
|
||||
$post = get_post( $post_id );
|
||||
|
||||
if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
|
||||
return new WP_Error(
|
||||
'block_cannot_read',
|
||||
__( 'Sorry, you are not allowed to read blocks of this post.' ),
|
||||
array(
|
||||
'status' => rest_authorization_required_code(),
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ( ! current_user_can( 'edit_posts' ) ) {
|
||||
return new WP_Error(
|
||||
'block_cannot_read',
|
||||
__( 'Sorry, you are not allowed to read blocks as this user.' ),
|
||||
array(
|
||||
'status' => rest_authorization_required_code(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns block output from block's registered render_callback.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
global $post;
|
||||
|
||||
$post_id = isset( $request['post_id'] ) ? intval( $request['post_id'] ) : 0;
|
||||
|
||||
if ( 0 < $post_id ) {
|
||||
$post = get_post( $post_id );
|
||||
|
||||
// Set up postdata since this will be needed if post_id was set.
|
||||
setup_postdata( $post );
|
||||
}
|
||||
$registry = WP_Block_Type_Registry::get_instance();
|
||||
$block = $registry->get_registered( $request['name'] );
|
||||
|
||||
if ( null === $block ) {
|
||||
return new WP_Error(
|
||||
'block_invalid',
|
||||
__( 'Invalid block.' ),
|
||||
array(
|
||||
'status' => 404,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'rendered' => $block->render( $request->get_param( 'attributes' ) ),
|
||||
);
|
||||
return rest_ensure_response( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves block's output schema, conforming to JSON Schema.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return array Item schema data.
|
||||
*/
|
||||
public function get_item_schema() {
|
||||
return array(
|
||||
'$schema' => 'http://json-schema.org/schema#',
|
||||
'title' => 'rendered-block',
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'rendered' => array(
|
||||
'description' => __( 'The rendered block.' ),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'context' => array( 'edit' ),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
add_action(
|
||||
'rest_api_init', function() {
|
||||
// Block Renderer.
|
||||
$controller = new Sight_Rest_Block_Renderer_Controller();
|
||||
|
||||
$controller->register_routes();
|
||||
}, 99
|
||||
);
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* Utils Is Field Visible.
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class Utils Is Field Visible.
|
||||
*/
|
||||
class Sight_Utils_Is_Field_Visible {
|
||||
/**
|
||||
* Compare 2 values
|
||||
*
|
||||
* @param mixed $lval Left value.
|
||||
* @param string $operator Operator.
|
||||
* @param mixed $rval Right value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function compare( $lval, $operator, $rval ) {
|
||||
$check_result = true;
|
||||
|
||||
switch ( $operator ) {
|
||||
case '==':
|
||||
$check_result = $lval == $rval;
|
||||
break;
|
||||
case '===':
|
||||
$check_result = $lval === $rval;
|
||||
break;
|
||||
case '!=':
|
||||
$check_result = $lval != $rval;
|
||||
break;
|
||||
case '!==':
|
||||
$check_result = $lval !== $rval;
|
||||
break;
|
||||
case '>=':
|
||||
$check_result = $lval >= $rval;
|
||||
break;
|
||||
case '<=':
|
||||
$check_result = $lval <= $rval;
|
||||
break;
|
||||
case '>':
|
||||
$check_result = $lval > $rval;
|
||||
break;
|
||||
case '<':
|
||||
$check_result = $lval < $rval;
|
||||
break;
|
||||
case 'AND':
|
||||
$check_result = $lval && $rval;
|
||||
break;
|
||||
case 'OR':
|
||||
$check_result = $lval || $rval;
|
||||
break;
|
||||
default:
|
||||
$check_result = $lval;
|
||||
break;
|
||||
}
|
||||
|
||||
return $check_result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check condition
|
||||
*
|
||||
* @param array $conditions - Conditions array.
|
||||
* @param array $attributes - Available block attributes.
|
||||
* @param string $relation - Can be one of 'AND' or 'OR'.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function check_condition( $conditions, $attributes, $relation ) {
|
||||
$child_relation = ( 'AND' === $relation ) ? 'OR' : 'AND';
|
||||
|
||||
// By default result will be TRUE for relation AND and FALSE for relation OR.
|
||||
$result = 'AND' === $relation;
|
||||
|
||||
foreach ( $conditions as $data ) {
|
||||
if ( is_array( $data ) && ! isset( $data['field'] ) ) {
|
||||
$result = self::compare( $result, $relation, self::check_condition( $data, $attributes, $child_relation ) );
|
||||
} elseif ( isset( $data['field'] ) ) {
|
||||
$split_val_name = explode( '.', $data['field'] );
|
||||
$field_val = null;
|
||||
|
||||
// Check for array values like: toggleListName['option1'].
|
||||
if ( 2 === count( $split_val_name ) && isset( $attributes[ $split_val_name[0] ] ) && isset( $attributes[ $split_val_name[0] ][ $split_val_name[1] ] ) ) {
|
||||
$field_val = $attributes[ $split_val_name[0] ][ $split_val_name[1] ];
|
||||
}
|
||||
|
||||
// Check for normal values.
|
||||
if ( null === $field_val && isset( $attributes[ $data['field'] ] ) ) {
|
||||
$field_val = $attributes[ $data['field'] ];
|
||||
}
|
||||
|
||||
// Check count.
|
||||
if ( isset( $data['count'] ) ) {
|
||||
$count = explode( $data['count'], $field_val );
|
||||
$field_val = count( $count ) - 1;
|
||||
}
|
||||
|
||||
if ( null !== $field_val ) {
|
||||
$result = self::compare( $result, $relation, self::compare( $field_val, isset( $data['operator'] ) ? $data['operator'] : '===', isset( $data['value'] ) ? $data['value'] : true ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
/**
|
||||
* The file that defines the core plugin class
|
||||
*
|
||||
* A class definition that includes attributes and functions used across both the
|
||||
* public-facing side of the site and the admin area.
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Sight_Portfolio' ) ) {
|
||||
/**
|
||||
* Main Core Class
|
||||
*/
|
||||
class Sight_Portfolio {
|
||||
/**
|
||||
* The plugin version number.
|
||||
*
|
||||
* @var string $data The plugin version number.
|
||||
*/
|
||||
public $version;
|
||||
|
||||
/**
|
||||
* The plugin data array.
|
||||
*
|
||||
* @var array $data The plugin data array.
|
||||
*/
|
||||
public $data = array();
|
||||
|
||||
/**
|
||||
* The plugin settings array.
|
||||
*
|
||||
* @var array $settings The plugin data array.
|
||||
*/
|
||||
public $settings = array();
|
||||
|
||||
/**
|
||||
* INIT (global theme queue)
|
||||
*/
|
||||
public function init() {
|
||||
if ( ! function_exists( 'get_plugin_data' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
// Get plugin data.
|
||||
$plugin_data = get_plugin_data( SIGHT_PATH . 'sight.php' );
|
||||
|
||||
// Vars.
|
||||
$this->version = $plugin_data['Version'];
|
||||
|
||||
// Settings.
|
||||
$this->settings = array(
|
||||
'name' => esc_html__( 'Sight', 'sight' ),
|
||||
'version' => $plugin_data['Version'],
|
||||
);
|
||||
|
||||
// Include core.
|
||||
require_once SIGHT_PATH . 'core/core-api.php';
|
||||
require_once SIGHT_PATH . 'core/core-plugin-functions.php';
|
||||
require_once SIGHT_PATH . 'core/core-register-post-types.php';
|
||||
require_once SIGHT_PATH . 'core/core-register-category-fields.php';
|
||||
require_once SIGHT_PATH . 'core/core-video-settings.php';
|
||||
|
||||
// Include core classes.
|
||||
require_once SIGHT_PATH . 'core/block-renderer-controller.php';
|
||||
require_once SIGHT_PATH . 'core/block-utils-is-field-visible.php';
|
||||
|
||||
// Render files.
|
||||
require_once SIGHT_PATH . 'render/sight-entry.php';
|
||||
require_once SIGHT_PATH . 'render/sight-load-more.php';
|
||||
|
||||
// Elementor integration.
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) ) {
|
||||
require_once SIGHT_PATH . 'elementor/integration.php';
|
||||
}
|
||||
|
||||
// Gutenberg integration.
|
||||
if ( function_exists( 'register_block_type' ) ) {
|
||||
require_once SIGHT_PATH . 'gutenberg/block-portfolio.php';
|
||||
}
|
||||
|
||||
// Render.
|
||||
require_once SIGHT_PATH . 'render/sight-render.php';
|
||||
|
||||
// Actions.
|
||||
add_action( 'sight_plugin_activation', array( $this, 'activation' ) );
|
||||
add_action( 'plugins_loaded', array( $this, 'check_version' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will safely define a constant
|
||||
*
|
||||
* @param string $name The name.
|
||||
* @param mixed $value The value.
|
||||
*/
|
||||
public function define( $name, $value = true ) {
|
||||
|
||||
if ( ! defined( $name ) ) {
|
||||
define( $name, $value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if has setting.
|
||||
*
|
||||
* @param string $name The name.
|
||||
*/
|
||||
public function has_setting( $name ) {
|
||||
return isset( $this->settings[ $name ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a setting.
|
||||
*
|
||||
* @param string $name The name.
|
||||
*/
|
||||
public function get_setting( $name ) {
|
||||
return isset( $this->settings[ $name ] ) ? $this->settings[ $name ] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a setting.
|
||||
*
|
||||
* @param string $name The name.
|
||||
* @param mixed $value The value.
|
||||
*/
|
||||
public function update_setting( $name, $value ) {
|
||||
$this->settings[ $name ] = $value;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns data.
|
||||
*
|
||||
* @param string $name The name.
|
||||
*/
|
||||
public function get_data( $name ) {
|
||||
return isset( $this->data[ $name ] ) ? $this->data[ $name ] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets data.
|
||||
*
|
||||
* @param string $name The name.
|
||||
* @param mixed $value The value.
|
||||
*/
|
||||
public function set_data( $name, $value ) {
|
||||
$this->data[ $name ] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook activation
|
||||
*/
|
||||
public function activation() {
|
||||
if ( get_option( 'sight_db_version' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
update_option( 'sight_db_version', sight_raw_setting( 'version' ), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check current version
|
||||
*/
|
||||
public function check_version() {
|
||||
|
||||
// Version Data.
|
||||
$new = sight_raw_setting( 'version' );
|
||||
|
||||
// Get db version.
|
||||
$current = get_option( 'sight_db_version', $new );
|
||||
|
||||
// If versions don't match.
|
||||
if ( $current && $current !== $new ) {
|
||||
/**
|
||||
* If different versions call a special hook.
|
||||
*
|
||||
* @param string $current Current version.
|
||||
* @param string $new New version.
|
||||
*/
|
||||
do_action( 'sight_plugin_upgrade', $current, $new );
|
||||
|
||||
update_option( 'sight_db_version', $new, true );
|
||||
}
|
||||
|
||||
if ( $current ) {
|
||||
update_option( 'sight_db_version', $new, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The main function responsible for returning the one true sight Instance to functions everywhere.
|
||||
* Use this function like you would a global variable, except without needing to declare the global.
|
||||
*
|
||||
* Example: <?php $sight = sight_portfolio(); ?>
|
||||
*/
|
||||
function sight_portfolio() {
|
||||
|
||||
// Globals.
|
||||
global $sight_instance;
|
||||
|
||||
// Init.
|
||||
if ( ! isset( $sight_instance ) ) {
|
||||
$sight_instance = new Sight_Portfolio();
|
||||
$sight_instance->init();
|
||||
}
|
||||
|
||||
return $sight_instance;
|
||||
}
|
||||
|
||||
// Initialize.
|
||||
sight_portfolio();
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* The api functions for the plugin
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
/**
|
||||
* Alias of sight_portfolio()->has_setting()
|
||||
*
|
||||
* @param string $name The name.
|
||||
*/
|
||||
function sight_has_setting( $name = '' ) {
|
||||
return sight_portfolio()->has_setting( $name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias of sight_portfolio()->get_setting()
|
||||
*
|
||||
* @param string $name The name.
|
||||
*/
|
||||
function sight_raw_setting( $name = '' ) {
|
||||
return sight_portfolio()->get_setting( $name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias of sight_portfolio()->update_setting()
|
||||
*
|
||||
* @param string $name The name.
|
||||
* @param mixed $value The value.
|
||||
*/
|
||||
function sight_update_setting( $name, $value ) {
|
||||
|
||||
return sight_portfolio()->update_setting( $name, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias of sight_portfolio()->get_setting()
|
||||
*
|
||||
* @param string $name The name.
|
||||
* @param mixed $value The value.
|
||||
*/
|
||||
function sight_get_setting( $name, $value = null ) {
|
||||
|
||||
// Check settings.
|
||||
if ( sight_has_setting( $name ) ) {
|
||||
$value = sight_raw_setting( $name );
|
||||
}
|
||||
|
||||
// Filter.
|
||||
$value = apply_filters( "canvas_settings_{$name}", $value );
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will add a value into the settings array found in the acf object
|
||||
*
|
||||
* @param string $name The name.
|
||||
* @param mixed $value The value.
|
||||
*/
|
||||
function sight_append_setting( $name, $value ) {
|
||||
|
||||
// Vars.
|
||||
$setting = sight_raw_setting( $name );
|
||||
|
||||
// Bail ealry if not array.
|
||||
if ( ! is_array( $setting ) ) {
|
||||
$setting = array();
|
||||
}
|
||||
|
||||
// Append.
|
||||
$setting[] = $value;
|
||||
|
||||
// Update.
|
||||
return sight_update_setting( $name, $setting );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns data.
|
||||
*
|
||||
* @param string $name The name.
|
||||
*/
|
||||
function sight_get_data( $name ) {
|
||||
return sight_portfolio()->get_data( $name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets data.
|
||||
*
|
||||
* @param string $name The name.
|
||||
* @param mixed $value The value.
|
||||
*/
|
||||
function sight_set_data( $name, $value ) {
|
||||
return sight_portfolio()->set_data( $name, $value );
|
||||
}
|
||||
@@ -0,0 +1,570 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Functions
|
||||
*
|
||||
* Utility functions.
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'sight_doing_request' ) ) {
|
||||
/**
|
||||
* Determines whether the current request is a WordPress REST or Ajax request.
|
||||
*/
|
||||
function sight_doing_request() {
|
||||
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
|
||||
return true;
|
||||
}
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_is_context_editor' ) ) {
|
||||
/**
|
||||
* Determines whether the current request is from WordPress Editor.
|
||||
*/
|
||||
function sight_is_context_editor() {
|
||||
if ( isset( $_REQUEST['context'] ) && 'edit' === $_REQUEST['context'] ) { // Input var ok; sanitization ok.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_is_archive' ) ) {
|
||||
/**
|
||||
* Determines whether the current request is a WordPress REST or Ajax request.
|
||||
*/
|
||||
function sight_is_archive() {
|
||||
return apply_filters( 'sight_portfolio_is_archive', false );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_encode_data' ) ) {
|
||||
/**
|
||||
* Encode data
|
||||
*
|
||||
* @param mixed $content The content.
|
||||
* @param string $secret_key The key.
|
||||
* @return string
|
||||
*/
|
||||
function sight_encode_data( $content, $secret_key = 'sight' ) {
|
||||
|
||||
$content = wp_json_encode( $content );
|
||||
|
||||
return base64_encode( $content );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_decode_data' ) ) {
|
||||
/**
|
||||
* Decode data
|
||||
*
|
||||
* @param string $content The content.
|
||||
* @param string $secret_key The key.
|
||||
* @return string
|
||||
*/
|
||||
function sight_decode_data( $content, $secret_key = 'sight' ) {
|
||||
|
||||
$content = base64_decode( $content );
|
||||
|
||||
return json_decode( $content );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_get_available_image_sizes' ) ) {
|
||||
/**
|
||||
* Get the available image sizes
|
||||
*/
|
||||
function sight_get_available_image_sizes() {
|
||||
$wais = & $GLOBALS['_wp_additional_image_sizes'];
|
||||
|
||||
$sizes = array();
|
||||
$image_sizes = get_intermediate_image_sizes();
|
||||
|
||||
if ( is_array( $image_sizes ) && $image_sizes ) {
|
||||
foreach ( $image_sizes as $size ) {
|
||||
if ( in_array( $size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
|
||||
$sizes[ $size ] = array(
|
||||
'width' => get_option( "{$size}_size_w" ),
|
||||
'height' => get_option( "{$size}_size_h" ),
|
||||
'crop' => (bool) get_option( "{$size}_crop" ),
|
||||
);
|
||||
} elseif ( isset( $wais[ $size ] ) ) {
|
||||
$sizes[ $size ] = array(
|
||||
'width' => $wais[ $size ]['width'],
|
||||
'height' => $wais[ $size ]['height'],
|
||||
'crop' => $wais[ $size ]['crop'],
|
||||
);
|
||||
}
|
||||
|
||||
// Size registered, but has 0 width and height.
|
||||
if ( 0 === (int) $sizes[ $size ]['width'] && 0 === (int) $sizes[ $size ]['height'] ) {
|
||||
unset( $sizes[ $size ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $sizes;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_get_image_size' ) ) {
|
||||
/**
|
||||
* Gets the data of a specific image size.
|
||||
*
|
||||
* @param string $size Name of the size.
|
||||
*/
|
||||
function sight_get_image_size( $size ) {
|
||||
if ( ! is_string( $size ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sizes = sight_get_available_image_sizes();
|
||||
|
||||
return isset( $sizes[ $size ] ) ? $sizes[ $size ] : false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_get_list_available_image_sizes' ) ) {
|
||||
/**
|
||||
* Get the list available image sizes
|
||||
*/
|
||||
function sight_get_list_available_image_sizes() {
|
||||
|
||||
$image_sizes = wp_cache_get( 'sight_available_image_sizes' );
|
||||
|
||||
if ( empty( $image_sizes ) ) {
|
||||
$image_sizes = array();
|
||||
|
||||
$intermediate_image_sizes = get_intermediate_image_sizes();
|
||||
|
||||
foreach ( $intermediate_image_sizes as $size ) {
|
||||
$image_sizes[ $size ] = $size;
|
||||
|
||||
$data = sight_get_image_size( $size );
|
||||
|
||||
if ( isset( $data['width'] ) || isset( $data['height'] ) ) {
|
||||
|
||||
$width = '~';
|
||||
$height = '~';
|
||||
|
||||
if ( isset( $data['width'] ) && $data['width'] ) {
|
||||
$width = $data['width'] . 'px';
|
||||
}
|
||||
if ( isset( $data['height'] ) && $data['height'] ) {
|
||||
$height = $data['height'] . 'px';
|
||||
}
|
||||
|
||||
$image_sizes[ $size ] .= sprintf( ' [%s, %s]', $width, $height );
|
||||
}
|
||||
}
|
||||
|
||||
wp_cache_set( 'sight_available_image_sizes', $image_sizes );
|
||||
}
|
||||
|
||||
return array_merge( array( 'full' => esc_html__( 'Full', 'sight' ) ), $image_sizes );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_str_truncate' ) ) {
|
||||
/**
|
||||
* Truncates string with specified length
|
||||
*
|
||||
* @param string $string Text string.
|
||||
* @param int $length Letters length.
|
||||
* @param string $etc End truncate.
|
||||
* @param bool $break_words Break words or not.
|
||||
* @return string
|
||||
*/
|
||||
function sight_str_truncate( $string, $length = 80, $etc = '…', $break_words = false ) {
|
||||
if ( 0 === $length ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( function_exists( 'mb_strlen' ) ) {
|
||||
|
||||
// MultiBite string functions.
|
||||
if ( mb_strlen( $string ) > $length ) {
|
||||
$length -= min( $length, mb_strlen( $etc ) );
|
||||
if ( ! $break_words ) {
|
||||
$string = preg_replace( '/\s+?(\S+)?$/', '', mb_substr( $string, 0, $length + 1 ) );
|
||||
}
|
||||
|
||||
return mb_substr( $string, 0, $length ) . $etc;
|
||||
}
|
||||
} else {
|
||||
|
||||
// Default string functions.
|
||||
if ( strlen( $string ) > $length ) {
|
||||
$length -= min( $length, strlen( $etc ) );
|
||||
if ( ! $break_words ) {
|
||||
$string = preg_replace( '/\s+?(\S+)?$/', '', substr( $string, 0, $length + 1 ) );
|
||||
}
|
||||
|
||||
return substr( $string, 0, $length ) . $etc;
|
||||
}
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_get_the_excerpt' ) ) {
|
||||
/**
|
||||
* Filters the number of words in an excerpt.
|
||||
*/
|
||||
function sight_get_the_excerpt_length() {
|
||||
return 5000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get excerpt of post.
|
||||
*
|
||||
* @param int $length Letters length.
|
||||
* @param string $etc End truncate.
|
||||
* @param bool $break_words Break words or not.
|
||||
*/
|
||||
function sight_get_the_excerpt( $length = 80, $etc = '…', $break_words = false ) {
|
||||
add_filter( 'excerpt_length', 'sight_get_the_excerpt_length' );
|
||||
|
||||
$excerpt = get_the_excerpt();
|
||||
|
||||
$func_remove = sprintf( 'remove_%s', 'filter' );
|
||||
|
||||
$func_remove( 'excerpt_length', 'sight_get_the_excerpt_length' );
|
||||
|
||||
return sight_str_truncate( $excerpt, $length, $etc, $break_words );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_powerkit_module_enabled' ) ) {
|
||||
/**
|
||||
* Helper function to check the status of powerkit modules
|
||||
*
|
||||
* @param array $name Name of module.
|
||||
*/
|
||||
function sight_powerkit_module_enabled( $name ) {
|
||||
if ( function_exists( 'powerkit_module_enabled' ) && powerkit_module_enabled( $name ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_post_views_enabled' ) ) {
|
||||
/**
|
||||
* Check post views module.
|
||||
*
|
||||
* @return string Type.
|
||||
*/
|
||||
function sight_post_views_enabled() {
|
||||
|
||||
// Post Views Counter.
|
||||
if ( class_exists( 'Post_Views_Counter' ) ) {
|
||||
return 'post_views';
|
||||
}
|
||||
|
||||
// Powerkit Post Views.
|
||||
if ( sight_powerkit_module_enabled( 'post_views' ) ) {
|
||||
return 'pk_post_views';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_get_post_types_stack' ) ) {
|
||||
/**
|
||||
* Get portfolio post types.
|
||||
*/
|
||||
function sight_get_post_types_stack() {
|
||||
|
||||
$stack = wp_cache_get( 'sight_get_post_types_stack' );
|
||||
|
||||
if ( ! $stack ) {
|
||||
|
||||
$stack = array();
|
||||
|
||||
$post_types = get_post_types( array( 'publicly_queryable' => 1 ), 'objects' );
|
||||
|
||||
foreach ( $post_types as $post_type ) {
|
||||
$stack[ $post_type->name ] = $post_type->label;
|
||||
}
|
||||
|
||||
wp_cache_set( 'sight_get_post_types_stack', $stack );
|
||||
}
|
||||
|
||||
return $stack ? $stack : array();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_get_categories_stack' ) ) {
|
||||
/**
|
||||
* Get portfolio categories.
|
||||
*/
|
||||
function sight_get_categories_stack() {
|
||||
|
||||
$stack = wp_cache_get( 'sight_get_categories_stack' );
|
||||
|
||||
if ( ! $stack ) {
|
||||
|
||||
$stack = array();
|
||||
|
||||
$categories = get_terms(
|
||||
array(
|
||||
'taxonomy' => 'sight-categories',
|
||||
'hide_empty' => false,
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $categories as $category ) {
|
||||
$stack[ $category->term_id ] = $category->name;
|
||||
}
|
||||
|
||||
wp_cache_set( 'sight_get_categories_stack', $stack );
|
||||
}
|
||||
|
||||
return $stack ? $stack : array();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_portfolio_area_classes' ) ) {
|
||||
/**
|
||||
* Get portfolio area classes.
|
||||
*
|
||||
* @param array $attributes The attributes.
|
||||
* @param array $options The options.
|
||||
*/
|
||||
function sight_portfolio_area_classes( $attributes, $options ) {
|
||||
$classes = array( 'sight-portfolio-area' );
|
||||
|
||||
// Enable Lightbox.
|
||||
if ( isset( $attributes['attachment_lightbox'] ) && $attributes['attachment_lightbox'] ) {
|
||||
$classes[] = 'sight-portfolio-area-lightbox';
|
||||
}
|
||||
|
||||
// Apply filters.
|
||||
$classes = apply_filters( 'sight_portfolio_area_classes', $classes, $attributes, $options );
|
||||
|
||||
// Build class.
|
||||
$class = implode( ' ', $classes );
|
||||
|
||||
// Return.
|
||||
return $class;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_portfolio_area_main_attrs' ) ) {
|
||||
/**
|
||||
* Output portfolio area main attrs.
|
||||
*
|
||||
* @param array $attributes The attributes.
|
||||
* @param array $options The options.
|
||||
*/
|
||||
function sight_portfolio_area_main_attrs( $attributes, $options ) {
|
||||
// Apply filters.
|
||||
$attrs = apply_filters( 'sight_portfolio_area_main_attrs', '', $attributes, $options );
|
||||
|
||||
// Return.
|
||||
return call_user_func( 'printf', '%s', $attrs );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_get_youtube_video_id' ) ) {
|
||||
/**
|
||||
* Get Youtube video ID from URL
|
||||
*
|
||||
* @param string $url YouTube URL.
|
||||
*/
|
||||
function sight_get_youtube_video_id( $url ) {
|
||||
preg_match( '/(http(s|):|)\/\/(www\.|)yout(.*?)\/(embed\/|watch.*?v=|)([a-z_A-Z0-9\-]{11})/i', $url, $results );
|
||||
|
||||
if ( isset( $results[6] ) && $results[6] ) {
|
||||
return $results[6];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_get_local_video_url' ) ) {
|
||||
/**
|
||||
* Get local video URL
|
||||
*
|
||||
* @param string $url Local URL.
|
||||
*/
|
||||
function sight_get_local_video_url( $url ) {
|
||||
if ( attachment_url_to_postid( $url ) ) {
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_get_video_background' ) ) {
|
||||
/**
|
||||
* Get element video background
|
||||
*
|
||||
* @param string $type The type.
|
||||
* @param string $location The current location.
|
||||
* @param int $post_id The id of post.
|
||||
* @param string $template Template.
|
||||
* @param bool $controls Display tools.
|
||||
*/
|
||||
function sight_get_video_background( $type = 'always', $location = null, $post_id = null, $template = 'default', $controls = true ) {
|
||||
|
||||
if ( sight_is_context_editor() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_customize_preview() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $post_id ) {
|
||||
$post_id = get_the_ID();
|
||||
}
|
||||
|
||||
// Params.
|
||||
$url = get_post_meta( $post_id, 'sight_post_video_url', true );
|
||||
$start = get_post_meta( $post_id, 'sight_post_video_bg_start_time', true );
|
||||
$end = get_post_meta( $post_id, 'sight_post_video_bg_end_time', true );
|
||||
|
||||
// Location.
|
||||
if ( $location ) {
|
||||
$support = (array) get_post_meta( $post_id, 'sight_post_video_location', true );
|
||||
|
||||
if ( ! in_array( $location, $support, true ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Video info.
|
||||
$local_url = sight_get_local_video_url( $url );
|
||||
$youtube_id = sight_get_youtube_video_id( $url );
|
||||
|
||||
// Output.
|
||||
if ( $youtube_id || $local_url ) {
|
||||
// Get video mode.
|
||||
$mode = $youtube_id ? 'youtube' : 'local';
|
||||
|
||||
// Controls.
|
||||
if ( true === $controls ) {
|
||||
$controls = array( 'youtube', 'volume', 'state' );
|
||||
|
||||
if ( 'hover' === $type ) {
|
||||
$controls = array_diff( $controls, array( 'state' ) );
|
||||
}
|
||||
if ( 'local' === $mode ) {
|
||||
$controls = array_diff( $controls, array( 'youtube' ) );
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="sight-portfolio-video-container" data-video-type="<?php echo esc_attr( $type ); ?>" data-video-mode="<?php echo esc_attr( $mode ); ?>" data-youtube-id="<?php echo esc_attr( $youtube_id ); ?>" data-video-start="<?php echo esc_attr( (int) $start ); ?>" data-video-end="<?php echo esc_attr( (int) $end ); ?>">
|
||||
<?php if ( $youtube_id ) { ?>
|
||||
<div class="sight-portfolio-video-inner"></div>
|
||||
<?php } else { ?>
|
||||
<video class="sight-portfolio-video-inner" loop muted>
|
||||
<source src="<?php echo esc_attr( $local_url ); ?>" type="video/webm" />
|
||||
</video>
|
||||
<?php } ?>
|
||||
|
||||
<div class="sight-portfolio-video-loader"></div>
|
||||
</div>
|
||||
|
||||
<?php if ( is_array( $controls ) && $controls ) { ?>
|
||||
<div class="sight-portfolio-video-controls sight-portfolio-video-controls-<?php echo esc_attr( $template ); ?>">
|
||||
<?php if ( in_array( 'youtube', $controls, true ) ) { ?>
|
||||
<a class="sight-portfolio-player-control sight-portfolio-player-link sight-portfolio-player-stop" target="_blank" href="<?php echo esc_url( $url ); ?>">
|
||||
<span class="sight-portfolio-tooltip"><span><?php esc_html_e( 'View on YouTube', 'sight' ); ?></span></span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( in_array( 'volume', $controls, true ) ) { ?>
|
||||
<span class="sight-portfolio-player-control sight-portfolio-player-volume sight-portfolio-player-mute"></span>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( in_array( 'state', $controls, true ) ) { ?>
|
||||
<span class="sight-portfolio-player-control sight-portfolio-player-state sight-portfolio-player-pause"></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sight_portfolio_render_style' ) ) {
|
||||
/**
|
||||
* Callback used to render style for portfolio.
|
||||
*
|
||||
* @param array $attributes The attributes.
|
||||
* @param array $options The options.
|
||||
* @param string $id The id.
|
||||
*/
|
||||
function sight_portfolio_render_style( $attributes, $options, $id ) {
|
||||
ob_start();
|
||||
|
||||
// Heading Font Size.
|
||||
if ( isset( $attributes['typography_heading'] ) && $attributes['typography_heading'] ) {
|
||||
?>
|
||||
.sight-block-portfolio-id-{id} .sight-portfolio-entry__heading {
|
||||
font-size: <?php echo esc_attr( $attributes['typography_heading'] ); ?> !important;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
||||
// Caption Font Size.
|
||||
if ( isset( $attributes['typography_caption'] ) && $attributes['typography_caption'] ) {
|
||||
?>
|
||||
.sight-block-portfolio-id-{id} .sight-portfolio-entry__caption {
|
||||
font-size: <?php echo esc_attr( $attributes['typography_caption'] ); ?> !important;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
||||
// Heading Color.
|
||||
if ( isset( $attributes['color_heading'] ) && $attributes['color_heading'] ) {
|
||||
?>
|
||||
.sight-block-portfolio-id-{id} .sight-portfolio-entry__heading,
|
||||
.sight-block-portfolio-id-{id} .sight-portfolio-entry__heading a {
|
||||
color: <?php echo esc_attr( $attributes['color_heading'] ); ?> !important;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
||||
// Heading Hover Color.
|
||||
if ( isset( $attributes['color_heading_hover'] ) && $attributes['color_heading_hover'] ) {
|
||||
?>
|
||||
.sight-block-portfolio-id-{id} .sight-portfolio-entry__heading a:hover {
|
||||
color: <?php echo esc_attr( $attributes['color_heading_hover'] ); ?> !important;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
||||
// Caption Color.
|
||||
if ( isset( $attributes['color_caption'] ) && $attributes['color_caption'] ) {
|
||||
?>
|
||||
.sight-block-portfolio-id-{id} .sight-portfolio-entry__caption {
|
||||
color: <?php echo esc_attr( $attributes['color_caption'] ); ?> !important;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
||||
$style = ob_get_clean();
|
||||
|
||||
/*
|
||||
* -------------------------------------
|
||||
*/
|
||||
|
||||
// Apply filters.
|
||||
$style = apply_filters( 'sight_portfolio_render_css', $style, $attributes, $options, $id );
|
||||
|
||||
// Replace ids.
|
||||
$style = str_replace( '{id}', $id, $style );
|
||||
|
||||
// Wrap tags.
|
||||
if ( $style ) {
|
||||
$style = sprintf( '<style>%s</style>', $style );
|
||||
}
|
||||
|
||||
// Print.
|
||||
call_user_func( 'printf', '%s', $style );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
/**
|
||||
* Register Fields for Category.
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class Register Fields
|
||||
*/
|
||||
class Sight_Category_Fields {
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'sight-categories_add_form_fields', array( $this, 'category_add_form_fields' ), 10 );
|
||||
add_action( 'sight-categories_edit_form_fields', array( $this, 'category_edit_form_fields' ), 10, 2 );
|
||||
add_action( 'created_sight-categories', array( $this, 'save_category' ), 10, 2 );
|
||||
add_action( 'edited_sight-categories', array( $this, 'save_category' ), 10, 2 );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 10 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add fields to Category
|
||||
*
|
||||
* @param string $taxonomy The taxonomy slug.
|
||||
*/
|
||||
public function category_add_form_fields( $taxonomy ) {
|
||||
wp_nonce_field( 'category_options', 'sight_category' );
|
||||
?>
|
||||
<div class="form-field">
|
||||
<label><?php esc_html_e( 'Featured Image', 'sight' ); ?></label>
|
||||
|
||||
<div class="sight-featured-image" data-frame-title="<?php esc_html_e( 'Select or upload image', 'sight' ); ?>" data-frame-btn-text="<?php esc_html_e( 'Set image', 'sight' ); ?>">
|
||||
<p class="uploaded-img-box">
|
||||
<span class="sight-uploaded-image"></span>
|
||||
<input id="sight_featured_image" class="sight-uploaded-img-id" name="sight_featured_image" type="hidden"/>
|
||||
</p>
|
||||
<p class="hide-if-no-js">
|
||||
<a class="sight-upload-img-link button button-primary" href="#"><?php esc_html_e( 'Upload image', 'sight' ); ?></a>
|
||||
<a class="sight-delete-img-link button button-secondary hidden" href="#"><?php esc_html_e( 'Remove image', 'sight' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit fields from Category
|
||||
*
|
||||
* @param object $tag Current taxonomy term object.
|
||||
* @param string $taxonomy Current taxonomy slug.
|
||||
*/
|
||||
public function category_edit_form_fields( $tag, $taxonomy ) {
|
||||
wp_nonce_field( 'category_options', 'sight_category' );
|
||||
|
||||
$sight_featured_image = get_term_meta( $tag->term_id, 'sight_featured_image', true );
|
||||
?>
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top">
|
||||
<label for="sight_featured_image"><?php esc_html_e( 'Featured Image', 'sight' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<div class="sight-featured-image" data-frame-title="<?php esc_html_e( 'Select or upload image', 'sight' ); ?>" data-frame-btn-text="<?php esc_html_e( 'Set image', 'sight' ); ?>">
|
||||
<p class="uploaded-img-box">
|
||||
<span class="sight-uploaded-image">
|
||||
<?php if ( $sight_featured_image ) : ?>
|
||||
<?php
|
||||
echo wp_get_attachment_image( $sight_featured_image, 'large', false, array(
|
||||
'style' => 'max-width:100%; height: auto;',
|
||||
) );
|
||||
?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
|
||||
<input id="sight_featured_image" class="sight-uploaded-img-id" name="sight_featured_image" type="hidden" value="<?php echo esc_attr( $sight_featured_image ); ?>" />
|
||||
</p>
|
||||
<p class="hide-if-no-js">
|
||||
<a class="sight-upload-img-link button button-primary <?php echo esc_attr( $sight_featured_image ? 'hidden' : '' ); ?>" href="#"><?php esc_html_e( 'Upload image', 'sight' ); ?></a>
|
||||
<a class="sight-delete-img-link button button-secondary <?php echo esc_attr( ! $sight_featured_image ? 'hidden' : '' ); ?>" href="#"><?php esc_html_e( 'Remove image', 'sight' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p class="description"><?php esc_html_e( 'This image is used in the category blocks.', 'sight' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save category fields
|
||||
*
|
||||
* @param int $term_id ID of the term about to be edited.
|
||||
* @param string $taxonomy Taxonomy slug of the related term.
|
||||
*/
|
||||
public function save_category( $term_id, $taxonomy ) {
|
||||
|
||||
// Bail if we're doing an auto save.
|
||||
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if our nonce isn't there, or we can't verify it, bail.
|
||||
if ( ! isset( $_POST['sight_category'] ) || ! wp_verify_nonce( $_POST['sight_category'], 'category_options' ) ) { // Input var ok; sanitization ok.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $_POST['sight_featured_image'] ) ) { // Input var ok; sanitization ok.
|
||||
$sight_featured_image = sanitize_text_field( $_POST['sight_featured_image'] ); // Input var ok; sanitization ok.
|
||||
|
||||
update_term_meta( $term_id, 'sight_featured_image', $sight_featured_image );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the stylesheets and JavaScript for the admin area.
|
||||
*
|
||||
* @param string $page Current page.
|
||||
*/
|
||||
public function admin_enqueue_scripts( $page ) {
|
||||
if ( 'edit-tags.php' === $page || 'term.php' === $page ) {
|
||||
wp_enqueue_script( 'jquery-core' );
|
||||
|
||||
wp_enqueue_media();
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
( function() {
|
||||
|
||||
var portfolioFeaturedContainer = '.sight-featured-image';
|
||||
|
||||
var portfolioFeaturedFrame;
|
||||
|
||||
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
|
||||
/* Add Image Link */
|
||||
jQuery( portfolioFeaturedContainer ).find( '.sight-upload-img-link' ).on( 'click', function( event ){
|
||||
event.preventDefault();
|
||||
|
||||
var parentContainer = $( this ).parents( portfolioFeaturedContainer );
|
||||
|
||||
// Options.
|
||||
var options = {
|
||||
title: parentContainer.data( 'frame-title' ) ? parentContainer.data( 'frame-title' ) : 'Select or Upload Media',
|
||||
button: {
|
||||
text: parentContainer.data( 'frame-btn-text' ) ? parentContainer.data( 'frame-btn-text' ) : 'Use this media',
|
||||
},
|
||||
library : { type : 'image' },
|
||||
multiple: false // Set to true to allow multiple files to be selected.
|
||||
};
|
||||
|
||||
// Create a new media frame
|
||||
portfolioFeaturedFrame = wp.media( options );
|
||||
|
||||
// When an image is selected in the media frame...
|
||||
portfolioFeaturedFrame.on( 'select', function() {
|
||||
|
||||
// Get media attachment details from the frame state.
|
||||
var attachment = portfolioFeaturedFrame.state().get('selection').first().toJSON();
|
||||
|
||||
// Send the attachment URL to our custom image input field.
|
||||
parentContainer.find( '.sight-uploaded-image' ).html( '<img src="' + attachment.url + '" style="max-width:100%;"/>' );
|
||||
parentContainer.find( '.sight-uploaded-img-id' ).val( attachment.id ).change();
|
||||
parentContainer.find( '.sight-upload-img-link' ).addClass( 'hidden' );
|
||||
parentContainer.find( '.sight-delete-img-link' ).removeClass( 'hidden' );
|
||||
|
||||
portfolioFeaturedFrame.close();
|
||||
});
|
||||
|
||||
// Finally, open the modal on click.
|
||||
portfolioFeaturedFrame.open();
|
||||
});
|
||||
|
||||
|
||||
/* Delete Image Link */
|
||||
$( portfolioFeaturedContainer ).find( '.sight-delete-img-link' ).on( 'click', function( event ){
|
||||
event.preventDefault();
|
||||
|
||||
$( this ).parents( portfolioFeaturedContainer ).find( '.sight-uploaded-image' ).html( '' );
|
||||
$( this ).parents( portfolioFeaturedContainer ).find( '.sight-upload-img-link' ).removeClass( 'hidden' );
|
||||
$( this ).parents( portfolioFeaturedContainer ).find( '.sight-delete-img-link' ).addClass( 'hidden' );
|
||||
$( this ).parents( portfolioFeaturedContainer ).find( '.sight-uploaded-img-id' ).val( '' ).change();
|
||||
});
|
||||
});
|
||||
|
||||
jQuery( document ).ajaxSuccess(function(e, request, settings){
|
||||
let action = settings.data.indexOf( 'action=add-tag' );
|
||||
let screen = settings.data.indexOf( 'screen=edit-category' );
|
||||
let taxonomy = settings.data.indexOf( 'taxonomy=category' );
|
||||
|
||||
if( action > -1 && screen > -1 && taxonomy > -1 ){
|
||||
$( portfolioFeaturedContainer ).find( '.sight-delete-img-link' ).click();
|
||||
}
|
||||
});
|
||||
|
||||
} )();
|
||||
</script>
|
||||
<?php
|
||||
wp_add_inline_script( 'jquery-core', str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Sight_Category_Fields();
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* Register post types.
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register custom post types.
|
||||
*/
|
||||
function sight_register_custom_post_types() {
|
||||
|
||||
register_post_type(
|
||||
'sight-projects',
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => esc_html__( 'Projects', 'sight' ),
|
||||
'singular_name' => esc_html__( 'Project', 'sight' ),
|
||||
'menu_name' => esc_html__( 'Projects', 'sight' ),
|
||||
'parent_item_colon' => esc_html__( 'Parent Project', 'sight' ),
|
||||
'all_items' => esc_html__( 'All Projects', 'sight' ),
|
||||
'view_item' => esc_html__( 'View Project', 'sight' ),
|
||||
'add_new_item' => esc_html__( 'Add New Project', 'sight' ),
|
||||
'add_new' => esc_html__( 'Add New', 'sight' ),
|
||||
'edit_item' => esc_html__( 'Edit Project', 'sight' ),
|
||||
'update_item' => esc_html__( 'Update Project', 'sight' ),
|
||||
'search_items' => esc_html__( 'Search Project', 'sight' ),
|
||||
'not_found' => esc_html__( 'Not Found', 'sight' ),
|
||||
'not_found_in_trash' => esc_html__( 'Not found in Trash', 'sight' ),
|
||||
),
|
||||
'public' => true,
|
||||
'publicly_queryable' => true,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => true,
|
||||
'show_in_rest' => true,
|
||||
'query_var' => true,
|
||||
'rewrite' => array( 'slug' => 'projects' ),
|
||||
'capability_type' => 'post',
|
||||
'has_archive' => true,
|
||||
'hierarchical' => false,
|
||||
'menu_position' => null,
|
||||
'supports' => array( 'title', 'excerpt', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'sight_register_custom_post_types' );
|
||||
|
||||
/**
|
||||
* Register custom taxonomies.
|
||||
*/
|
||||
function sight_register_custom_taxonomies() {
|
||||
|
||||
register_taxonomy(
|
||||
'sight-categories',
|
||||
array( 'sight-projects' ),
|
||||
array(
|
||||
'label' => '',
|
||||
'labels' => array(
|
||||
'name' => esc_html__( 'Categories', 'sight' ),
|
||||
'singular_name' => esc_html__( 'Categories', 'sight' ),
|
||||
'search_items' => esc_html__( 'Search Categories', 'sight' ),
|
||||
'all_items' => esc_html__( 'All Categories', 'sight' ),
|
||||
'view_item ' => esc_html__( 'View Category', 'sight' ),
|
||||
'parent_item' => esc_html__( 'Parent Category', 'sight' ),
|
||||
'parent_item_colon' => esc_html__( 'Parent Category:', 'sight' ),
|
||||
'edit_item' => esc_html__( 'Edit Category', 'sight' ),
|
||||
'update_item' => esc_html__( 'Update Category', 'sight' ),
|
||||
'add_new_item' => esc_html__( 'Add New Category', 'sight' ),
|
||||
'new_item_name' => esc_html__( 'New Types Name', 'sight' ),
|
||||
'menu_name' => esc_html__( 'Categories', 'sight' ),
|
||||
),
|
||||
'description' => '',
|
||||
'public' => sight_is_archive(),
|
||||
'show_in_nav_menus' => true,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => true,
|
||||
'show_tagcloud' => true,
|
||||
'hierarchical' => true,
|
||||
'rewrite' => array(
|
||||
'slug' => 'categories',
|
||||
),
|
||||
'capabilities' => array(),
|
||||
'meta_box_cb' => true,
|
||||
'show_admin_column' => true,
|
||||
'show_in_rest' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'sight_register_custom_taxonomies' );
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* The Video Settings.
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
/**
|
||||
* The initialize block.
|
||||
*/
|
||||
class Sight_Video_Settings {
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'init', array( $this, 'register_video_settings' ) );
|
||||
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ), 100 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue assets for gutenberg panels
|
||||
*/
|
||||
public function enqueue_block_editor_assets() {
|
||||
$post_id = get_the_ID();
|
||||
|
||||
if ( ! $post_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Data.
|
||||
$panels_data = array(
|
||||
'postType' => get_post_type( $post_id ),
|
||||
);
|
||||
|
||||
// Enqueue scripts.
|
||||
wp_enqueue_script(
|
||||
'sight-video-settings',
|
||||
SIGHT_URL . 'gutenberg/jsx/video-panel.js',
|
||||
array(
|
||||
'wp-i18n',
|
||||
'wp-blocks',
|
||||
'wp-edit-post',
|
||||
'wp-element',
|
||||
'wp-editor',
|
||||
'wp-components',
|
||||
'wp-data',
|
||||
'wp-plugins',
|
||||
'wp-edit-post',
|
||||
'wp-hooks',
|
||||
),
|
||||
filemtime( SIGHT_PATH . 'gutenberg/jsx/video-panel.js' ),
|
||||
true
|
||||
);
|
||||
|
||||
// Localize scripts.
|
||||
wp_localize_script( 'sight-video-settings', 'sightVideoSettings', $panels_data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register video settings
|
||||
*/
|
||||
public function register_video_settings() {
|
||||
|
||||
register_post_meta(
|
||||
'sight-projects',
|
||||
'sight_post_video_url',
|
||||
array(
|
||||
'show_in_rest' => true,
|
||||
'type' => 'string',
|
||||
'single' => true,
|
||||
'auth_callback' => function () {
|
||||
return current_user_can( 'edit_posts' );
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
register_post_meta(
|
||||
'sight-projects',
|
||||
'sight_post_video_bg_start_time',
|
||||
array(
|
||||
'show_in_rest' => true,
|
||||
'type' => 'number',
|
||||
'single' => true,
|
||||
'auth_callback' => function () {
|
||||
return current_user_can( 'edit_posts' );
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
register_post_meta(
|
||||
'sight-projects',
|
||||
'sight_post_video_bg_end_time',
|
||||
array(
|
||||
'show_in_rest' => true,
|
||||
'type' => 'number',
|
||||
'single' => true,
|
||||
'auth_callback' => function () {
|
||||
return current_user_can( 'edit_posts' );
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
new Sight_Video_Settings();
|
||||
@@ -0,0 +1,69 @@
|
||||
( function( $ ) {
|
||||
|
||||
$( document ).ready( function() {
|
||||
|
||||
var customPostView = elementor.modules.controls.BaseData.extend( {
|
||||
onReady: function() {
|
||||
|
||||
var self = this;
|
||||
|
||||
$( self.el ).find( 'select' ).select2( {
|
||||
ajax: {
|
||||
url: cpConfig.ajaxurl,
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function( params ) {
|
||||
var query = {
|
||||
posts_per_page: 10,
|
||||
q: params.term,
|
||||
paged: params.page || 1,
|
||||
action: 'handler_custom_posts'
|
||||
};
|
||||
|
||||
return query;
|
||||
},
|
||||
processResults: function (data, params) {
|
||||
params.page = params.page || 1;
|
||||
|
||||
return {
|
||||
results: data.results,
|
||||
pagination: {
|
||||
more: data.more
|
||||
}
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
allowClear: true,
|
||||
minimumInputLength: 3,
|
||||
placeholder : 'Select post',
|
||||
templateSelection: function(state){
|
||||
var $state = state;
|
||||
|
||||
if ( !isNaN( state.text.trim() ) ) {
|
||||
$state = $.ajax({
|
||||
global: false,
|
||||
type: "POST",
|
||||
url: cpConfig.ajaxurl,
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: {
|
||||
post_id: state.text.trim(),
|
||||
action: 'handler_post_title'
|
||||
},
|
||||
async:false
|
||||
} ).responseText;
|
||||
} else {
|
||||
$state = state.text;
|
||||
}
|
||||
|
||||
return $state;
|
||||
},
|
||||
} );
|
||||
|
||||
},
|
||||
} );
|
||||
|
||||
elementor.addControlView( 'custom_post', customPostView );
|
||||
} );
|
||||
} )( jQuery );
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* Control Custom Post.
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
namespace Sight_Elementor\Controls;
|
||||
|
||||
use Elementor\Base_Data_Control;
|
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor Control
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Sight_Control_Custom_Post extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Retrieve the control type.
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'custom_post';
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the default settings.
|
||||
*
|
||||
* @return string Default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return array(
|
||||
'label' => esc_html__( 'Custom Post', 'sight' ),
|
||||
'label_block' => true,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render field control output in the editor.
|
||||
*/
|
||||
public function content_template() {
|
||||
$control_uid = $this->get_control_uid();
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<select name="eae-file-link" class="elementor-control-tag-area" title="{{ data.title }}" data-setting="{{ data.name }}" id="<?php echo esc_attr( $control_uid ); ?>">
|
||||
<# if ( data.controlValue ) { #>
|
||||
<option value="{{ data.controlValue }}" selected="selected">{{{ data.controlValue }}}</div>
|
||||
<# } #>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue control scripts and styles.
|
||||
*
|
||||
* Used to register and enqueue custom scripts and styles used by the control.
|
||||
*/
|
||||
public function enqueue() {
|
||||
wp_enqueue_style( 'elementor-select2' );
|
||||
|
||||
wp_enqueue_script( 'jquery-elementor-select2' );
|
||||
|
||||
wp_register_script(
|
||||
'custom_post',
|
||||
SIGHT_URL . 'elementor/assets/custom-post.js',
|
||||
array( 'jquery', 'jquery-elementor-select2' ),
|
||||
filemtime( SIGHT_PATH . 'elementor/assets/custom-post.js' ),
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'custom_post',
|
||||
'cpConfig',
|
||||
array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
)
|
||||
);
|
||||
|
||||
wp_enqueue_script( 'custom_post' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* Elementor Integration Help.
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
namespace Sight_Elementor;
|
||||
|
||||
/**
|
||||
* Elementor Control Point
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Sight_Elementor_Helper {
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp_ajax_handler_custom_posts', array( $this, 'handler_custom_posts' ) );
|
||||
add_action( 'wp_ajax_nopriv_handler_custom_posts', array( $this, 'handler_custom_posts' ) );
|
||||
add_action( 'wp_ajax_handler_post_title', array( $this, 'handler_post_title' ) );
|
||||
add_action( 'wp_ajax_nopriv_handler_post_title', array( $this, 'handler_post_title' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom posts.
|
||||
*/
|
||||
public function handler_custom_posts() {
|
||||
|
||||
$posts = array();
|
||||
|
||||
$more = false;
|
||||
|
||||
$search_results = new \WP_Query(
|
||||
array(
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'post',
|
||||
'ignore_sticky_posts' => 1,
|
||||
's' => sanitize_text_field( $_REQUEST['q'] ),
|
||||
'paged' => sanitize_text_field( $_REQUEST['paged'] ),
|
||||
'posts_per_page' => sanitize_text_field( $_REQUEST['posts_per_page'] ),
|
||||
)
|
||||
);
|
||||
|
||||
if ( $search_results->have_posts() ) {
|
||||
while ( $search_results->have_posts() ) {
|
||||
$search_results->the_post();
|
||||
|
||||
$posts[] = array(
|
||||
'id' => get_the_ID(),
|
||||
'text' => get_the_title(),
|
||||
);
|
||||
|
||||
$more = true;
|
||||
}
|
||||
}
|
||||
|
||||
wp_send_json( array(
|
||||
'results' => $posts,
|
||||
'more' => $more,
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get post title.
|
||||
*/
|
||||
public function handler_post_title() {
|
||||
$post_id = sanitize_text_field( $_REQUEST['post_id'] );
|
||||
|
||||
if ( $post_id ) {
|
||||
echo esc_html( get_the_title( $post_id ) );
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
new Sight_Elementor_Helper();
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Support Elementor.
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
namespace Sight_Elementor;
|
||||
|
||||
/**
|
||||
* Class Sight_Elementor_Integraion
|
||||
*/
|
||||
class Sight_Elementor_Integraion {
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var Sight_Elementor_Integraion The single instance of the class.
|
||||
*/
|
||||
private static $_instance = null;
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*
|
||||
* Ensures only one instance of the class is loaded or can be loaded.
|
||||
*
|
||||
* @return Sight_Elementor_Integraion An instance of the class.
|
||||
*/
|
||||
public static function instance() {
|
||||
if ( is_null( self::$_instance ) ) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Сontrols
|
||||
*
|
||||
* Register new Elementor controls.
|
||||
*/
|
||||
public function register_controls() {
|
||||
// Its is now safe to include Сontrols files.
|
||||
require_once SIGHT_PATH . 'elementor/control-custom-post.php';
|
||||
|
||||
// Register Сontrols.
|
||||
\Elementor\Plugin::instance()->controls_manager->register_control( 'custom_post', new Controls\Sight_Control_Custom_Post() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Widgets
|
||||
*
|
||||
* Register new Elementor widgets.
|
||||
*/
|
||||
public function register_widgets() {
|
||||
// Its is now safe to include Widgets files.
|
||||
require_once SIGHT_PATH . 'elementor/widget-portfolio.php';
|
||||
|
||||
// Register Widgets.
|
||||
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Sight_Widget_Portfolio() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugin class constructor
|
||||
*
|
||||
* Register plugin action hooks and filters
|
||||
*/
|
||||
public function __construct() {
|
||||
require_once SIGHT_PATH . 'elementor/helper.php';
|
||||
|
||||
// Actions registered.
|
||||
add_action( 'elementor/controls/controls_registered', array( $this, 'register_controls' ) );
|
||||
add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_widgets' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Instantiate Sight_Elementor_Integraion Class.
|
||||
Sight_Elementor_Integraion::instance();
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,645 @@
|
||||
<?php
|
||||
/**
|
||||
* The Gutenberg Block.
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
/**
|
||||
* The initialize block.
|
||||
*/
|
||||
class Sight_Block_Portfolio {
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'init', array( $this, 'block_register' ) );
|
||||
add_action( 'wp_ajax_sight_render_thumbnail', array( $this, 'sight_render_thumbnail' ) );
|
||||
add_action( 'wp_ajax_nopriv_sight_render_thumbnail', array( $this, 'sight_render_thumbnail' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers layouts of block.
|
||||
*/
|
||||
public function block_layouts() {
|
||||
$layouts = array(
|
||||
'standard' => array(
|
||||
'name' => esc_html__( 'Standard', 'sight' ),
|
||||
'icon' => '<svg height="44" width="52" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44.69 29.75"><path d="M1.55.75h9.59a.8.8 0 01.8.8v9.64a.8.8 0 01-.8.81H1.55a.8.8 0 01-.8-.81V1.55a.8.8 0 01.8-.8zM17.55.75h9.59a.8.8 0 01.8.8v9.64a.8.8 0 01-.8.81h-9.59a.8.8 0 01-.8-.81V1.55a.8.8 0 01.8-.8zM33.55.75h9.59a.8.8 0 01.8.8v9.64a.8.8 0 01-.8.81h-9.59a.8.8 0 01-.8-.81V1.55a.8.8 0 01.8-.8zM1.55 17.75h9.59a.8.8 0 01.8.8v9.64a.8.8 0 01-.8.81H1.55a.8.8 0 01-.8-.81v-9.64a.8.8 0 01.8-.8zM17.55 17.75h9.59a.8.8 0 01.8.8v9.64a.8.8 0 01-.8.81h-9.59a.8.8 0 01-.8-.81v-9.64a.8.8 0 01.8-.8zM33.55 17.75h9.59a.8.8 0 01.8.8v9.64a.8.8 0 01-.8.81h-9.59a.8.8 0 01-.8-.81v-9.64a.8.8 0 01.8-.8z" fill="none" stroke="#2d2d2d" stroke-width="1.5"/></svg>',
|
||||
'template' => SIGHT_PATH . 'render/handler/post-area-init.php',
|
||||
'attributes' => array(
|
||||
'filter_items' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'layout',
|
||||
'operator' => '==',
|
||||
'value' => 'standard',
|
||||
),
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
array(
|
||||
'field' => 'projects_filter_post_type',
|
||||
'operator' => '==',
|
||||
'value' => 'sight-projects',
|
||||
),
|
||||
),
|
||||
),
|
||||
'pagination_type' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'ajax',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'layout',
|
||||
'operator' => '==',
|
||||
'value' => 'standard',
|
||||
),
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Return.
|
||||
return apply_filters( 'sight_block_portfolio_layouts', $layouts );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers attributes of block.
|
||||
*/
|
||||
public function block_attributes() {
|
||||
$attributes = array(
|
||||
'layout' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'standard',
|
||||
),
|
||||
'source' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'projects',
|
||||
),
|
||||
'video' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'always',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
),
|
||||
),
|
||||
'video_controls' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
array(
|
||||
'field' => 'video',
|
||||
'operator' => '!=',
|
||||
'value' => 'none',
|
||||
),
|
||||
),
|
||||
),
|
||||
'custom_post' => array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'post',
|
||||
),
|
||||
),
|
||||
),
|
||||
'custom_images' => array(
|
||||
'type' => 'array',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'custom',
|
||||
),
|
||||
),
|
||||
),
|
||||
'number_items' => array(
|
||||
'type' => 'number',
|
||||
'default' => 10,
|
||||
),
|
||||
'attachment_lightbox' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
),
|
||||
'attachment_lightbox_icon' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'attachment_lightbox',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'attachment_link_to' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'page',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'attachment_lightbox',
|
||||
'operator' => '!=',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'attachment_view_more' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'attachment_lightbox',
|
||||
'operator' => '!=',
|
||||
'value' => true,
|
||||
),
|
||||
array(
|
||||
'field' => 'attachment_link_to',
|
||||
'operator' => '!=',
|
||||
'value' => 'none',
|
||||
),
|
||||
),
|
||||
),
|
||||
'attachment_size' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'large',
|
||||
),
|
||||
'attachment_orientation' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'landscape-16-9',
|
||||
),
|
||||
'typography_heading' => array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'post',
|
||||
),
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'custom',
|
||||
),
|
||||
array(
|
||||
'field' => 'meta_title',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'typography_heading_tag' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'h3',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'post',
|
||||
),
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'custom',
|
||||
),
|
||||
array(
|
||||
'field' => 'meta_title',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'typography_caption' => array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'meta_caption',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'meta_title' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'post',
|
||||
),
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'custom',
|
||||
),
|
||||
),
|
||||
),
|
||||
'meta_caption' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
),
|
||||
'meta_caption_length' => array(
|
||||
'type' => 'number',
|
||||
'default' => 100,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'meta_caption',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'meta_category' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
array(
|
||||
'field' => 'projects_filter_post_type',
|
||||
'operator' => '==',
|
||||
'value' => 'sight-projects',
|
||||
),
|
||||
),
|
||||
),
|
||||
'meta_date' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'categories',
|
||||
),
|
||||
),
|
||||
),
|
||||
'projects_filter_post_type' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'sight-projects',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
),
|
||||
),
|
||||
'projects_filter_categories' => array(
|
||||
'type' => 'array',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
array(
|
||||
'field' => 'projects_filter_post_type',
|
||||
'operator' => '==',
|
||||
'value' => 'sight-projects',
|
||||
),
|
||||
),
|
||||
),
|
||||
'projects_filter_offset' => array(
|
||||
'type' => 'string',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
),
|
||||
),
|
||||
'projects_orderby' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'date',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
),
|
||||
),
|
||||
'projects_order' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'DESC',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'projects',
|
||||
),
|
||||
),
|
||||
),
|
||||
'categories_filter_ids' => array(
|
||||
'type' => 'array',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'categories',
|
||||
),
|
||||
),
|
||||
),
|
||||
'categories_orderby' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'name',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'categories',
|
||||
),
|
||||
),
|
||||
),
|
||||
'categories_order' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'ASC',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '==',
|
||||
'value' => 'categories',
|
||||
),
|
||||
),
|
||||
),
|
||||
'color_heading' => array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'post',
|
||||
),
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'custom',
|
||||
),
|
||||
array(
|
||||
'field' => 'meta_title',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'color_heading_hover' => array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'post',
|
||||
),
|
||||
array(
|
||||
'field' => 'source',
|
||||
'operator' => '!=',
|
||||
'value' => 'custom',
|
||||
),
|
||||
array(
|
||||
'field' => 'meta_title',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
'color_caption' => array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'field' => 'meta_caption',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Set attributes from layouts.
|
||||
$layouts = $this->block_layouts();
|
||||
|
||||
foreach ( $layouts as $slug => $layout ) {
|
||||
if ( isset( $layout['attributes'] ) && $layout['attributes'] ) {
|
||||
foreach ( $layout['attributes'] as $attribute => $settings ) {
|
||||
$attributes[ $slug . '_' . $attribute ] = $settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set system settings.
|
||||
foreach ( $attributes as $key => $attribute ) {
|
||||
$attributes[ $key ]['visible'] = true;
|
||||
}
|
||||
|
||||
// Return.
|
||||
return apply_filters( 'sight_block_portfolio_attributes', $attributes );
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a block type.
|
||||
*/
|
||||
public function block_register() {
|
||||
wp_register_script( 'sight-block-portfolio', SIGHT_URL . 'gutenberg/jsx/block-portfolio.js', array( 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-editor' ) );
|
||||
|
||||
// Set config of block.
|
||||
wp_localize_script(
|
||||
'sight-block-portfolio',
|
||||
'sightBlockConfig',
|
||||
array(
|
||||
'name' => esc_html__( 'Portfolio', 'sight' ),
|
||||
'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true" focusable="false"><path d="M20 4v12H8V4h12m0-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 9.67l1.69 2.26 2.48-3.1L19 15H9zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"></path></svg>',
|
||||
'category' => 'common',
|
||||
'archive' => sight_is_archive(),
|
||||
'layouts' => $this->block_layouts(),
|
||||
'attributes' => $this->block_attributes(),
|
||||
'post_types_stack' => $this->convert_array_to_options( sight_get_post_types_stack() ),
|
||||
'categories_stack' => $this->convert_array_to_options( sight_get_categories_stack() ),
|
||||
'image_sizes' => $this->convert_array_to_options( sight_get_list_available_image_sizes() ),
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Register portfolio block.
|
||||
register_block_type(
|
||||
'sight/portfolio',
|
||||
array(
|
||||
'attributes' => $this->block_attributes(),
|
||||
'editor_script' => 'sight-block-portfolio',
|
||||
'render_callback' => array( $this, 'block_render_callback' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render attributes from block.
|
||||
*
|
||||
* @param array $attributes The attributes.
|
||||
* @param string $layout The layout.
|
||||
*/
|
||||
public function render_attributes( $attributes, $layout ) {
|
||||
// Get layouts.
|
||||
$block_attributes = $this->block_attributes();
|
||||
|
||||
foreach ( $attributes as $key => $settings ) {
|
||||
if ( isset( $block_attributes[ $key ]['active_callback'] ) && $block_attributes[ $key ]['active_callback'] ) {
|
||||
$is_visible = Sight_Utils_Is_Field_Visible::check_condition( $block_attributes[ $key ]['active_callback'], $attributes, 'AND' );
|
||||
|
||||
if ( ! $is_visible ) {
|
||||
unset( $attributes[ $key ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render options from block.
|
||||
*
|
||||
* @param array $attributes The attributes.
|
||||
* @param string $layout The layout.
|
||||
*/
|
||||
public function render_options( $attributes, $layout ) {
|
||||
$options = array();
|
||||
|
||||
// Get layouts.
|
||||
$layouts = $this->block_layouts();
|
||||
|
||||
// Render stack.
|
||||
if ( isset( $layouts[ $layout ]['attributes'] ) && $layouts[ $layout ]['attributes'] ) {
|
||||
|
||||
foreach ( $layouts[ $layout ]['attributes'] as $key => $settings ) {
|
||||
|
||||
$search = $layout . '_' . $key;
|
||||
|
||||
if ( array_key_exists( $search, $attributes ) ) {
|
||||
$options[ $key ] = $attributes[ $search ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback used to render blocks of this block type.
|
||||
*
|
||||
* @param array $attributes The attributes.
|
||||
* @param string $content The content.
|
||||
*/
|
||||
public function block_render_callback( $attributes, $content ) {
|
||||
$layouts = $this->block_layouts();
|
||||
|
||||
ob_start();
|
||||
|
||||
// Generate id.
|
||||
$id = uniqid();
|
||||
|
||||
// Set layout.
|
||||
$layout = $attributes['layout'];
|
||||
|
||||
// Render attributes.
|
||||
$attributes = $this->render_attributes( $attributes, $layout );
|
||||
|
||||
// Render options.
|
||||
$options = $this->render_options( $attributes, $layout );
|
||||
|
||||
// Set classes.
|
||||
$classes = " sight-block-portfolio-id-{$id}";
|
||||
$classes .= " sight-block-portfolio-layout-{$layout}";
|
||||
|
||||
// Output.
|
||||
?>
|
||||
<div class="sight-block-portfolio <?php echo esc_attr( $classes ); ?>">
|
||||
<?php
|
||||
if ( isset( $layouts[ $layout ]['template'] ) && file_exists( $layouts[ $layout ]['template'] ) ) {
|
||||
|
||||
// Require custom template.
|
||||
require $layouts[ $layout ]['template'];
|
||||
} else {
|
||||
|
||||
// Default template.
|
||||
require SIGHT_PATH . 'render/handler/post-area-init.php';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php sight_portfolio_render_style( $attributes, $options, $id ); ?>
|
||||
|
||||
<?php
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert array to options
|
||||
*
|
||||
* @param array $array The array.
|
||||
*/
|
||||
public function convert_array_to_options( $array = array() ) {
|
||||
|
||||
$options = array();
|
||||
|
||||
foreach ( $array as $key => $value ) {
|
||||
$options[] = array(
|
||||
'value' => $key,
|
||||
'label' => $value,
|
||||
);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render thumbnail.
|
||||
*/
|
||||
public function sight_render_thumbnail() {
|
||||
wp_verify_nonce( null );
|
||||
|
||||
if ( isset( $_GET['image_id'] ) ) { // Input var ok.
|
||||
$image_id = sanitize_text_field( wp_unslash( $_GET['image_id'] ) ); // Input var ok.
|
||||
|
||||
$image_url = wp_get_attachment_image_url( $image_id, 'thumbnail' );
|
||||
|
||||
if ( $image_url ) {
|
||||
header( 'Location: ' . $image_url );
|
||||
}
|
||||
}
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
new Sight_Block_Portfolio();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* Import panels
|
||||
*/
|
||||
import './panels/panel-settings.jsx';
|
||||
import './panels/panel-meta.jsx';
|
||||
import './panels/panel-media.jsx';
|
||||
import './panels/panel-typography.jsx';
|
||||
import './panels/panel-query.jsx';
|
||||
import './panels/panel-color.jsx';
|
||||
|
||||
/**
|
||||
* Import layouts
|
||||
*/
|
||||
import './layouts/layout-standard.jsx';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { isFieldVisible } from './helpers.jsx';
|
||||
|
||||
/**
|
||||
* Components dependencies
|
||||
*/
|
||||
import ImageSelector from './components/image-selector';
|
||||
import ServerSideRender from './components/server-side-render';
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { __ } = wp.i18n;
|
||||
const { registerBlockType } = wp.blocks;
|
||||
|
||||
const {
|
||||
Component,
|
||||
Fragment,
|
||||
RawHTML,
|
||||
} = wp.element;
|
||||
|
||||
const {
|
||||
applyFilters,
|
||||
} = wp.hooks;
|
||||
|
||||
const {
|
||||
BaseControl,
|
||||
PanelBody,
|
||||
Disabled,
|
||||
} = wp.components;
|
||||
|
||||
const {
|
||||
InspectorControls,
|
||||
} = wp.editor;
|
||||
|
||||
registerBlockType('sight/portfolio', {
|
||||
title: sightBlockConfig.name,
|
||||
icon: <RawHTML>{ sightBlockConfig.icon }</RawHTML>,
|
||||
category: sightBlockConfig.category,
|
||||
attributes: sightBlockConfig.attributes,
|
||||
edit: (props) => {
|
||||
const {
|
||||
attributes,
|
||||
setAttributes,
|
||||
} = props;
|
||||
|
||||
const config = sightBlockConfig;
|
||||
|
||||
// Merge props.
|
||||
props = {
|
||||
isFieldVisible,
|
||||
...props
|
||||
};
|
||||
|
||||
// Register panels.
|
||||
const panelSettings = applyFilters( 'sight.blockSettings.fields', null, props, config );
|
||||
const panelMeta = applyFilters( 'sight.metaSettings.fields', null, props, config );
|
||||
const panelMedia = applyFilters( 'sight.mediaSettings.fields', null, props, config );
|
||||
const panelTypography = applyFilters( 'sight.typographySettings.fields', null, props, config );
|
||||
const panelQuery = applyFilters( 'sight.querySettings.fields', null, props, config );
|
||||
const panelPagination = applyFilters( 'sight.paginationSettings.fields', null, props, config );
|
||||
const panelColor = applyFilters( 'sight.colorSettings.fields', null, props, config );
|
||||
|
||||
// Render.
|
||||
return (
|
||||
<div className="sight-component-custom-blocks">
|
||||
<Disabled>
|
||||
<ServerSideRender
|
||||
block="sight/portfolio"
|
||||
blockProps={props}
|
||||
attributes={attributes}
|
||||
/>
|
||||
</Disabled>
|
||||
|
||||
<Fragment>
|
||||
<InspectorControls>
|
||||
|
||||
{ applyFilters( 'sight.InspectorControls.before', null, props, config ) }
|
||||
|
||||
{ Object.keys(config.layouts).length > 1 ? (
|
||||
<PanelBody
|
||||
title={__('Layout')}
|
||||
initialOpen={ true }
|
||||
>
|
||||
<BaseControl>
|
||||
<ImageSelector
|
||||
value={ attributes['layout'] }
|
||||
onChange={(val) => {
|
||||
setAttributes({ 'layout': val });
|
||||
}}
|
||||
items={config.layouts}
|
||||
/>
|
||||
</BaseControl>
|
||||
</PanelBody>
|
||||
) : null }
|
||||
|
||||
{ panelSettings ? (
|
||||
<PanelBody
|
||||
title={__('Block Settings')}
|
||||
initialOpen={ true }
|
||||
>
|
||||
<BaseControl> { panelSettings } </BaseControl>
|
||||
</PanelBody>
|
||||
) : null }
|
||||
|
||||
{ panelMeta ? (
|
||||
<PanelBody
|
||||
title={__('Meta Settings')}
|
||||
initialOpen={ false }
|
||||
>
|
||||
<BaseControl> { panelMeta } </BaseControl>
|
||||
</PanelBody>
|
||||
) : null }
|
||||
|
||||
{ panelMedia ? (
|
||||
<PanelBody
|
||||
title={__('Media Settings')}
|
||||
initialOpen={ false }
|
||||
>
|
||||
<BaseControl> { panelMedia } </BaseControl>
|
||||
</PanelBody>
|
||||
) : null }
|
||||
|
||||
{ panelTypography ? (
|
||||
<PanelBody
|
||||
title={__('Typography Settings')}
|
||||
initialOpen={ false }
|
||||
>
|
||||
<BaseControl> { panelTypography } </BaseControl>
|
||||
</PanelBody>
|
||||
) : null }
|
||||
|
||||
{ panelQuery ? (
|
||||
<PanelBody
|
||||
title={__('Query Settings')}
|
||||
initialOpen={ false }
|
||||
>
|
||||
<BaseControl> { panelQuery } </BaseControl>
|
||||
</PanelBody>
|
||||
) : null }
|
||||
|
||||
{ panelColor ? (
|
||||
<PanelBody
|
||||
title={__('Color Settings')}
|
||||
initialOpen={ false }
|
||||
>
|
||||
<BaseControl> { panelColor } </BaseControl>
|
||||
</PanelBody>
|
||||
) : null }
|
||||
|
||||
{ applyFilters( 'sight.InspectorControls.after', ( null ), props, config ) }
|
||||
</InspectorControls>
|
||||
</Fragment>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
save() {
|
||||
// Render in PHP.
|
||||
return null;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const {
|
||||
__,
|
||||
} = wp.i18n;
|
||||
|
||||
const {
|
||||
Component,
|
||||
Fragment,
|
||||
} = wp.element;
|
||||
|
||||
const {
|
||||
TextControl,
|
||||
Notice,
|
||||
} = wp.components;
|
||||
|
||||
/**
|
||||
* Component
|
||||
*/
|
||||
export default class ComponentDimensionControl extends Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
this.isValidValue = this.isValidValue.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if value valid.
|
||||
*
|
||||
* @param {Mixed} value value to check.
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isValidValue(value) {
|
||||
const validUnits = ['fr', 'rem', 'em', 'ex', '%', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vh', 'vw', 'vmin', 'vmax'];
|
||||
|
||||
// Whitelist values.
|
||||
if (!value || '' === value || 0 === value || '0' === value || 'auto' === value || 'inherit' === value || 'initial' === value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Skip checking if calc().
|
||||
if (0 <= value.indexOf('calc(') && 0 <= value.indexOf(')')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the numeric value.
|
||||
const numericValue = parseFloat(value);
|
||||
|
||||
// Get the unit
|
||||
const unit = value.replace(numericValue, '');
|
||||
|
||||
// Allow unitless.
|
||||
if (!unit) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check the validity of the numeric value and units.
|
||||
return (!isNaN(numericValue) && -1 !== validUnits.indexOf(unit));
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
value,
|
||||
label,
|
||||
help,
|
||||
onChange,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<TextControl
|
||||
label={label}
|
||||
help={help}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
/>
|
||||
{ !this.isValidValue(value) ? (
|
||||
<Notice status="warning" isDismissible={false}>
|
||||
{ __('Invalid dimension value.')}
|
||||
</Notice>
|
||||
) : ''}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
Component,
|
||||
} = wp.element;
|
||||
|
||||
const {
|
||||
BaseControl,
|
||||
DropZone,
|
||||
Button,
|
||||
} = wp.components;
|
||||
|
||||
const {
|
||||
MediaPlaceholder,
|
||||
MediaUpload,
|
||||
mediaUpload,
|
||||
} = wp.editor;
|
||||
|
||||
/**
|
||||
* Component
|
||||
*/
|
||||
export default class ComponentGalleryControl extends Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
}
|
||||
|
||||
render() {
|
||||
const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
||||
|
||||
const {
|
||||
val,
|
||||
label,
|
||||
help,
|
||||
onChange,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<BaseControl
|
||||
label={ label || false }
|
||||
help={ help || false }
|
||||
>
|
||||
{ ! val || ! val.length ? (
|
||||
<MediaPlaceholder
|
||||
icon="format-gallery"
|
||||
labels={ {
|
||||
title: label,
|
||||
name: __( 'images' ),
|
||||
} }
|
||||
onSelect={ ( images ) => {
|
||||
const result = images.map( ( image ) => {
|
||||
return image.id;
|
||||
} );
|
||||
|
||||
onChange( result );
|
||||
} }
|
||||
accept="image/*"
|
||||
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
||||
disableMaxUploadErrorMessages
|
||||
multiple
|
||||
onError={ ( e ) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log( e );
|
||||
} }
|
||||
/>
|
||||
) : '' }
|
||||
{ val && val.length ? (
|
||||
<MediaUpload
|
||||
onSelect={ ( images ) => {
|
||||
const result = images.map( ( image ) => {
|
||||
return image.id;
|
||||
} );
|
||||
|
||||
onChange( result );
|
||||
} }
|
||||
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
||||
multiple
|
||||
gallery
|
||||
value={ val }
|
||||
render={ ( { open } ) => (
|
||||
<div
|
||||
className="sight-gutenberg-component-gallery"
|
||||
onClick={ open }
|
||||
role="presentation"
|
||||
>
|
||||
<DropZone
|
||||
onFilesDrop={ ( files ) => {
|
||||
const currentImages = val || [];
|
||||
mediaUpload( {
|
||||
allowedTypes: ALLOWED_MEDIA_TYPES,
|
||||
filesList: files,
|
||||
onFileChange: ( images ) => {
|
||||
const result = images.map( ( image ) => {
|
||||
return image.id;
|
||||
} );
|
||||
|
||||
onChange( currentImages.concat( result ) );
|
||||
},
|
||||
onError( e ) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log( e );
|
||||
},
|
||||
} );
|
||||
} }
|
||||
/>
|
||||
|
||||
{ val ? (
|
||||
<div className="sight-gutenberg-component-gallery-list">
|
||||
{val.map(imageId => {
|
||||
return (
|
||||
<img src={ sightBlockConfig.ajax_url + '?action=sight_render_thumbnail&image_id=' + imageId } />
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
) : '' }
|
||||
|
||||
<div className="sight-gutenberg-component-gallery-button">
|
||||
<Button isDefault={ true }>{ __( 'Edit Gallery' ) }</Button>
|
||||
</div>
|
||||
</div>
|
||||
) }
|
||||
/>
|
||||
) : '' }
|
||||
</BaseControl>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import classnames from 'classnames';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import './style.scss';
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const {
|
||||
Component,
|
||||
RawHTML,
|
||||
} = wp.element;
|
||||
|
||||
const {
|
||||
Button,
|
||||
Popover,
|
||||
} = wp.components;
|
||||
|
||||
/**
|
||||
* Component
|
||||
*/
|
||||
export default class ComponentImageSelector extends Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
}
|
||||
|
||||
render() {
|
||||
let {
|
||||
className,
|
||||
value,
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
items,
|
||||
onChange,
|
||||
} = this.props;
|
||||
|
||||
className = classnames(
|
||||
'sight-component-image-selector',
|
||||
className
|
||||
);
|
||||
|
||||
const layouts = Object.keys(items).map((key) => {
|
||||
return {
|
||||
content: <RawHTML>{items[key].icon}</RawHTML>,
|
||||
value: key,
|
||||
label: items[key].name,
|
||||
};
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{ layouts && layouts.length ? (
|
||||
layouts.map((itemData, i) => {
|
||||
const itemClassName = classnames(
|
||||
'sight-component-image-selector-item',
|
||||
{
|
||||
'sight-component-image-selector-item-active': value === itemData.value,
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
key={`sight-component-image-selector-item-${itemData.value}`}
|
||||
className={itemClassName}
|
||||
>
|
||||
<Button
|
||||
onClick={() => {
|
||||
onChange(itemData.value);
|
||||
}}
|
||||
>
|
||||
{itemData.content}
|
||||
</Button>
|
||||
<span>{itemData.label}</span>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
) : null }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import ReactSelect from 'react-select';
|
||||
import { debounce } from 'throttle-debounce';
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const {
|
||||
Component,
|
||||
} = wp.element;
|
||||
|
||||
const {
|
||||
withSelect,
|
||||
} = wp.data;
|
||||
|
||||
const {
|
||||
BaseControl,
|
||||
} = wp.components;
|
||||
|
||||
const cachedPosts = {};
|
||||
|
||||
function maybeCache( postType, newPosts ) {
|
||||
if ( ! newPosts || ! newPosts.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! cachedPosts[ postType ] ) {
|
||||
cachedPosts[ postType ] = {};
|
||||
}
|
||||
|
||||
newPosts.forEach( ( postData ) => {
|
||||
if ( ! cachedPosts[ postType ][ postData.id ] ) {
|
||||
cachedPosts[ postType ][ postData.id ] = postData;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Component
|
||||
*/
|
||||
class ComponentPostsSelectorControl extends Component {
|
||||
constructor() {
|
||||
super( ...arguments );
|
||||
|
||||
this.state = {
|
||||
searchTerm: '',
|
||||
};
|
||||
|
||||
this.updateSearchTerm = debounce( 300, this.updateSearchTerm.bind( this ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update search term with debounce.
|
||||
*
|
||||
* @param {String} search - search term.
|
||||
*/
|
||||
updateSearchTerm( search ) {
|
||||
this.setState( {
|
||||
searchTerm: search,
|
||||
} );
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
value,
|
||||
label,
|
||||
help,
|
||||
isMulti,
|
||||
onChange,
|
||||
allPosts,
|
||||
findPosts,
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
searchTerm,
|
||||
} = this.state;
|
||||
|
||||
const foundPosts = findPosts( searchTerm ) || [];
|
||||
|
||||
return (
|
||||
<BaseControl
|
||||
label={ label }
|
||||
help={ help }
|
||||
>
|
||||
<ReactSelect
|
||||
options={
|
||||
foundPosts.map( ( postData ) => {
|
||||
return {
|
||||
value: postData.id,
|
||||
label: postData.title.raw,
|
||||
};
|
||||
} )
|
||||
}
|
||||
value={ ( () => {
|
||||
let result = value ? value.split(',') : [];
|
||||
if ( result && result.length ) {
|
||||
result = result.map( ( id ) => {
|
||||
let thisData = {
|
||||
value: id,
|
||||
label: id,
|
||||
};
|
||||
|
||||
// get label from categories list
|
||||
if ( allPosts[ id ] ) {
|
||||
thisData.label = allPosts[ id ].title.raw;
|
||||
}
|
||||
|
||||
return thisData;
|
||||
} );
|
||||
return result;
|
||||
}
|
||||
return [];
|
||||
} )() }
|
||||
isMulti={ isMulti }
|
||||
name="filter-by-categories"
|
||||
className="basic-multi-select"
|
||||
classNamePrefix="select"
|
||||
components={ {
|
||||
IndicatorSeparator: () => null,
|
||||
ClearIndicator: () => null,
|
||||
} }
|
||||
onInputChange={ ( val ) => {
|
||||
this.updateSearchTerm( val );
|
||||
} }
|
||||
onChange={ ( val ) => {
|
||||
let result = '';
|
||||
let slug = '';
|
||||
|
||||
if ( val ) {
|
||||
val.forEach( ( catData ) => {
|
||||
result += slug + catData.value;
|
||||
slug = ',';
|
||||
} );
|
||||
}
|
||||
|
||||
onChange( result );
|
||||
} }
|
||||
/>
|
||||
</BaseControl>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withSelect( ( select, props, a, b, c ) => {
|
||||
const {
|
||||
getEntityRecords,
|
||||
} = select( 'core' );
|
||||
|
||||
const {
|
||||
value,
|
||||
postType = 'post',
|
||||
} = props;
|
||||
|
||||
let ids = value ? value.split(',') : [];
|
||||
|
||||
// find non-cached posts and try to retrieve.
|
||||
ids = ids.filter( ( id ) => {
|
||||
return ! cachedPosts[ postType ] || ! cachedPosts[ postType ][ id ];
|
||||
} );
|
||||
|
||||
if ( ids && ids.length ) {
|
||||
const newPosts = getEntityRecords( 'postType', postType, {
|
||||
include: ids,
|
||||
per_page: 100,
|
||||
} );
|
||||
|
||||
maybeCache( postType, newPosts );
|
||||
}
|
||||
|
||||
return {
|
||||
findPosts( search = '' ) {
|
||||
const searchPosts = getEntityRecords( 'postType', postType, {
|
||||
search,
|
||||
per_page: 20,
|
||||
} );
|
||||
|
||||
maybeCache( postType, searchPosts );
|
||||
|
||||
return searchPosts;
|
||||
},
|
||||
allPosts: cachedPosts[ postType ] || {},
|
||||
};
|
||||
})( ComponentPostsSelectorControl );
|
||||
@@ -0,0 +1,77 @@
|
||||
import ReactSelect from 'react-select';
|
||||
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
Component,
|
||||
} = wp.element;
|
||||
|
||||
const {
|
||||
BaseControl,
|
||||
} = wp.components;
|
||||
|
||||
/**
|
||||
* Component
|
||||
*/
|
||||
export default class ReactSelectControl extends Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
val,
|
||||
label,
|
||||
isMulti,
|
||||
onChange,
|
||||
options,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<BaseControl
|
||||
label={ label || false }
|
||||
>
|
||||
<ReactSelect
|
||||
label={ label }
|
||||
isMulti={ isMulti }
|
||||
options={ options }
|
||||
value={ ( () => {
|
||||
var list = val;
|
||||
|
||||
if ( ! Array.isArray( val ) ) {
|
||||
list = [];
|
||||
}
|
||||
|
||||
const result = list.map( ( val ) => {
|
||||
const el = options.find(function(el){
|
||||
if ( val === el['value'] ) {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
|
||||
if ( el ) {
|
||||
return {
|
||||
value: val,
|
||||
label: el['label'],
|
||||
};
|
||||
}
|
||||
} );
|
||||
|
||||
return result;
|
||||
} )() }
|
||||
onChange={ ( val ) => {
|
||||
if ( val ) {
|
||||
const result = val.map( ( opt ) => {
|
||||
return opt.value;
|
||||
} );
|
||||
|
||||
onChange( result );
|
||||
} else {
|
||||
onChange( [] );
|
||||
}
|
||||
} }
|
||||
/>
|
||||
</BaseControl>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { useMemo } = wp.element;
|
||||
const { withSelect } = wp.data;
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import ServerSideRender from './server-side-render';
|
||||
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
const EMPTY_OBJECT = {};
|
||||
|
||||
export default withSelect(
|
||||
( select ) => {
|
||||
const coreEditorSelect = select( 'core/editor' );
|
||||
if ( coreEditorSelect ) {
|
||||
const currentPostId = coreEditorSelect.getCurrentPostId();
|
||||
if ( currentPostId ) {
|
||||
return {
|
||||
currentPostId,
|
||||
};
|
||||
}
|
||||
}
|
||||
return EMPTY_OBJECT;
|
||||
}
|
||||
)(
|
||||
( { urlQueryArgs = EMPTY_OBJECT, currentPostId, ...props } ) => {
|
||||
const newUrlQueryArgs = useMemo( () => {
|
||||
if ( ! currentPostId ) {
|
||||
return urlQueryArgs;
|
||||
}
|
||||
return {
|
||||
post_id: currentPostId,
|
||||
...urlQueryArgs,
|
||||
};
|
||||
}, [ currentPostId, urlQueryArgs ] );
|
||||
|
||||
return (
|
||||
<ServerSideRender urlQueryArgs={ newUrlQueryArgs } { ...props } />
|
||||
);
|
||||
}
|
||||
);
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* This is a copy of Gutenberg component https://github.com/WordPress/gutenberg/blob/master/packages/server-side-render/src/server-side-render.js
|
||||
* With the changes in our component:
|
||||
* - callbacks before and after new content render
|
||||
* - slightly different rendering process - don't remove previously rendered content. So, we will not see page jumps after every attribute change.
|
||||
*/
|
||||
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import classnames from 'classnames';
|
||||
const { isEqual, debounce } = window.lodash;
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import './style.scss';
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const {
|
||||
Component,
|
||||
RawHTML,
|
||||
} = wp.element;
|
||||
|
||||
const { __, sprintf } = wp.i18n;
|
||||
|
||||
const apiFetch = wp.apiFetch;
|
||||
|
||||
const { addQueryArgs } = wp.url;
|
||||
|
||||
const {
|
||||
Placeholder,
|
||||
Spinner,
|
||||
} = wp.components;
|
||||
|
||||
const {
|
||||
doAction,
|
||||
} = wp.hooks;
|
||||
|
||||
export function rendererPath( block, attributes = null, urlQueryArgs = {} ) {
|
||||
return addQueryArgs( `/wp/v2/sight-renderer/${ block }`, {
|
||||
context: 'edit',
|
||||
...( null !== attributes ? { attributes } : {} ),
|
||||
...urlQueryArgs,
|
||||
} );
|
||||
}
|
||||
|
||||
export class ServerSideRender extends Component {
|
||||
constructor( props ) {
|
||||
super( props );
|
||||
this.state = {
|
||||
response: null,
|
||||
prevResponse: null,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.isStillMounted = true;
|
||||
this.fetch( this.props );
|
||||
// Only debounce once the initial fetch occurs to ensure that the first
|
||||
// renders show data as soon as possible.
|
||||
this.fetch = debounce( this.fetch, 500 );
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.isStillMounted = false;
|
||||
}
|
||||
|
||||
componentDidUpdate( prevProps ) {
|
||||
const prevAttributes = prevProps.attributes;
|
||||
const curAttributes = this.props.attributes;
|
||||
|
||||
if ( ! isEqual( prevAttributes, curAttributes ) ) {
|
||||
this.fetch( this.props );
|
||||
}
|
||||
}
|
||||
|
||||
fetch( props ) {
|
||||
if ( ! this.isStillMounted ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
block,
|
||||
attributes = null,
|
||||
urlQueryArgs = {},
|
||||
onBeforeChange = () => {},
|
||||
onChange = () => {},
|
||||
} = props;
|
||||
|
||||
if ( null !== this.state.response ) {
|
||||
this.setState( {
|
||||
response: null,
|
||||
prevResponse: this.state.response,
|
||||
} );
|
||||
}
|
||||
|
||||
const path = rendererPath( block );
|
||||
|
||||
// Store the latest fetch request so that when we process it, we can
|
||||
// check if it is the current request, to avoid race conditions on slow networks.
|
||||
const fetchRequest = this.currentFetchRequest = apiFetch( { method: 'POST', path, data: { attributes: attributes } } )
|
||||
.then( ( response ) => {
|
||||
if ( this.isStillMounted && fetchRequest === this.currentFetchRequest && response ) {
|
||||
onBeforeChange();
|
||||
doAction( 'sight.components.serverSideRender.onBeforeChange', this.props );
|
||||
|
||||
this.setState( {
|
||||
response: response.rendered,
|
||||
prevResponse: null,
|
||||
}, () => {
|
||||
onChange();
|
||||
doAction( 'sight.components.serverSideRender.onChange', this.props );
|
||||
} );
|
||||
}
|
||||
} )
|
||||
.catch( ( error ) => {
|
||||
if ( this.isStillMounted && fetchRequest === this.currentFetchRequest ) {
|
||||
onBeforeChange();
|
||||
doAction( 'sight.components.serverSideRender.onBeforeChange', this.props );
|
||||
|
||||
this.setState( {
|
||||
response: {
|
||||
error: true,
|
||||
errorMsg: error.message,
|
||||
},
|
||||
prevResponse: null,
|
||||
}, () => {
|
||||
onChange();
|
||||
doAction( 'sight.components.serverSideRender.onChange', this.props );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
return fetchRequest;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
response,
|
||||
prevResponse,
|
||||
} = this.state;
|
||||
|
||||
let { className } = this.props;
|
||||
|
||||
className = classnames(
|
||||
className,
|
||||
'sight-component-server-side-render'
|
||||
);
|
||||
|
||||
if ( response === '' ) {
|
||||
return (
|
||||
<Placeholder
|
||||
className={ className }
|
||||
>
|
||||
{ __( 'Block rendered as empty.' ) }
|
||||
</Placeholder>
|
||||
);
|
||||
} else if ( ! response && prevResponse ) {
|
||||
className = classnames(
|
||||
className,
|
||||
'sight-component-server-side-render-loading'
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={ className }>
|
||||
<Spinner />
|
||||
<RawHTML
|
||||
key="html"
|
||||
className="sight-component-server-side-render-content"
|
||||
>
|
||||
{ prevResponse }
|
||||
</RawHTML>
|
||||
</div>
|
||||
);
|
||||
} else if ( ! response ) {
|
||||
return (
|
||||
<Placeholder
|
||||
className={ className }
|
||||
>
|
||||
<Spinner />
|
||||
</Placeholder>
|
||||
);
|
||||
} else if ( response.error ) {
|
||||
// translators: %s: error message describing the problem
|
||||
const errorMessage = sprintf( __( 'Error loading block: %s' ), response.errorMsg );
|
||||
return (
|
||||
<Placeholder
|
||||
className={ className }
|
||||
>
|
||||
{ errorMessage }
|
||||
</Placeholder>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={ className }>
|
||||
<RawHTML
|
||||
key="html"
|
||||
className="sight-component-server-side-render-content"
|
||||
>
|
||||
{ response }
|
||||
</RawHTML>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ServerSideRender;
|
||||
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* Compare 2 values
|
||||
*
|
||||
* @param {mixed} lval Left value.
|
||||
* @param {string} operator Operator.
|
||||
* @param {mixed} rval Right value.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function compare( lval, operator, rval ) {
|
||||
let checkResult = true;
|
||||
|
||||
switch ( operator ) {
|
||||
case '==':
|
||||
checkResult = lval == rval;
|
||||
break;
|
||||
case '===':
|
||||
checkResult = lval === rval;
|
||||
break;
|
||||
case '!=':
|
||||
checkResult = lval != rval;
|
||||
break;
|
||||
case '!==':
|
||||
checkResult = lval !== rval;
|
||||
break;
|
||||
case '>=':
|
||||
checkResult = lval >= rval;
|
||||
break;
|
||||
case '<=':
|
||||
checkResult = lval <= rval;
|
||||
break;
|
||||
case '>':
|
||||
checkResult = lval > rval;
|
||||
break;
|
||||
case '<':
|
||||
checkResult = lval < rval;
|
||||
break;
|
||||
case 'AND':
|
||||
checkResult = lval && rval;
|
||||
break;
|
||||
case 'OR':
|
||||
checkResult = lval || rval;
|
||||
break;
|
||||
default:
|
||||
checkResult = lval;
|
||||
break;
|
||||
}
|
||||
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check condition
|
||||
*
|
||||
* @param {Object} conditions - Conditions array.
|
||||
* @param {Object} attributes - Available block attributes.
|
||||
* @param {string} relation - Can be one of 'AND' or 'OR'.
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function checkCondition( conditions, attributes, relation ) {
|
||||
const childRelation = ( 'AND' === relation ) ? 'OR' : 'AND';
|
||||
|
||||
// by default result will be TRUE for relation AND
|
||||
// and FALSE for relation OR.
|
||||
let result = relation === 'AND';
|
||||
|
||||
conditions.forEach( ( data ) => {
|
||||
if ( Array.isArray( data ) ) {
|
||||
result = compare( result, relation, checkCondition( data, attributes, childRelation ) );
|
||||
} else if ( data.field ) {
|
||||
const splitValName = data.field.split( '.' );
|
||||
let fieldVal = undefined;
|
||||
|
||||
// check for array values like:
|
||||
// toggleListName['option1']
|
||||
if ( 2 === splitValName.length && typeof attributes[ splitValName[ 0 ] ] !== 'undefined' && typeof attributes[ splitValName[ 0 ] ][ splitValName[ 1 ] ] !== 'undefined' ) {
|
||||
fieldVal = attributes[ splitValName[ 0 ] ][ splitValName[ 1 ] ];
|
||||
}
|
||||
|
||||
// check for normal values
|
||||
if ( typeof fieldVal === 'undefined' ) {
|
||||
fieldVal = attributes[ data.field ];
|
||||
}
|
||||
|
||||
// check count
|
||||
if ( typeof data.count !== 'undefined' ) {
|
||||
const count = fieldVal.split( data['count'] );
|
||||
fieldVal = count.length - 1;
|
||||
}
|
||||
|
||||
if ( typeof fieldVal !== 'undefined' ) {
|
||||
result = compare( result, relation, compare( fieldVal, data.operator, data.value ) );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check field visible.
|
||||
*/
|
||||
function isFieldVisible(key, config, attributes) {
|
||||
var visible;
|
||||
|
||||
// Set visible.
|
||||
visible = config.attributes[key]['visible'];
|
||||
|
||||
// Check active_callback in fields.
|
||||
if ( visible && config.attributes[key]['active_callback'] && config.attributes[key]['active_callback'].length ) {
|
||||
visible = checkCondition( config.attributes[key]['active_callback'], attributes, 'AND' );
|
||||
}
|
||||
|
||||
return visible;
|
||||
}
|
||||
|
||||
export { isFieldVisible };
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
addFilter,
|
||||
} = wp.hooks;
|
||||
|
||||
const {
|
||||
ToggleControl,
|
||||
SelectControl,
|
||||
} = wp.components;
|
||||
|
||||
/**
|
||||
* Add fields to Block Settings.
|
||||
*
|
||||
* @param {JSX} fields Original block.
|
||||
* @param {Object} props Block data.
|
||||
* @param {Object} config Block config.
|
||||
*
|
||||
* @return {JSX} Block.
|
||||
*/
|
||||
function setStandardBlockSettings(fields, props, config) {
|
||||
const {
|
||||
attributes,
|
||||
setAttributes,
|
||||
isFieldVisible,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ fields }
|
||||
|
||||
{ ( isFieldVisible('standard_filter_items', config, attributes) ) ? (
|
||||
<ToggleControl
|
||||
label={__("Display category filter")}
|
||||
checked={ attributes['standard_filter_items'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'standard_filter_items': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('standard_pagination_type', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Pagination type")}
|
||||
value={attributes['standard_pagination_type']}
|
||||
options={
|
||||
[
|
||||
{ value: 'none', label: __('None') },
|
||||
{ value: 'ajax', label: __('Load More') },
|
||||
{ value: 'infinite', label: __('Infinite Load') },
|
||||
]
|
||||
}
|
||||
onChange={function (val) {
|
||||
setAttributes({ 'standard_pagination_type': val });
|
||||
}}
|
||||
/>
|
||||
) : ( null ) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
addFilter('sight.blockSettings.fields', 'sight/standardBlockSettings/set/fields', setStandardBlockSettings, 15 );
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
addFilter,
|
||||
} = wp.hooks;
|
||||
|
||||
const {
|
||||
BaseControl,
|
||||
Placeholder,
|
||||
ToggleControl,
|
||||
TextControl,
|
||||
TextareaControl,
|
||||
SelectControl,
|
||||
RangeControl,
|
||||
PanelBody,
|
||||
Disabled,
|
||||
Notice,
|
||||
} = wp.components;
|
||||
|
||||
const {
|
||||
ColorPalette,
|
||||
} = wp.editor;
|
||||
/**
|
||||
* Add fields to Color Settings.
|
||||
*
|
||||
* @param {JSX} fields Original block.
|
||||
* @param {Object} props Block data.
|
||||
* @param {Object} config Block config.
|
||||
*
|
||||
* @return {JSX} Block.
|
||||
*/
|
||||
function setColorSettings(fields, props, config) {
|
||||
const {
|
||||
attributes,
|
||||
setAttributes,
|
||||
isFieldVisible,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ ( isFieldVisible('color_heading', config, attributes) ) ? (
|
||||
<BaseControl
|
||||
label={__("Heading Color")}
|
||||
>
|
||||
{ <ColorPalette
|
||||
value={ attributes['color_heading'] || '' }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'color_heading': val });
|
||||
} }
|
||||
/> }
|
||||
</BaseControl>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('color_heading_hover', config, attributes) ) ? (
|
||||
<BaseControl
|
||||
label={__("Heading Hover Color")}
|
||||
>
|
||||
{ <ColorPalette
|
||||
value={ attributes['color_heading_hover'] || '' }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'color_heading_hover': val });
|
||||
} }
|
||||
/> }
|
||||
</BaseControl>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('color_caption', config, attributes) ) ? (
|
||||
<BaseControl
|
||||
label={__("Caption Color")}
|
||||
>
|
||||
{ <ColorPalette
|
||||
value={ attributes['color_caption'] || '' }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'color_caption': val });
|
||||
} }
|
||||
/> }
|
||||
</BaseControl>
|
||||
) : ( null ) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
addFilter('sight.colorSettings.fields', 'sight/colorSettings/set/fields', setColorSettings, 10);
|
||||
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
addFilter,
|
||||
} = wp.hooks;
|
||||
|
||||
const {
|
||||
BaseControl,
|
||||
Placeholder,
|
||||
ToggleControl,
|
||||
TextControl,
|
||||
TextareaControl,
|
||||
SelectControl,
|
||||
RangeControl,
|
||||
PanelBody,
|
||||
Disabled,
|
||||
Notice,
|
||||
} = wp.components;
|
||||
|
||||
/**
|
||||
* Add fields to Media Settings.
|
||||
*
|
||||
* @param {JSX} fields Original block.
|
||||
* @param {Object} props Block data.
|
||||
* @param {Object} config Block config.
|
||||
*
|
||||
* @return {JSX} Block.
|
||||
*/
|
||||
function setMediaSettings(fields, props, config) {
|
||||
const {
|
||||
attributes,
|
||||
setAttributes,
|
||||
isFieldVisible,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ ( isFieldVisible('attachment_lightbox', config, attributes) ) ? (
|
||||
<ToggleControl
|
||||
label={__("Enable lightbox")}
|
||||
checked={ attributes['attachment_lightbox'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'attachment_lightbox': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('attachment_lightbox_icon', config, attributes) ) ? (
|
||||
<ToggleControl
|
||||
label={__("Display lightbox zoom icon")}
|
||||
checked={ attributes['attachment_lightbox_icon'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'attachment_lightbox_icon': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('attachment_link_to', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Link To")}
|
||||
value={ attributes['attachment_link_to'] }
|
||||
options={
|
||||
( 'categories' === attributes['source'] && ! config.archive ) ? [
|
||||
{ value: 'none', label: __('None') },
|
||||
{ value: 'media', label: __('Media File') },
|
||||
] : [
|
||||
{ value: 'none', label: __('None') },
|
||||
{ value: 'media', label: __('Media File') },
|
||||
{ value: 'page', label: __('Page') },
|
||||
]
|
||||
}
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'attachment_link_to': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('attachment_view_more', config, attributes) ) ? (
|
||||
<ToggleControl
|
||||
label={__("Enable view more")}
|
||||
checked={ attributes['attachment_view_more'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'attachment_view_more': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('attachment_size', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Size")}
|
||||
value={ attributes['attachment_size'] }
|
||||
options={ config.image_sizes }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'attachment_size': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('attachment_orientation', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Orientation")}
|
||||
value={ attributes['attachment_orientation'] }
|
||||
options={
|
||||
[
|
||||
{ value: 'original', label: __('Original') },
|
||||
{ value: 'landscape-4-3', label: __('Landscape 4:3') },
|
||||
{ value: 'landscape-3-2', label: __('Landscape 3:2') },
|
||||
{ value: 'landscape-16-9', label: __('Landscape 16:9') },
|
||||
{ value: 'portrait-3-4', label: __('Portrait 3:4') },
|
||||
{ value: 'portrait-2-3', label: __('Portrait 2:3') },
|
||||
{ value: 'square', label: __('Square') },
|
||||
]
|
||||
}
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'attachment_orientation': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
addFilter('sight.mediaSettings.fields', 'sight/mediaSettings/set/fields', setMediaSettings, 10);
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
addFilter,
|
||||
} = wp.hooks;
|
||||
|
||||
const {
|
||||
ToggleControl,
|
||||
RangeControl,
|
||||
} = wp.components;
|
||||
|
||||
|
||||
/**
|
||||
* Add fields to Meta Settings.
|
||||
*
|
||||
* @param {JSX} fields Original block.
|
||||
* @param {Object} props Block data.
|
||||
* @param {Object} config Block config.
|
||||
*
|
||||
* @return {JSX} Block.
|
||||
*/
|
||||
function setMetaSettings(fields, props, config) {
|
||||
const {
|
||||
attributes,
|
||||
setAttributes,
|
||||
isFieldVisible,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ ( isFieldVisible('meta_title', config, attributes) ) ? (
|
||||
<ToggleControl
|
||||
label={__("Display item title")}
|
||||
checked={ attributes['meta_title'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'meta_title': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('meta_caption', config, attributes) ) ? (
|
||||
<ToggleControl
|
||||
label={__("Display item caption")}
|
||||
checked={ attributes['meta_caption'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'meta_caption': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('meta_caption_length', config, attributes) ) ? (
|
||||
<RangeControl
|
||||
label={__("Caption length")}
|
||||
value={ attributes['meta_caption_length'] }
|
||||
min={ 1 }
|
||||
max={ 1000 }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'meta_caption_length': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('meta_category', config, attributes) ) ? (
|
||||
<ToggleControl
|
||||
label={__("Display meta category")}
|
||||
checked={ attributes['meta_category'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'meta_category': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('meta_date', config, attributes) ) ? (
|
||||
<ToggleControl
|
||||
label={__("Display meta date")}
|
||||
checked={ attributes['meta_date'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'meta_date': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
addFilter('sight.metaSettings.fields', 'sight/metaSettings/set/fields', setMetaSettings, 10);
|
||||
@@ -0,0 +1,168 @@
|
||||
/**
|
||||
* Components dependencies
|
||||
*/
|
||||
import ReactSelectControl from '../components/react-select-control';
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
addFilter,
|
||||
} = wp.hooks;
|
||||
|
||||
const {
|
||||
BaseControl,
|
||||
Placeholder,
|
||||
ToggleControl,
|
||||
TextControl,
|
||||
TextareaControl,
|
||||
SelectControl,
|
||||
RangeControl,
|
||||
PanelBody,
|
||||
Disabled,
|
||||
Notice,
|
||||
} = wp.components;
|
||||
|
||||
/**
|
||||
* Add fields to Query Settings.
|
||||
*
|
||||
* @param {JSX} fields Original block.
|
||||
* @param {Object} props Block data.
|
||||
* @param {Object} config Block config.
|
||||
*
|
||||
* @return {JSX} Block.
|
||||
*/
|
||||
function setQuerySettings(fields, props, config) {
|
||||
const {
|
||||
attributes,
|
||||
setAttributes,
|
||||
isFieldVisible,
|
||||
} = props;
|
||||
|
||||
if ( 'projects' !== attributes['source'] && 'categories' !== attributes['source'] ) {
|
||||
return fields;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ ( isFieldVisible('projects_filter_post_type', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Filter by Post Type")}
|
||||
value={ attributes['projects_filter_post_type'] }
|
||||
options={ config.post_types_stack }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'projects_filter_post_type': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('projects_filter_categories', config, attributes) ) ? (
|
||||
<ReactSelectControl
|
||||
label={__("Filter by Categories")}
|
||||
isMulti={ true }
|
||||
val={ attributes['projects_filter_categories'] }
|
||||
options={ config.categories_stack }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'projects_filter_categories': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('projects_filter_offset', config, attributes) ) ? (
|
||||
<TextControl
|
||||
label={__("Offset")}
|
||||
value={ attributes['projects_filter_offset'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'projects_filter_offset': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('projects_orderby', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Order By")}
|
||||
value={ attributes['projects_orderby'] }
|
||||
options={
|
||||
[
|
||||
{ value: 'date', label: __('Published Date') },
|
||||
{ value: 'modified', label: __('Modified Date') },
|
||||
{ value: 'title', label: __('Title') },
|
||||
{ value: 'rand', label: __('Random') },
|
||||
{ value: 'views', label: __('Views') },
|
||||
{ value: 'comment_count', label: __('Comment Count') },
|
||||
{ value: 'ID', label: __('ID') },
|
||||
]
|
||||
}
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'projects_orderby': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('projects_order', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Order")}
|
||||
value={ attributes['projects_order'] }
|
||||
options={
|
||||
[
|
||||
{ value: 'DESC', label: __('Descending') },
|
||||
{ value: 'ASC', label: __('Ascending') },
|
||||
]
|
||||
}
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'projects_order': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('categories_filter_ids', config, attributes) ) ? (
|
||||
<ReactSelectControl
|
||||
label={__("Filter by Categories")}
|
||||
isMulti={ true }
|
||||
val={ attributes['categories_filter_ids'] }
|
||||
options={ config.categories_stack }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'categories_filter_ids': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('categories_orderby', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Order By")}
|
||||
value={ attributes['categories_orderby'] }
|
||||
options={
|
||||
[
|
||||
{ value: 'name', label: __('Name') },
|
||||
{ value: 'count', label: __('Posts count') },
|
||||
{ value: 'include', label: __('Filter include') },
|
||||
{ value: 'id', label: __('ID') },
|
||||
]
|
||||
}
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'categories_orderby': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('categories_order', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Order")}
|
||||
value={ attributes['categories_order'] }
|
||||
options={
|
||||
[
|
||||
{ value: 'DESC', label: __('Descending') },
|
||||
{ value: 'ASC', label: __('Ascending') },
|
||||
]
|
||||
}
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'categories_order': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
addFilter('sight.querySettings.fields', 'sight/querySettings/set/fields', setQuerySettings, 10);
|
||||
@@ -0,0 +1,135 @@
|
||||
/**
|
||||
* Components dependencies
|
||||
*/
|
||||
import PostsSelectorControl from '../components/posts-selector-control';
|
||||
import GalleryControl from '../components/gallery-control';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import './style-panel-settings.scss';
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
addFilter,
|
||||
} = wp.hooks;
|
||||
|
||||
const {
|
||||
ToggleControl,
|
||||
SelectControl,
|
||||
RangeControl,
|
||||
} = wp.components;
|
||||
|
||||
/**
|
||||
* Add fields to Block Settings.
|
||||
*
|
||||
* @param {JSX} fields Original block.
|
||||
* @param {Object} props Block data.
|
||||
* @param {Object} config Block config.
|
||||
*
|
||||
* @return {JSX} Block.
|
||||
*/
|
||||
function setBlockSettings(fields, props, config) {
|
||||
const {
|
||||
attributes,
|
||||
setAttributes,
|
||||
isFieldVisible,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ ( isFieldVisible('source', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Source")}
|
||||
value={attributes['source']}
|
||||
options={
|
||||
[
|
||||
{ value: 'projects', label: __('Projects') },
|
||||
{ value: 'custom', label: __('Images') },
|
||||
{ value: 'categories', label: __('Categories') },
|
||||
{ value: 'post', label: __('Post Attachments') },
|
||||
]
|
||||
}
|
||||
onChange={function (val) {
|
||||
setAttributes({ 'source': val });
|
||||
}}
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
|
||||
{/* Type Projects */}
|
||||
|
||||
{ ( isFieldVisible('video', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Video Background")}
|
||||
value={attributes['video']}
|
||||
options={
|
||||
[
|
||||
{ value: 'none', label: __('None') },
|
||||
{ value: 'always', label: __('Always') },
|
||||
{ value: 'hover', label: __('On Hover') },
|
||||
]
|
||||
}
|
||||
onChange={function (val) {
|
||||
setAttributes({ 'video': val });
|
||||
}}
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('video_controls', config, attributes) ) ? (
|
||||
<ToggleControl
|
||||
label={__("Enable video controls")}
|
||||
checked={attributes['video_controls']}
|
||||
onChange={function (val) {
|
||||
setAttributes({ 'video_controls': val });
|
||||
}}
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{/* Post */}
|
||||
|
||||
{ ( isFieldVisible('custom_post', config, attributes) ) ? (
|
||||
<PostsSelectorControl
|
||||
label={__("Post")}
|
||||
isMulti={true}
|
||||
value={attributes['custom_post']}
|
||||
onChange={function (val) {
|
||||
setAttributes({ 'custom_post': val });
|
||||
}}
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
|
||||
{/* Type Custom */}
|
||||
|
||||
{ ( isFieldVisible('custom_images', config, attributes) ) ? (
|
||||
<GalleryControl
|
||||
label={__("Images")}
|
||||
val={attributes['custom_images']}
|
||||
onChange={function (val) {
|
||||
setAttributes({ 'custom_images': val });
|
||||
}}
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{/* Common end */}
|
||||
|
||||
{ ( isFieldVisible('number_items', config, attributes) ) ? (
|
||||
<RangeControl
|
||||
label={__("Number of Items")}
|
||||
value={attributes['number_items']}
|
||||
min={1}
|
||||
max={100}
|
||||
onChange={function (val) {
|
||||
setAttributes({ 'number_items': val });
|
||||
}}
|
||||
/>
|
||||
) : ( null ) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
addFilter('sight.blockSettings.fields', 'sight/blockSettings/set/fields', setBlockSettings, 10);
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* Components dependencies
|
||||
*/
|
||||
import DimensionControl from '../components/dimension-control';
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
const {
|
||||
addFilter,
|
||||
} = wp.hooks;
|
||||
|
||||
const {
|
||||
BaseControl,
|
||||
Placeholder,
|
||||
ToggleControl,
|
||||
TextControl,
|
||||
TextareaControl,
|
||||
SelectControl,
|
||||
RangeControl,
|
||||
PanelBody,
|
||||
Disabled,
|
||||
Notice,
|
||||
} = wp.components;
|
||||
/**
|
||||
* Add fields to Typography Settings.
|
||||
*
|
||||
* @param {JSX} fields Original block.
|
||||
* @param {Object} props Block data.
|
||||
* @param {Object} config Block config.
|
||||
*
|
||||
* @return {JSX} Block.
|
||||
*/
|
||||
function setTypographySettings(fields, props, config) {
|
||||
const {
|
||||
attributes,
|
||||
setAttributes,
|
||||
isFieldVisible,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ ( isFieldVisible('typography_heading', config, attributes) ) ? (
|
||||
<DimensionControl
|
||||
label={__("Heading Font Size")}
|
||||
value={ attributes['typography_heading'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'typography_heading': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('typography_heading_tag', config, attributes) ) ? (
|
||||
<SelectControl
|
||||
label={__("Heading Tag")}
|
||||
value={attributes['typography_heading_tag']}
|
||||
options={
|
||||
[
|
||||
{ value: 'h1', label: __('H1') },
|
||||
{ value: 'h2', label: __('H2') },
|
||||
{ value: 'h3', label: __('H3') },
|
||||
{ value: 'h4', label: __('H4') },
|
||||
{ value: 'h5', label: __('H5') },
|
||||
{ value: 'h6', label: __('H6') },
|
||||
{ value: 'p', label: __('P') },
|
||||
{ value: 'div', label: __('DIV') },
|
||||
]
|
||||
}
|
||||
onChange={function (val) {
|
||||
setAttributes({ 'typography_heading_tag': val });
|
||||
}}
|
||||
/>
|
||||
) : ( null ) }
|
||||
|
||||
{ ( isFieldVisible('typography_caption', config, attributes) ) ? (
|
||||
<DimensionControl
|
||||
label={__("Caption Font Size")}
|
||||
value={ attributes['typography_caption'] }
|
||||
onChange={ function(val){
|
||||
setAttributes({ 'typography_caption': val });
|
||||
} }
|
||||
/>
|
||||
) : ( null ) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
addFilter('sight.typographySettings.fields', 'sight/typographySettings/set/fields', setTypographySettings, 10);
|
||||
@@ -0,0 +1 @@
|
||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=41)}({41:function(e,t,n){e.exports=n(42)},42:function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=l(e);if(t){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function c(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=wp.i18n.__,b=wp.compose.compose,d=wp.element.Component,y=wp.components,m=y.BaseControl,g=y.Button,_=y.TextControl,h=y.RangeControl,v=wp.editor,O=v.MediaUpload,w=v.MediaUploadCheck,j=wp.editPost.PluginDocumentSettingPanel,P=wp.data,S=P.withSelect,E=P.withDispatch,x=wp.plugins.registerPlugin;if("sight-projects"===sightVideoSettings.postType){var C=S((function(e){return{meta:(0,e("core/editor").getEditedPostAttribute)("meta")}})),T=E((function(e,t){var n=t.meta,r=e("core/editor").editPost;return{updateMeta:function(e){r({meta:p(p({},n),e)})}}})),M=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(a,e);var t,n,c,l=u(a);function a(){return r(this,a),l.apply(this,arguments)}return t=a,(n=[{key:"render",value:function(){var e=this.props,t=e.meta,n=(t=void 0===t?{}:t).sight_post_video_url,r=t.sight_post_video_bg_start_time,o=t.sight_post_video_bg_end_time,i=e.updateMeta;return wp.element.createElement(j,{title:s("Video Background","sight")},wp.element.createElement(m,null,wp.element.createElement(_,{label:s("Local or YouTube URL","sight"),value:n,onChange:function(e){i({sight_post_video_url:e||""})}}),wp.element.createElement(w,null,wp.element.createElement(O,{onSelect:function(e){i({sight_post_video_url:e.url||""})},accept:"video/mp4",allowedTypes:["video"],render:function(e){var t=e.open;return wp.element.createElement(g,{isSecondary:!0,onClick:t},s("Select Video File","sight"))}}))),wp.element.createElement(h,{label:s("Start Time (sec)","sight"),value:r,onChange:function(e){i({sight_post_video_bg_start_time:e||0})},step:1,min:0,max:1e4}),wp.element.createElement(h,{label:s("End Time (sec)","sight"),value:o,onChange:function(e){i({sight_post_video_bg_end_time:e||0})},step:1,min:0,max:1e4}))}}])&&o(t.prototype,n),c&&o(t,c),a}(d);x("sight-video-options",{icon:!1,render:b([C,T])(M)})}}});
|
||||
@@ -0,0 +1,104 @@
|
||||
const { __ } = wp.i18n;
|
||||
const { compose } = wp.compose;
|
||||
const { Component } = wp.element;
|
||||
const { BaseControl, Button, TextControl, RangeControl } = wp.components;
|
||||
const { MediaUpload, MediaUploadCheck } = wp.editor;
|
||||
const { PluginDocumentSettingPanel } = wp.editPost;
|
||||
const { withSelect, withDispatch, } = wp.data;
|
||||
const { registerPlugin } = wp.plugins;
|
||||
|
||||
if ( 'sight-projects' === sightVideoSettings.postType ) {
|
||||
// Fetch the post meta.
|
||||
const applyWithSelect = withSelect( ( select ) => {
|
||||
const { getEditedPostAttribute } = select( 'core/editor' );
|
||||
|
||||
return {
|
||||
meta: getEditedPostAttribute( 'meta' ),
|
||||
};
|
||||
} );
|
||||
|
||||
// Provide method to update post meta.
|
||||
const applyWithDispatch = withDispatch( ( dispatch, { meta } ) => {
|
||||
const { editPost } = dispatch( 'core/editor' );
|
||||
|
||||
return {
|
||||
updateMeta( newMeta ) {
|
||||
editPost( { meta: { ...meta, ...newMeta } } );
|
||||
},
|
||||
};
|
||||
} );
|
||||
|
||||
// Create Component.
|
||||
class ThemeVideoOptions extends Component {
|
||||
render() {
|
||||
const {
|
||||
meta: {
|
||||
sight_post_video_url: sight_post_video_url,
|
||||
sight_post_video_bg_start_time: sight_post_video_bg_start_time,
|
||||
sight_post_video_bg_end_time: sight_post_video_bg_end_time,
|
||||
} = {},
|
||||
updateMeta,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<PluginDocumentSettingPanel title={__("Video Background", "sight")}>
|
||||
<BaseControl>
|
||||
<TextControl
|
||||
label={__('Local or YouTube URL', 'sight')}
|
||||
value={ sight_post_video_url }
|
||||
onChange={ ( value ) => {
|
||||
updateMeta( { sight_post_video_url: value || '' } );
|
||||
} }
|
||||
/>
|
||||
|
||||
<MediaUploadCheck>
|
||||
<MediaUpload
|
||||
onSelect={ ( media ) => {
|
||||
updateMeta( { sight_post_video_url: media.url || '' } );
|
||||
} }
|
||||
accept="video/mp4"
|
||||
allowedTypes={ [ 'video' ] }
|
||||
render={ ( { open } ) => (
|
||||
<Button isSecondary onClick={ open }>
|
||||
{__('Select Video File', "sight")}
|
||||
</Button>
|
||||
) }
|
||||
/>
|
||||
</MediaUploadCheck>
|
||||
</BaseControl>
|
||||
|
||||
<RangeControl
|
||||
label={__('Start Time (sec)', 'sight')}
|
||||
value={ sight_post_video_bg_start_time }
|
||||
onChange={ ( value ) => {
|
||||
updateMeta( { sight_post_video_bg_start_time: value || 0 } );
|
||||
} }
|
||||
step={1}
|
||||
min={0}
|
||||
max={10000}
|
||||
/>
|
||||
|
||||
<RangeControl
|
||||
label={__('End Time (sec)', 'sight')}
|
||||
value={ sight_post_video_bg_end_time }
|
||||
onChange={ ( value ) => {
|
||||
updateMeta( { sight_post_video_bg_end_time: value || 0 } );
|
||||
} }
|
||||
step={1}
|
||||
min={0}
|
||||
max={10000}
|
||||
/>
|
||||
</PluginDocumentSettingPanel>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Combine the higher-order components.
|
||||
const render = compose( [
|
||||
applyWithSelect,
|
||||
applyWithDispatch
|
||||
] )( ThemeVideoOptions );
|
||||
|
||||
// Register panel.
|
||||
registerPlugin( 'sight-video-options', { icon: false, render } );
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<?php // Silence is golden
|
||||
@@ -0,0 +1,481 @@
|
||||
# Copyright (C) 2022 sight
|
||||
# This file is distributed under the same license as the sight package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: sight\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language-Team: Code Supply Co. <hello@codesupply.co>\n"
|
||||
"Last-Translator: Code Supply Co. <hello@codesupply.co>\n"
|
||||
"Report-Msgid-Bugs-To: https://codesupply.co/contact/\n"
|
||||
"X-Poedit-Basepath: ..\n"
|
||||
"X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: core/class-sight.php:57
|
||||
msgid "Sight"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-plugin-functions.php:167
|
||||
msgid "Full"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-plugin-functions.php:475
|
||||
msgid "View on YouTube"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-category-fields.php:36, core/core-register-category-fields.php:66
|
||||
msgid "Featured Image"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-category-fields.php:38, core/core-register-category-fields.php:69
|
||||
msgid "Select or upload image"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-category-fields.php:38, core/core-register-category-fields.php:69
|
||||
msgid "Set image"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-category-fields.php:44, core/core-register-category-fields.php:84
|
||||
msgid "Upload image"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-category-fields.php:45, core/core-register-category-fields.php:85
|
||||
msgid "Remove image"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-category-fields.php:89
|
||||
msgid "This image is used in the category blocks."
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:20, core/core-register-post-types.php:22, elementor/widget-portfolio.php:161
|
||||
msgid "Projects"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:21
|
||||
msgid "Project"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:23
|
||||
msgid "Parent Project"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:24
|
||||
msgid "All Projects"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:25, render/sight-entry.php:310
|
||||
msgid "View Project"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:26
|
||||
msgid "Add New Project"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:27
|
||||
msgid "Add New"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:28
|
||||
msgid "Edit Project"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:29
|
||||
msgid "Update Project"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:30
|
||||
msgid "Search Project"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:31
|
||||
msgid "Not Found"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:32
|
||||
msgid "Not found in Trash"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:62, core/core-register-post-types.php:63, core/core-register-post-types.php:73, elementor/widget-portfolio.php:163, render/handler/post-area-projects.php:99
|
||||
msgid "Categories"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:64
|
||||
msgid "Search Categories"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:65
|
||||
msgid "All Categories"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:66
|
||||
msgid "View Category"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:67
|
||||
msgid "Parent Category"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:68
|
||||
msgid "Parent Category:"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:69
|
||||
msgid "Edit Category"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:70
|
||||
msgid "Update Category"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:71
|
||||
msgid "Add New Category"
|
||||
msgstr ""
|
||||
|
||||
#: core/core-register-post-types.php:72
|
||||
msgid "New Types Name"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/control-custom-post.php:40
|
||||
msgid "Custom Post"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:47, gutenberg/block-portfolio.php:482
|
||||
msgid "Portfolio"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:87, gutenberg/block-portfolio.php:31
|
||||
msgid "Standard"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:127, elementor/widget-portfolio.php:136
|
||||
msgid "Layout"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:148
|
||||
msgid "General Settings"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:157
|
||||
msgid "Source"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:162, elementor/widget-portfolio.php:245
|
||||
msgid "Images"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:164
|
||||
msgid "Post Attachments"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:174
|
||||
msgid "Video Background"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:178, elementor/widget-portfolio.php:437, elementor/widget-portfolio.php:1069
|
||||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:179
|
||||
msgid "Always"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:180
|
||||
msgid "On Hover"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:198
|
||||
msgid "Enable video controls"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:225
|
||||
msgid "Post"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:265
|
||||
msgid "Number of Items"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:281
|
||||
msgid "Meta Settings"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:290
|
||||
msgid "Display item title"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:315
|
||||
msgid "Display item caption"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:325
|
||||
msgid "Caption length"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:347
|
||||
msgid "Display meta category"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:371
|
||||
msgid "Display meta date"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:394
|
||||
msgid "Media Settings"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:403
|
||||
msgid "Enable lightbox"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:412
|
||||
msgid "Display lightbox zoom icon"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:432
|
||||
msgid "Link To"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:433
|
||||
msgid "If the source is \"Categories\" then the \"Page\" value will be ignored."
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:438
|
||||
msgid "Media File"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:439
|
||||
msgid "Page"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:457
|
||||
msgid "Enable view more"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:481
|
||||
msgid "Size"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:491
|
||||
msgid "Orientation"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:495
|
||||
msgid "Original"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:496
|
||||
msgid "Landscape 4:3"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:497
|
||||
msgid "Landscape 3:2"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:498
|
||||
msgid "Landscape 16:9"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:499
|
||||
msgid "Portrait 3:4"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:500
|
||||
msgid "Portrait 2:3"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:501
|
||||
msgid "Square"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:513
|
||||
msgid "Typography Settings"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:522
|
||||
msgid "Heading Font Size"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:551
|
||||
msgid "Heading Tag"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:555
|
||||
msgid "H1"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:556
|
||||
msgid "H2"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:557
|
||||
msgid "H3"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:558
|
||||
msgid "H4"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:559
|
||||
msgid "H5"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:560
|
||||
msgid "H6"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:561
|
||||
msgid "P"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:562
|
||||
msgid "DIV"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:590
|
||||
msgid "Caption Font Size"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:613
|
||||
msgid "Query Settings"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:637
|
||||
msgid "Filter by Post Type"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:657, elementor/widget-portfolio.php:751
|
||||
msgid "Filter by Categories"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:682
|
||||
msgid "Offset"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:700, elementor/widget-portfolio.php:770
|
||||
msgid "Order By"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:704
|
||||
msgid "Published Date"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:705
|
||||
msgid "Modified Date"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:706
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:707
|
||||
msgid "Random"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:708
|
||||
msgid "Views"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:709
|
||||
msgid "Comment Count"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:710, elementor/widget-portfolio.php:777
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:728, elementor/widget-portfolio.php:795
|
||||
msgid "Order"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:732, elementor/widget-portfolio.php:799
|
||||
msgid "Descending"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:733, elementor/widget-portfolio.php:800
|
||||
msgid "Ascending"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:774
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:775
|
||||
msgid "Posts count"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:776
|
||||
msgid "Filter include"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:822
|
||||
msgid "Color Settings"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:831
|
||||
msgid "Heading Color"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:859
|
||||
msgid "Heading Hover Color"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:887
|
||||
msgid "Caption Color"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:1035
|
||||
msgid "Display category filter"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:1065
|
||||
msgid "Pagination type"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:1070
|
||||
msgid "Load More"
|
||||
msgstr ""
|
||||
|
||||
#: elementor/widget-portfolio.php:1071
|
||||
msgid "Infinite Load"
|
||||
msgstr ""
|
||||
|
||||
#: render/sight-entry.php:307
|
||||
msgid "View Media"
|
||||
msgstr ""
|
||||
|
||||
#: render/sight-load-more.php:84
|
||||
msgid "Load more"
|
||||
msgstr ""
|
||||
|
||||
#: render/sight-load-more.php:85, render/sight-render.php:55
|
||||
msgid "Loading"
|
||||
msgstr ""
|
||||
|
||||
#: render/sight-render.php:52
|
||||
msgid "Previous"
|
||||
msgstr ""
|
||||
|
||||
#: render/sight-render.php:53
|
||||
msgid "Next"
|
||||
msgstr ""
|
||||
|
||||
#: render/sight-render.php:54
|
||||
msgid "Close"
|
||||
msgstr ""
|
||||
|
||||
#: render/sight-render.php:56
|
||||
msgid "of"
|
||||
msgstr ""
|
||||
|
||||
#: render/handler/post-area-none.php:17
|
||||
msgid "It looks like your portfolio is empty. Please add new projects to your portfolio."
|
||||
msgstr ""
|
||||
|
||||
#: render/handler/post-area-projects.php:105
|
||||
msgid "All"
|
||||
msgstr ""
|
||||
@@ -0,0 +1,427 @@
|
||||
/* Magnific Popup CSS */
|
||||
.mfp-bg {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1042;
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
background: var(--mfp-overlay-color, #FFFFFF);
|
||||
opacity: var(--mfp-overlay-opacity, 1);
|
||||
}
|
||||
|
||||
.mfp-wrap {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1043;
|
||||
position: fixed;
|
||||
outline: none !important;
|
||||
-webkit-backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.mfp-container {
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
right: 0;
|
||||
top: 0;
|
||||
padding: 0 8px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.mfp-container:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.mfp-align-top .mfp-container:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mfp-content {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin: 0 auto;
|
||||
text-align: right;
|
||||
z-index: 1045;
|
||||
}
|
||||
|
||||
.mfp-inline-holder .mfp-content,
|
||||
.mfp-ajax-holder .mfp-content {
|
||||
width: 100%;
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.mfp-ajax-cur {
|
||||
cursor: progress;
|
||||
}
|
||||
|
||||
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
||||
cursor: zoom-out;
|
||||
}
|
||||
|
||||
.mfp-zoom {
|
||||
cursor: pointer;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
.mfp-auto-cursor .mfp-content {
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.mfp-close,
|
||||
.mfp-arrow,
|
||||
.mfp-preloader,
|
||||
.mfp-counter {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.mfp-loading.mfp-figure {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mfp-hide {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.mfp-preloader {
|
||||
color: var(--mfp-controls-text-color, #3D3D3D);
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: auto;
|
||||
text-align: center;
|
||||
margin-top: -0.8em;
|
||||
right: 8px;
|
||||
left: 8px;
|
||||
z-index: 1044;
|
||||
}
|
||||
|
||||
.mfp-preloader a {
|
||||
color: var(--mfp-controls-text-color, #3D3D3D);
|
||||
}
|
||||
|
||||
.mfp-preloader a:hover {
|
||||
color: var(--mfp-controls-text-color-hover, #000000);
|
||||
}
|
||||
|
||||
.mfp-s-ready .mfp-preloader {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mfp-s-error .mfp-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button.mfp-close, button.mfp-arrow {
|
||||
overflow: visible;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
z-index: 1046;
|
||||
box-shadow: none;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
button::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.mfp-close {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
opacity: 0.65;
|
||||
padding: 0 10px 18px 0;
|
||||
color: var(--mfp-controls-color, #000000);
|
||||
font-style: normal;
|
||||
font-size: 28px;
|
||||
font-family: Arial, Baskerville, monospace;
|
||||
}
|
||||
|
||||
.mfp-close:hover, .mfp-close:focus {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mfp-close:active {
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
.mfp-close-btn-in .mfp-close {
|
||||
color: var(--mfp-inner-close-icon-color, #E0E0E0);
|
||||
}
|
||||
|
||||
.mfp-image-holder .mfp-close,
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
color: var(--mfp-controls-color, #000000);
|
||||
left: -6px;
|
||||
text-align: left;
|
||||
padding-left: 6px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mfp-counter {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
color: var(--mfp-controls-text-color, #3D3D3D);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mfp-arrow {
|
||||
position: absolute;
|
||||
opacity: 0.65;
|
||||
margin: 0;
|
||||
top: 50%;
|
||||
margin-top: -55px;
|
||||
padding: 0;
|
||||
width: 90px;
|
||||
height: 110px;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.mfp-arrow:active {
|
||||
margin-top: -54px;
|
||||
}
|
||||
|
||||
.mfp-arrow:hover, .mfp-arrow:focus {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mfp-arrow:before, .mfp-arrow:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
margin-top: 35px;
|
||||
margin-right: 35px;
|
||||
border: medium inset transparent;
|
||||
}
|
||||
|
||||
.mfp-arrow:after {
|
||||
border-top-width: 13px;
|
||||
border-bottom-width: 13px;
|
||||
top: 8px;
|
||||
}
|
||||
|
||||
.mfp-arrow:before {
|
||||
border-top-width: 21px;
|
||||
border-bottom-width: 21px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.mfp-arrow-left {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.mfp-arrow-left:after {
|
||||
border-left: 17px solid var(--mfp-controls-color, #000000);
|
||||
margin-right: 31px;
|
||||
}
|
||||
|
||||
.mfp-arrow-left:before {
|
||||
margin-right: 25px;
|
||||
border-left: 27px solid var(--mfp-controls-border-color, #FFFFFF);
|
||||
}
|
||||
|
||||
.mfp-arrow-right {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.mfp-arrow-right:after {
|
||||
border-right: 17px solid var(--mfp-controls-color, #000000);
|
||||
margin-right: 39px;
|
||||
}
|
||||
|
||||
.mfp-arrow-right:before {
|
||||
border-right: 27px solid var(--mfp-controls-border-color, #FFFFFF);
|
||||
}
|
||||
|
||||
.mfp-iframe-holder {
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.mfp-iframe-holder .mfp-content {
|
||||
line-height: 0;
|
||||
width: 100%;
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
top: -40px;
|
||||
}
|
||||
|
||||
.mfp-iframe-scaler {
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
padding-top: 56.25%;
|
||||
}
|
||||
|
||||
.mfp-iframe-scaler iframe {
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-shadow: var(--mfp-shadow, none);
|
||||
background: var(--mfp-iframe-background, #FFFFFF);
|
||||
}
|
||||
|
||||
/* Main image in popup */
|
||||
img.mfp-img {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
line-height: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 40px 0 40px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* The shadow behind the image */
|
||||
.mfp-figure {
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.mfp-figure:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 40px;
|
||||
bottom: 40px;
|
||||
display: block;
|
||||
left: 0;
|
||||
width: auto;
|
||||
height: auto;
|
||||
z-index: -1;
|
||||
box-shadow: var(--mfp-shadow, none);
|
||||
background: var(--mfp-image-background, #E6E6E6);
|
||||
}
|
||||
|
||||
.mfp-figure small {
|
||||
color: var(--mfp-caption-subtitle-color, #434343);
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
.mfp-figure figure {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.mfp-bottom-bar {
|
||||
margin-top: -36px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.mfp-title {
|
||||
text-align: right;
|
||||
line-height: 18px;
|
||||
color: var(--mfp-caption-title-color, #000000);
|
||||
word-wrap: break-word;
|
||||
padding-left: 36px;
|
||||
}
|
||||
|
||||
.mfp-image-holder .mfp-content {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.mfp-gallery .mfp-image-holder .mfp-figure {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
|
||||
/**
|
||||
* Remove all paddings around the image on small screen
|
||||
*/
|
||||
.mfp-img-mobile .mfp-image-holder {
|
||||
padding-right: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
.mfp-img-mobile img.mfp-img {
|
||||
padding: 0;
|
||||
}
|
||||
.mfp-img-mobile .mfp-figure:after {
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.mfp-img-mobile .mfp-figure small {
|
||||
display: inline;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.mfp-img-mobile .mfp-bottom-bar {
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
top: auto;
|
||||
padding: 3px 5px;
|
||||
position: fixed;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.mfp-img-mobile .mfp-bottom-bar:empty {
|
||||
padding: 0;
|
||||
}
|
||||
.mfp-img-mobile .mfp-counter {
|
||||
left: 5px;
|
||||
top: 3px;
|
||||
}
|
||||
.mfp-img-mobile .mfp-close {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 900px) {
|
||||
.mfp-arrow {
|
||||
transform: scale(0.75);
|
||||
}
|
||||
.mfp-arrow-left {
|
||||
transform-origin: 0;
|
||||
}
|
||||
.mfp-arrow-right {
|
||||
transform-origin: 100%;
|
||||
}
|
||||
.mfp-container {
|
||||
padding-right: 6px;
|
||||
padding-left: 6px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,427 @@
|
||||
/* Magnific Popup CSS */
|
||||
.mfp-bg {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1042;
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
background: var(--mfp-overlay-color, #FFFFFF);
|
||||
opacity: var(--mfp-overlay-opacity, 1);
|
||||
}
|
||||
|
||||
.mfp-wrap {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1043;
|
||||
position: fixed;
|
||||
outline: none !important;
|
||||
-webkit-backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.mfp-container {
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
padding: 0 8px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.mfp-container:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.mfp-align-top .mfp-container:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mfp-content {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
z-index: 1045;
|
||||
}
|
||||
|
||||
.mfp-inline-holder .mfp-content,
|
||||
.mfp-ajax-holder .mfp-content {
|
||||
width: 100%;
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.mfp-ajax-cur {
|
||||
cursor: progress;
|
||||
}
|
||||
|
||||
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
||||
cursor: zoom-out;
|
||||
}
|
||||
|
||||
.mfp-zoom {
|
||||
cursor: pointer;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
.mfp-auto-cursor .mfp-content {
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.mfp-close,
|
||||
.mfp-arrow,
|
||||
.mfp-preloader,
|
||||
.mfp-counter {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.mfp-loading.mfp-figure {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mfp-hide {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.mfp-preloader {
|
||||
color: var(--mfp-controls-text-color, #3D3D3D);
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: auto;
|
||||
text-align: center;
|
||||
margin-top: -0.8em;
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
z-index: 1044;
|
||||
}
|
||||
|
||||
.mfp-preloader a {
|
||||
color: var(--mfp-controls-text-color, #3D3D3D);
|
||||
}
|
||||
|
||||
.mfp-preloader a:hover {
|
||||
color: var(--mfp-controls-text-color-hover, #000000);
|
||||
}
|
||||
|
||||
.mfp-s-ready .mfp-preloader {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mfp-s-error .mfp-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button.mfp-close, button.mfp-arrow {
|
||||
overflow: visible;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
z-index: 1046;
|
||||
box-shadow: none;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
button::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.mfp-close {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
opacity: 0.65;
|
||||
padding: 0 0 18px 10px;
|
||||
color: var(--mfp-controls-color, #000000);
|
||||
font-style: normal;
|
||||
font-size: 28px;
|
||||
font-family: Arial, Baskerville, monospace;
|
||||
}
|
||||
|
||||
.mfp-close:hover, .mfp-close:focus {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mfp-close:active {
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
.mfp-close-btn-in .mfp-close {
|
||||
color: var(--mfp-inner-close-icon-color, #E0E0E0);
|
||||
}
|
||||
|
||||
.mfp-image-holder .mfp-close,
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
color: var(--mfp-controls-color, #000000);
|
||||
right: -6px;
|
||||
text-align: right;
|
||||
padding-right: 6px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mfp-counter {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
color: var(--mfp-controls-text-color, #3D3D3D);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mfp-arrow {
|
||||
position: absolute;
|
||||
opacity: 0.65;
|
||||
margin: 0;
|
||||
top: 50%;
|
||||
margin-top: -55px;
|
||||
padding: 0;
|
||||
width: 90px;
|
||||
height: 110px;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.mfp-arrow:active {
|
||||
margin-top: -54px;
|
||||
}
|
||||
|
||||
.mfp-arrow:hover, .mfp-arrow:focus {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mfp-arrow:before, .mfp-arrow:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
margin-top: 35px;
|
||||
margin-left: 35px;
|
||||
border: medium inset transparent;
|
||||
}
|
||||
|
||||
.mfp-arrow:after {
|
||||
border-top-width: 13px;
|
||||
border-bottom-width: 13px;
|
||||
top: 8px;
|
||||
}
|
||||
|
||||
.mfp-arrow:before {
|
||||
border-top-width: 21px;
|
||||
border-bottom-width: 21px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.mfp-arrow-left {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.mfp-arrow-left:after {
|
||||
border-right: 17px solid var(--mfp-controls-color, #000000);
|
||||
margin-left: 31px;
|
||||
}
|
||||
|
||||
.mfp-arrow-left:before {
|
||||
margin-left: 25px;
|
||||
border-right: 27px solid var(--mfp-controls-border-color, #FFFFFF);
|
||||
}
|
||||
|
||||
.mfp-arrow-right {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.mfp-arrow-right:after {
|
||||
border-left: 17px solid var(--mfp-controls-color, #000000);
|
||||
margin-left: 39px;
|
||||
}
|
||||
|
||||
.mfp-arrow-right:before {
|
||||
border-left: 27px solid var(--mfp-controls-border-color, #FFFFFF);
|
||||
}
|
||||
|
||||
.mfp-iframe-holder {
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.mfp-iframe-holder .mfp-content {
|
||||
line-height: 0;
|
||||
width: 100%;
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
top: -40px;
|
||||
}
|
||||
|
||||
.mfp-iframe-scaler {
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
padding-top: 56.25%;
|
||||
}
|
||||
|
||||
.mfp-iframe-scaler iframe {
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-shadow: var(--mfp-shadow, none);
|
||||
background: var(--mfp-iframe-background, #FFFFFF);
|
||||
}
|
||||
|
||||
/* Main image in popup */
|
||||
img.mfp-img {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
line-height: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 40px 0 40px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* The shadow behind the image */
|
||||
.mfp-figure {
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.mfp-figure:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 40px;
|
||||
bottom: 40px;
|
||||
display: block;
|
||||
right: 0;
|
||||
width: auto;
|
||||
height: auto;
|
||||
z-index: -1;
|
||||
box-shadow: var(--mfp-shadow, none);
|
||||
background: var(--mfp-image-background, #E6E6E6);
|
||||
}
|
||||
|
||||
.mfp-figure small {
|
||||
color: var(--mfp-caption-subtitle-color, #434343);
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
.mfp-figure figure {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.mfp-bottom-bar {
|
||||
margin-top: -36px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.mfp-title {
|
||||
text-align: left;
|
||||
line-height: 18px;
|
||||
color: var(--mfp-caption-title-color, #000000);
|
||||
word-wrap: break-word;
|
||||
padding-right: 36px;
|
||||
}
|
||||
|
||||
.mfp-image-holder .mfp-content {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.mfp-gallery .mfp-image-holder .mfp-figure {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
|
||||
/**
|
||||
* Remove all paddings around the image on small screen
|
||||
*/
|
||||
.mfp-img-mobile .mfp-image-holder {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
.mfp-img-mobile img.mfp-img {
|
||||
padding: 0;
|
||||
}
|
||||
.mfp-img-mobile .mfp-figure:after {
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.mfp-img-mobile .mfp-figure small {
|
||||
display: inline;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.mfp-img-mobile .mfp-bottom-bar {
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
top: auto;
|
||||
padding: 3px 5px;
|
||||
position: fixed;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.mfp-img-mobile .mfp-bottom-bar:empty {
|
||||
padding: 0;
|
||||
}
|
||||
.mfp-img-mobile .mfp-counter {
|
||||
right: 5px;
|
||||
top: 3px;
|
||||
}
|
||||
.mfp-img-mobile .mfp-close {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 900px) {
|
||||
.mfp-arrow {
|
||||
transform: scale(0.75);
|
||||
}
|
||||
.mfp-arrow-left {
|
||||
transform-origin: 0;
|
||||
}
|
||||
.mfp-arrow-right {
|
||||
transform-origin: 100%;
|
||||
}
|
||||
.mfp-container {
|
||||
padding-left: 6px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/* Icons */
|
||||
/* Common Style */
|
||||
.sight-portfolio-area-filter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 64px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.sight-portfolio-area-filter {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__title {
|
||||
margin-left: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__title:after {
|
||||
width: 40px;
|
||||
height: 1px;
|
||||
background: currentColor;
|
||||
content: "";
|
||||
display: block;
|
||||
margin: 4px 24px 0 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 16px 0 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.sight-portfolio-area-filter__list {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__list-item {
|
||||
display: block;
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.sight-portfolio-area-filter__list-item {
|
||||
margin-right: 16px;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__list-item a {
|
||||
display: block;
|
||||
color: currentColor;
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__list-item.sight-filter-active a {
|
||||
color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.sight-portfolio-area__pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__thumbnail {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__thumbnail img {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__thumbnail .pk-pin-it-container {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__thumbnail:hover .sight-portfolio-view-more {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-view-more {
|
||||
background-color: var(--sight-view-more-background, rgba(40, 40, 40, 0.25));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-view-more-label {
|
||||
color: var(--sight-view-more-label-color, white);
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__content:not(:first-child) {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__title:not(:first-child) {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta:not(:first-child) {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta a {
|
||||
font-size: inherit;
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta > *:not(:last-child) {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta > *:not(:first-child):before {
|
||||
content: '\00b7';
|
||||
font-weight: 600;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta .sight-portfolio-meta-icon {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta .sight-portfolio-meta-category .sight-portfolio-meta-item {
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta .sight-portfolio-meta-category .sight-portfolio-meta-item:last-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__caption:not(:first-child) {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.sight-portfolio-area__main {
|
||||
opacity: 1;
|
||||
transition: 0.4s;
|
||||
}
|
||||
|
||||
.sight-portfolio-area__main.sight-portfolio-loading {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.sight-portfolio-area__main .sight-portfolio-entry-request {
|
||||
position: relative;
|
||||
top: 1rem;
|
||||
opacity: 0.4;
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/* Icons */
|
||||
/* Common Style */
|
||||
.sight-portfolio-area-filter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 64px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.sight-portfolio-area-filter {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__title {
|
||||
margin-right: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__title:after {
|
||||
width: 40px;
|
||||
height: 1px;
|
||||
background: currentColor;
|
||||
content: "";
|
||||
display: block;
|
||||
margin: 4px 0 0 24px;
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 16px 0 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.sight-portfolio-area-filter__list {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__list-item {
|
||||
display: block;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.sight-portfolio-area-filter__list-item {
|
||||
margin-left: 16px;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__list-item a {
|
||||
display: block;
|
||||
color: currentColor;
|
||||
}
|
||||
|
||||
.sight-portfolio-area-filter__list-item.sight-filter-active a {
|
||||
color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.sight-portfolio-area__pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__thumbnail {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__thumbnail img {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__thumbnail .pk-pin-it-container {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__thumbnail:hover .sight-portfolio-view-more {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-view-more {
|
||||
background-color: var(--sight-view-more-background, rgba(40, 40, 40, 0.25));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-view-more-label {
|
||||
color: var(--sight-view-more-label-color, white);
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__content:not(:first-child) {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__title:not(:first-child) {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta:not(:first-child) {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta a {
|
||||
font-size: inherit;
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta > *:not(:last-child) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta > *:not(:first-child):before {
|
||||
content: '\00b7';
|
||||
font-weight: 600;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta .sight-portfolio-meta-icon {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta .sight-portfolio-meta-category .sight-portfolio-meta-item {
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__meta .sight-portfolio-meta-category .sight-portfolio-meta-item:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry .sight-portfolio-entry__caption:not(:first-child) {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.sight-portfolio-area__main {
|
||||
opacity: 1;
|
||||
transition: 0.4s;
|
||||
}
|
||||
|
||||
.sight-portfolio-area__main.sight-portfolio-loading {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.sight-portfolio-area__main .sight-portfolio-entry-request {
|
||||
position: relative;
|
||||
top: 1rem;
|
||||
opacity: 0.4;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/* Icons */
|
||||
/* Layout Standard */
|
||||
.sight-block-portfolio-layout-standard .sight-portfolio-area__main {
|
||||
display: grid;
|
||||
grid-gap: var(--sight-portfolio-area-grid-gap, 40px);
|
||||
grid-template-columns: repeat(var(--sight-portfolio-area-grid-columns, 2), minmax(0, 1fr));
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/* Icons */
|
||||
/* Layout Standard */
|
||||
.sight-block-portfolio-layout-standard .sight-portfolio-area__main {
|
||||
display: grid;
|
||||
grid-gap: var(--sight-portfolio-area-grid-gap, 40px);
|
||||
grid-template-columns: repeat(var(--sight-portfolio-area-grid-columns, 2), minmax(0, 1fr));
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/* Icons */
|
||||
/* Vars */
|
||||
.sight-portfolio-area-lightbox {
|
||||
--sight-zoom-icon-popup-color: white;
|
||||
--sight-zoom-icon-popup-background: rgba(0, 0, 0, 0.6);
|
||||
--sight-zoom-icon-popup-font-size: 16px;
|
||||
}
|
||||
|
||||
/* Common Style */
|
||||
.sight-portfolio-area-lightbox .sight-zoom-icon-popup {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
top: 1rem;
|
||||
left: 1rem;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
line-height: 2rem;
|
||||
text-align: center;
|
||||
opacity: 0;
|
||||
color: var(--sight-zoom-icon-popup-color);
|
||||
background: var(--sight-zoom-icon-popup-background);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.sight-portfolio-area-lightbox .sight-zoom-icon-popup:before {
|
||||
font-family: 'sight-portfolio-icons';
|
||||
font-size: var(--sight-zoom-icon-popup-font-size);
|
||||
content: "\e912";
|
||||
}
|
||||
|
||||
.sight-portfolio-area-lightbox .sight-image-popup:hover ~ .sight-zoom-icon-popup {
|
||||
opacity: 1;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/* Icons */
|
||||
/* Vars */
|
||||
.sight-portfolio-area-lightbox {
|
||||
--sight-zoom-icon-popup-color: white;
|
||||
--sight-zoom-icon-popup-background: rgba(0, 0, 0, 0.6);
|
||||
--sight-zoom-icon-popup-font-size: 16px;
|
||||
}
|
||||
|
||||
/* Common Style */
|
||||
.sight-portfolio-area-lightbox .sight-zoom-icon-popup {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
top: 1rem;
|
||||
right: 1rem;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
line-height: 2rem;
|
||||
text-align: center;
|
||||
opacity: 0;
|
||||
color: var(--sight-zoom-icon-popup-color);
|
||||
background: var(--sight-zoom-icon-popup-background);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.sight-portfolio-area-lightbox .sight-zoom-icon-popup:before {
|
||||
font-family: 'sight-portfolio-icons';
|
||||
font-size: var(--sight-zoom-icon-popup-font-size);
|
||||
content: "\e912";
|
||||
}
|
||||
|
||||
.sight-portfolio-area-lightbox .sight-image-popup:hover ~ .sight-zoom-icon-popup {
|
||||
opacity: 1;
|
||||
}
|
||||
@@ -0,0 +1,541 @@
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/* Icons */
|
||||
/* Basic Style */
|
||||
@font-face {
|
||||
font-family: 'sight-portfolio-icons';
|
||||
src: url("../icon-fonts/sight-portfolio-icons.eot?2kdktd");
|
||||
src: url("../icon-fonts/sight-portfolio-icons.eot?2kdktd#iefix") format("embedded-opentype"), url("../icon-fonts/sight-portfolio-icons.ttf?2kdktd") format("truetype"), url("../icon-fonts/sight-portfolio-icons.woff?2kdktd") format("woff"), url("../icon-fonts/sight-portfolio-icons.svg?2kdktd#sight-portfolio") format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
}
|
||||
|
||||
[class^="sight-portfolio-icons-"],
|
||||
[class*=" sight-portfolio-icons-"] {
|
||||
/* use !important to prevent issues with browser extensions that change fonts */
|
||||
font-family: 'sight-portfolio-icons' !important;
|
||||
speak: never;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
/* Better Font Rendering =========== */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-plus:before {
|
||||
content: "\e912";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-volume-full:before {
|
||||
content: "\e909";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-volume-mute:before {
|
||||
content: "\e90a";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-pause:before {
|
||||
content: "\e900";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-play:before {
|
||||
content: "\e901";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-youtube:before {
|
||||
content: "\e910";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-share-top:before {
|
||||
content: "\e934";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-down:before {
|
||||
content: "\e902";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-down-circle:before {
|
||||
content: "\e903";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-left:before {
|
||||
content: "\e904";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-left-circle:before {
|
||||
content: "\e905";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-right:before {
|
||||
content: "\e906";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-right-circle:before {
|
||||
content: "\e907";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-up-circle:before {
|
||||
content: "\e908";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-bookmark:before {
|
||||
content: "\e90b";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-chevron-down:before {
|
||||
content: "\e90c";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-chevron-left:before {
|
||||
content: "\e90d";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-chevron-right:before {
|
||||
content: "\e90e";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-chevron-up:before {
|
||||
content: "\e90f";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-eye:before {
|
||||
content: "\e911";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-film:before {
|
||||
content: "\e914";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-share:before {
|
||||
content: "\e920";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-watch:before {
|
||||
content: "\e922";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-x:before {
|
||||
content: "\e923";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-x-circle:before {
|
||||
content: "\e924";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-long-bottom:before {
|
||||
content: "\e938";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-long-top:before {
|
||||
content: "\e939";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-long-left:before {
|
||||
content: "\e93a";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-long-right:before {
|
||||
content: "\e93b";
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__thumbnail img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__overlay {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background {
|
||||
display: flex;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background:after, .sight-portfolio-overlay-background:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
transition: 0.25s;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background:after {
|
||||
background: var(--sight-color-overlay-background);
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background.sight-portfolio-overlay-transparent:after, .sight-portfolio-overlay-background.sight-portfolio-overlay-transparent:before {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-link {
|
||||
position: absolute;
|
||||
display: block;
|
||||
right: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-content a {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-ratio {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-ratio:not(.sight-portfolio-ratio-original) .sight-portfolio-overlay-background {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-ratio:not(.sight-portfolio-ratio-original) .sight-portfolio-overlay-background img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-ratio:not(.sight-portfolio-ratio-original):before {
|
||||
content: '';
|
||||
display: table;
|
||||
box-sizing: border-box;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-landscape:before,
|
||||
.sight-portfolio-ratio-landscape-4-3:before {
|
||||
padding-bottom: 75%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-landscape-3-2:before {
|
||||
padding-bottom: 66.66667%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-landscape-16-9:before {
|
||||
padding-bottom: 56.25%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-portrait:before,
|
||||
.sight-portfolio-ratio-portrait-3-4:before {
|
||||
padding-bottom: 133.33333%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-portrait-2-3:before {
|
||||
padding-bottom: 150%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-square:before {
|
||||
padding-bottom: 100%;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-background:after, .sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-background:before {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-content > * {
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-content .sight-portfolio-entry__read-more {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-content .sight-portfolio-entry__read-more:not(:only-child) {
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay:hover .sight-portfolio-overlay-content {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay:hover .sight-portfolio-overlay-background:after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-overlay-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-overlay-content:not(:first-child) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-bg-init .sight-portfolio-entry__thumbnail img {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container .sight-portfolio-video-inner {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 50%;
|
||||
margin: auto;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
opacity: 0;
|
||||
transition: opacity .5s;
|
||||
max-width: unset;
|
||||
transform: translate(50%, -50%);
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container .sight-portfolio-video-inner.active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container[data-video-type="hover"] .sight-portfolio-video-loader {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.75);
|
||||
border-left-color: transparent;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
-webkit-animation: loader-rotate 1s linear infinite;
|
||||
animation: loader-rotate 1s linear infinite;
|
||||
top: 50%;
|
||||
margin: -20px auto 0;
|
||||
transition: opacity 0.25s;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container[data-video-type="hover"] .sight-portfolio-video-loader:after {
|
||||
content: '';
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
background: rgba(255, 255, 255, 0.75);
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 27px;
|
||||
}
|
||||
|
||||
@-webkit-keyframes loader-rotate {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes loader-rotate {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background:hover .sight-portfolio-video-container[data-video-type="hover"] .sight-portfolio-video-loader {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-bg-init .sight-portfolio-overlay-background .sight-portfolio-video-container[data-video-type="hover"] .sight-portfolio-video-loader {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container[data-video-type="always"] .sight-portfolio-video-loader {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.75);
|
||||
border-left-color: transparent;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
-webkit-animation: loader-rotate 1s linear infinite;
|
||||
animation: loader-rotate 1s linear infinite;
|
||||
top: 50%;
|
||||
margin: -20px auto 0;
|
||||
transition: opacity 0.25s;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container[data-video-type="always"] .sight-portfolio-video-loader:after {
|
||||
content: '';
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
background: rgba(255, 255, 255, 0.75);
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 27px;
|
||||
}
|
||||
|
||||
@keyframes loader-rotate {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-video-bg-init .sight-portfolio-video-container[data-video-type="always"] .sight-portfolio-video-loader {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
opacity: 0;
|
||||
z-index: 4;
|
||||
transform: translateX(9999px);
|
||||
transition: opacity 0.25s;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-bg-init .sight-portfolio-video-controls {
|
||||
transform: translateX(0);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control:after {
|
||||
position: relative;
|
||||
font-family: "sight-portfolio-icons";
|
||||
font-style: normal;
|
||||
opacity: 1;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control .sight-portfolio-tooltip {
|
||||
position: absolute;
|
||||
width: -webkit-max-content;
|
||||
width: -moz-max-content;
|
||||
width: max-content;
|
||||
display: -ms-grid;
|
||||
-ms-grid-columns: max-content;
|
||||
top: 100%;
|
||||
right: -9999px;
|
||||
padding-right: 50%;
|
||||
padding-bottom: 8px;
|
||||
transform: translateY(-30%);
|
||||
transition: transform 0.5s;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control .sight-portfolio-tooltip span {
|
||||
background: white;
|
||||
display: block;
|
||||
position: relative;
|
||||
padding: 4px 16px;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
color: black;
|
||||
transform: translate(50%, 0);
|
||||
transition: opacity 0.5s;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control .sight-portfolio-tooltip span:after {
|
||||
bottom: 100%;
|
||||
right: 50%;
|
||||
border: solid transparent;
|
||||
content: " ";
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
border-color: transparent;
|
||||
border-bottom-color: white;
|
||||
border-width: 7px;
|
||||
margin-right: -7px;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control:hover .sight-portfolio-tooltip {
|
||||
transform: translateY(0);
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control:hover .sight-portfolio-tooltip span {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-link:after {
|
||||
content: "\e910";
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-play:after {
|
||||
content: "\e900";
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-pause:after {
|
||||
content: "\e901";
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-unmute:after {
|
||||
content: "\e909";
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-mute:after {
|
||||
content: "\e90a";
|
||||
}
|
||||
@@ -0,0 +1,541 @@
|
||||
/**
|
||||
* Environment for all styles (variables, additions, etc).
|
||||
*/
|
||||
/* Icons */
|
||||
/* Basic Style */
|
||||
@font-face {
|
||||
font-family: 'sight-portfolio-icons';
|
||||
src: url("../icon-fonts/sight-portfolio-icons.eot?2kdktd");
|
||||
src: url("../icon-fonts/sight-portfolio-icons.eot?2kdktd#iefix") format("embedded-opentype"), url("../icon-fonts/sight-portfolio-icons.ttf?2kdktd") format("truetype"), url("../icon-fonts/sight-portfolio-icons.woff?2kdktd") format("woff"), url("../icon-fonts/sight-portfolio-icons.svg?2kdktd#sight-portfolio") format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
}
|
||||
|
||||
[class^="sight-portfolio-icons-"],
|
||||
[class*=" sight-portfolio-icons-"] {
|
||||
/* use !important to prevent issues with browser extensions that change fonts */
|
||||
font-family: 'sight-portfolio-icons' !important;
|
||||
speak: never;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
/* Better Font Rendering =========== */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-plus:before {
|
||||
content: "\e912";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-volume-full:before {
|
||||
content: "\e909";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-volume-mute:before {
|
||||
content: "\e90a";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-pause:before {
|
||||
content: "\e900";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-play:before {
|
||||
content: "\e901";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-youtube:before {
|
||||
content: "\e910";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-share-top:before {
|
||||
content: "\e934";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-down:before {
|
||||
content: "\e902";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-down-circle:before {
|
||||
content: "\e903";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-left:before {
|
||||
content: "\e904";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-left-circle:before {
|
||||
content: "\e905";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-right:before {
|
||||
content: "\e906";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-right-circle:before {
|
||||
content: "\e907";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-up-circle:before {
|
||||
content: "\e908";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-bookmark:before {
|
||||
content: "\e90b";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-chevron-down:before {
|
||||
content: "\e90c";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-chevron-left:before {
|
||||
content: "\e90d";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-chevron-right:before {
|
||||
content: "\e90e";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-chevron-up:before {
|
||||
content: "\e90f";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-eye:before {
|
||||
content: "\e911";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-film:before {
|
||||
content: "\e914";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-share:before {
|
||||
content: "\e920";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-watch:before {
|
||||
content: "\e922";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-x:before {
|
||||
content: "\e923";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-x-circle:before {
|
||||
content: "\e924";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-long-bottom:before {
|
||||
content: "\e938";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-long-top:before {
|
||||
content: "\e939";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-long-left:before {
|
||||
content: "\e93a";
|
||||
}
|
||||
|
||||
.sight-portfolio-icons-arrow-long-right:before {
|
||||
content: "\e93b";
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__thumbnail img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__overlay {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background {
|
||||
display: flex;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background:after, .sight-portfolio-overlay-background:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
transition: 0.25s;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background:after {
|
||||
background: var(--sight-color-overlay-background);
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background.sight-portfolio-overlay-transparent:after, .sight-portfolio-overlay-background.sight-portfolio-overlay-transparent:before {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-link {
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-content a {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-ratio {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-ratio:not(.sight-portfolio-ratio-original) .sight-portfolio-overlay-background {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-ratio:not(.sight-portfolio-ratio-original) .sight-portfolio-overlay-background img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-ratio:not(.sight-portfolio-ratio-original):before {
|
||||
content: '';
|
||||
display: table;
|
||||
box-sizing: border-box;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-landscape:before,
|
||||
.sight-portfolio-ratio-landscape-4-3:before {
|
||||
padding-bottom: 75%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-landscape-3-2:before {
|
||||
padding-bottom: 66.66667%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-landscape-16-9:before {
|
||||
padding-bottom: 56.25%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-portrait:before,
|
||||
.sight-portfolio-ratio-portrait-3-4:before {
|
||||
padding-bottom: 133.33333%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-portrait-2-3:before {
|
||||
padding-bottom: 150%;
|
||||
}
|
||||
|
||||
.sight-portfolio-ratio-square:before {
|
||||
padding-bottom: 100%;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-background:after, .sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-background:before {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
transition: 0.25s;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-content > * {
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-content .sight-portfolio-entry__read-more {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay .sight-portfolio-overlay-content .sight-portfolio-entry__read-more:not(:only-child) {
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay:hover .sight-portfolio-overlay-content {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-entry__overlay:hover .sight-portfolio-overlay-background:after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-overlay-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.sight-portfolio-entry__inner.sight-portfolio-overlay-content:not(:first-child) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-bg-init .sight-portfolio-entry__thumbnail img {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container .sight-portfolio-video-inner {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: auto;
|
||||
-o-object-fit: cover;
|
||||
object-fit: cover;
|
||||
opacity: 0;
|
||||
transition: opacity .5s;
|
||||
max-width: unset;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container .sight-portfolio-video-inner.active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container[data-video-type="hover"] .sight-portfolio-video-loader {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.75);
|
||||
border-right-color: transparent;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
-webkit-animation: loader-rotate 1s linear infinite;
|
||||
animation: loader-rotate 1s linear infinite;
|
||||
top: 50%;
|
||||
margin: -20px auto 0;
|
||||
transition: opacity 0.25s;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container[data-video-type="hover"] .sight-portfolio-video-loader:after {
|
||||
content: '';
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
background: rgba(255, 255, 255, 0.75);
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 27px;
|
||||
}
|
||||
|
||||
@-webkit-keyframes loader-rotate {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes loader-rotate {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-overlay-background:hover .sight-portfolio-video-container[data-video-type="hover"] .sight-portfolio-video-loader {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-bg-init .sight-portfolio-overlay-background .sight-portfolio-video-container[data-video-type="hover"] .sight-portfolio-video-loader {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container[data-video-type="always"] .sight-portfolio-video-loader {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.75);
|
||||
border-right-color: transparent;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
-webkit-animation: loader-rotate 1s linear infinite;
|
||||
animation: loader-rotate 1s linear infinite;
|
||||
top: 50%;
|
||||
margin: -20px auto 0;
|
||||
transition: opacity 0.25s;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-container[data-video-type="always"] .sight-portfolio-video-loader:after {
|
||||
content: '';
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
background: rgba(255, 255, 255, 0.75);
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 27px;
|
||||
}
|
||||
|
||||
@keyframes loader-rotate {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.sight-portfolio-video-bg-init .sight-portfolio-video-container[data-video-type="always"] .sight-portfolio-video-loader {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
opacity: 0;
|
||||
z-index: 4;
|
||||
transform: translateX(-9999px);
|
||||
transition: opacity 0.25s;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-bg-init .sight-portfolio-video-controls {
|
||||
transform: translateX(0);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control:after {
|
||||
position: relative;
|
||||
font-family: "sight-portfolio-icons";
|
||||
font-style: normal;
|
||||
opacity: 1;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control .sight-portfolio-tooltip {
|
||||
position: absolute;
|
||||
width: -webkit-max-content;
|
||||
width: -moz-max-content;
|
||||
width: max-content;
|
||||
display: -ms-grid;
|
||||
-ms-grid-columns: max-content;
|
||||
top: 100%;
|
||||
left: -9999px;
|
||||
padding-left: 50%;
|
||||
padding-bottom: 8px;
|
||||
transform: translateY(-30%);
|
||||
transition: transform 0.5s;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control .sight-portfolio-tooltip span {
|
||||
background: white;
|
||||
display: block;
|
||||
position: relative;
|
||||
padding: 4px 16px;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
color: black;
|
||||
transform: translate(-50%, 0);
|
||||
transition: opacity 0.5s;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control .sight-portfolio-tooltip span:after {
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
border: solid transparent;
|
||||
content: " ";
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
border-color: transparent;
|
||||
border-bottom-color: white;
|
||||
border-width: 7px;
|
||||
margin-left: -7px;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control:hover .sight-portfolio-tooltip {
|
||||
transform: translateY(0);
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-control:hover .sight-portfolio-tooltip span {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-link:after {
|
||||
content: "\e910";
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-play:after {
|
||||
content: "\e900";
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-pause:after {
|
||||
content: "\e901";
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-unmute:after {
|
||||
content: "\e909";
|
||||
}
|
||||
|
||||
.sight-portfolio-video-controls .sight-portfolio-player-mute:after {
|
||||
content: "\e90a";
|
||||
}
|
||||
@@ -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();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Generated by IcoMoon</metadata>
|
||||
<defs>
|
||||
<font id="sight-portfolio-icons" horiz-adv-x="1024">
|
||||
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||
<missing-glyph horiz-adv-x="1024" />
|
||||
<glyph unicode=" " horiz-adv-x="512" d="" />
|
||||
<glyph unicode="" glyph-name="pause" d="M341.333 661.333h128v-426.667h-128zM554.667 661.333h128v-426.667h-128z" />
|
||||
<glyph unicode="" glyph-name="play" d="M298.667 704v-512l426.667 256z" />
|
||||
<glyph unicode="" glyph-name="arrow-down" d="M840.533 456.534c-17.067 17.067-42.667 17.067-59.733 0l-226.133-226.133v494.933c0 25.6-17.067 42.667-42.667 42.667s-42.667-17.067-42.667-42.667v-494.933l-226.133 226.133c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l298.667-298.667c4.267-4.267 8.533-8.533 12.8-8.533 4.267-4.267 12.8-4.267 17.067-4.267s12.8 0 17.067 4.267c4.267 4.267 8.533 4.267 12.8 8.533l298.667 298.667c17.067 17.067 17.067 42.667 0 59.733z" />
|
||||
<glyph unicode="" glyph-name="arrow-down-circle" d="M512 896c-260.267 0-469.333-209.067-469.333-469.333s209.067-469.333 469.333-469.333 469.333 209.067 469.333 469.333-209.067 469.333-469.333 469.333zM512 42.667c-213.333 0-384 170.667-384 384s170.667 384 384 384c213.333 0 384-170.667 384-384s-170.667-384-384-384zM652.8 456.534l-98.133-98.133v238.933c0 25.6-17.067 42.667-42.667 42.667s-42.667-17.067-42.667-42.667v-238.933l-98.133 98.133c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l170.667-170.667c4.267-4.267 8.533-8.533 12.8-8.533 4.267-4.267 12.8-4.267 17.067-4.267s12.8 0 17.067 4.267c4.267 4.267 8.533 4.267 12.8 8.533l170.667 170.667c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0z" />
|
||||
<glyph unicode="" glyph-name="arrow-left" d="M810.667 469.334h-494.933l226.133 226.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-298.667-298.667c-4.267-4.267-8.533-8.533-8.533-12.8-4.267-8.533-4.267-21.333 0-34.133 4.267-4.267 4.267-8.533 8.533-12.8l298.667-298.667c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-226.133 226.133h494.933c25.6 0 42.667 17.067 42.667 42.667s-17.067 42.667-42.667 42.667z" />
|
||||
<glyph unicode="" glyph-name="arrow-left-circle" d="M512 896c-260.267 0-469.333-209.067-469.333-469.333s209.067-469.333 469.333-469.333 469.333 209.067 469.333 469.333-209.067 469.333-469.333 469.333zM512 42.667c-213.333 0-384 170.667-384 384s170.667 384 384 384c213.333 0 384-170.667 384-384s-170.667-384-384-384zM682.667 469.334h-238.933l98.133 98.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-170.667-170.667c-4.267-4.267-8.533-8.533-8.533-12.8-4.267-8.533-4.267-21.333 0-34.133 4.267-4.267 4.267-8.533 8.533-12.8l170.667-170.667c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-98.133 98.133h238.933c25.6 0 42.667 17.067 42.667 42.667s-17.067 42.667-42.667 42.667z" />
|
||||
<glyph unicode="" glyph-name="arrow-right" d="M849.067 409.6c4.267 8.533 4.267 21.333 0 34.133-4.267 4.267-4.267 8.533-8.533 12.8l-298.667 298.667c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l226.133-226.133h-494.933c-25.6 0-42.667-17.067-42.667-42.667s17.067-42.667 42.667-42.667h494.933l-226.133-226.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8l298.667 298.667c4.267 4.267 8.533 8.533 8.533 12.8z" />
|
||||
<glyph unicode="" glyph-name="arrow-right-circle" d="M512 896c-260.267 0-469.333-209.067-469.333-469.333s209.067-469.333 469.333-469.333 469.333 209.067 469.333 469.333-209.067 469.333-469.333 469.333zM512 42.667c-213.333 0-384 170.667-384 384s170.667 384 384 384c213.333 0 384-170.667 384-384s-170.667-384-384-384zM721.067 443.734c-4.267 4.267-4.267 8.533-8.533 12.8l-170.667 170.667c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l98.133-98.133h-238.933c-25.6 0-42.667-17.067-42.667-42.667s17.067-42.667 42.667-42.667h238.933l-98.133-98.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8l170.667 170.667c4.267 4.267 8.533 8.533 8.533 12.8 4.267 12.8 4.267 21.333 0 34.133z" />
|
||||
<glyph unicode="" glyph-name="arrow-up-circle" d="M512 896c-260.267 0-469.333-209.067-469.333-469.333s209.067-469.333 469.333-469.333 469.333 209.067 469.333 469.333-209.067 469.333-469.333 469.333zM512 42.667c-213.333 0-384 170.667-384 384s170.667 384 384 384c213.333 0 384-170.667 384-384s-170.667-384-384-384zM541.867 627.2c-4.267 4.267-8.533 8.533-12.8 8.533-8.533 4.267-21.333 4.267-34.133 0-4.267-4.267-8.533-4.267-12.8-8.533l-170.667-170.667c-17.067-17.067-17.067-42.667 0-59.733s42.667-17.067 59.733 0l98.133 98.133v-238.933c0-25.6 17.067-42.667 42.667-42.667s42.667 17.067 42.667 42.667v238.933l98.133-98.133c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-170.667 170.667z" />
|
||||
<glyph unicode="" glyph-name="volume-full" d="M682.667 64c150.485 66.005 255.957 209.451 255.957 384s-105.472 317.995-255.957 384v-85.333c101.845-59.136 170.624-172.672 170.624-298.667s-68.779-239.531-170.624-298.667v-85.333zM682.667 661.333v-426.667c52.267 46.933 85.333 137.771 85.333 213.333s-33.067 166.4-85.333 213.333zM170.667 234.667h115.072l311.595-207.701v842.069l-311.595-207.701h-115.072c-47.061 0-85.333-38.272-85.333-85.333v-256c0-47.061 38.272-85.333 85.333-85.333z" />
|
||||
<glyph unicode="" glyph-name="volume-mute" d="M329.685 690.645l-171.52 171.52-60.331-60.331 768-768 60.331 60.331-86.187 86.187c61.44 71.979 98.645 164.309 98.645 267.648 0 174.549-105.472 317.995-255.957 384v-85.333c101.845-59.136 170.624-172.672 170.624-298.667 0-78.165-26.88-151.168-71.296-209.664l-54.869 54.869c25.685 46.592 40.875 104.021 40.875 154.795 0 75.563-33.067 166.4-85.333 213.333v-323.669l-85.333 85.333v446.037l-267.648-178.389zM170.667 234.667h115.072l311.595-207.701v159.872l-464.981 464.981c-27.776-14.123-47.019-42.624-47.019-75.819v-256c0-47.061 38.272-85.333 85.333-85.333z" />
|
||||
<glyph unicode="" glyph-name="bookmark" d="M725.333 853.334h-426.667c-72.533 0-128-55.467-128-128v-682.667c0-17.067 8.533-29.867 21.333-38.4s29.867-4.267 42.667 4.267l273.067 196.267 273.067-196.267c8.533-4.267 17.067-8.533 25.6-8.533s12.8 0 21.333 4.267c12.8 8.533 21.333 21.333 21.333 38.4v682.667c4.267 72.533-51.2 128-123.733 128zM768 123.734l-230.4 166.4c-8.533 4.267-17.067 8.533-25.6 8.533s-17.067-4.267-25.6-8.533l-230.4-166.4v601.6c0 25.6 17.067 42.667 42.667 42.667h426.667c25.6 0 42.667-17.067 42.667-42.667v-601.6z" />
|
||||
<glyph unicode="" glyph-name="chevron-down" d="M797.867 584.534c-17.067 17.067-42.667 17.067-59.733 0l-226.133-226.133-226.133 226.133c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l256-256c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8l256 256c17.067 17.067 17.067 42.667 0 59.733z" />
|
||||
<glyph unicode="" glyph-name="chevron-left" d="M443.733 426.667l226.133 226.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-256-256c-17.067-17.067-17.067-42.667 0-59.733l256-256c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-226.133 226.133z" />
|
||||
<glyph unicode="" glyph-name="chevron-right" d="M669.867 456.534l-256 256c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l226.133-226.133-226.133-226.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 17.067-12.8 29.867-12.8s21.333 4.267 29.867 12.8l256 256c17.067 17.067 17.067 42.667 0 59.733z" />
|
||||
<glyph unicode="" glyph-name="chevron-up" d="M797.867 328.534l-256 256c-17.067 17.067-42.667 17.067-59.733 0l-256-256c-17.067-17.067-17.067-42.667 0-59.733s42.667-17.067 59.733 0l226.133 226.133 226.133-226.133c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733z" />
|
||||
<glyph unicode="" glyph-name="youtube" d="M961.707 675.413c-10.773 40.64-42.613 72.64-82.987 83.52-73.173 19.733-366.72 19.733-366.72 19.733s-293.547 0-366.72-19.733c-40.373-10.88-72.213-42.88-82.987-83.52-19.627-73.707-19.627-227.413-19.627-227.413s0-153.707 19.627-227.413c10.773-40.64 42.613-72.64 82.987-83.52 73.173-19.733 366.72-19.733 366.72-19.733s293.547 0 366.72 19.733c40.373 10.88 72.213 42.88 82.987 83.52 19.627 73.707 19.627 227.413 19.627 227.413s0 153.707-19.627 227.413zM416 308.427v279.147l245.333-139.573-245.333-139.573z" />
|
||||
<glyph unicode="" glyph-name="eye" d="M1019.733 443.734c-8.533 17.067-187.733 366.933-507.733 366.933s-499.2-349.867-507.733-366.933c-4.267-12.8-4.267-25.6 0-38.4 8.533-12.8 187.733-362.667 507.733-362.667s499.2 349.867 507.733 366.933c4.267 8.533 4.267 25.6 0 34.133zM512 128c-230.4 0-379.733 230.4-422.4 298.667 38.4 68.267 192 298.667 422.4 298.667s379.733-230.4 422.4-298.667c-42.667-68.267-192-298.667-422.4-298.667zM512 597.334c-93.867 0-170.667-76.8-170.667-170.667s76.8-170.667 170.667-170.667c93.867 0 170.667 76.8 170.667 170.667s-76.8 170.667-170.667 170.667zM512 341.334c-46.933 0-85.333 38.4-85.333 85.333s38.4 85.333 85.333 85.333c46.933 0 85.333-38.4 85.333-85.333s-38.4-85.333-85.333-85.333z" />
|
||||
<glyph unicode="" glyph-name="plus" d="M213.333 384h256v-256c0-23.552 19.115-42.667 42.667-42.667s42.667 19.115 42.667 42.667v256h256c23.552 0 42.667 19.115 42.667 42.667s-19.115 42.667-42.667 42.667h-256v256c0 23.552-19.115 42.667-42.667 42.667s-42.667-19.115-42.667-42.667v-256h-256c-23.552 0-42.667-19.115-42.667-42.667s19.115-42.667 42.667-42.667z" />
|
||||
<glyph unicode="" glyph-name="film" d="M844.8 896h-665.6c-76.8 0-136.533-59.733-136.533-136.533v-665.6c0-76.8 59.733-136.533 136.533-136.533h665.6c76.8 0 136.533 59.733 136.533 136.533v665.6c0 76.8-59.733 136.533-136.533 136.533zM768 597.334h128v-128h-128v128zM682.667 469.334h-341.333v341.333h341.333v-341.333zM256 469.334h-128v128h128v-128zM128 384h128v-128h-128v128zM341.333 384h341.333v-341.333h-341.333v341.333zM768 384h128v-128h-128v128zM896 759.467v-76.8h-128v128h76.8c29.867 0 51.2-21.333 51.2-51.2zM179.2 810.667h76.8v-128h-128v76.8c0 29.867 21.333 51.2 51.2 51.2zM128 93.867v76.8h128v-128h-76.8c-29.867 0-51.2 21.333-51.2 51.2zM844.8 42.667h-76.8v128h128v-76.8c0-29.867-21.333-51.2-51.2-51.2z" />
|
||||
<glyph unicode="" glyph-name="share" d="M768 298.667c-46.933 0-89.6-21.333-119.467-51.2l-226.133 132.267c0 17.067 4.267 29.867 4.267 46.933s-4.267 29.867-8.533 46.933l226.133 132.267c34.133-29.867 76.8-51.2 123.733-51.2 93.867 0 170.667 76.8 170.667 170.667s-76.8 170.667-170.667 170.667-170.667-76.8-170.667-170.667c0-17.067 4.267-29.867 8.533-46.933l-230.4-132.267c-29.867 29.867-72.533 51.2-119.467 51.2-93.867 0-170.667-76.8-170.667-170.667s76.8-170.667 170.667-170.667c46.933 0 89.6 21.333 119.467 51.2l226.133-132.267c0-17.067-4.267-29.867-4.267-46.933 0-93.867 76.8-170.667 170.667-170.667s170.667 76.8 170.667 170.667-76.8 170.667-170.667 170.667zM768 810.667c46.933 0 85.333-38.4 85.333-85.333s-38.4-85.333-85.333-85.333-85.333 38.4-85.333 85.333 38.4 85.333 85.333 85.333zM256 341.334c-46.933 0-85.333 38.4-85.333 85.333s38.4 85.333 85.333 85.333 85.333-38.4 85.333-85.333c0-46.933-38.4-85.333-85.333-85.333zM768 42.667c-46.933 0-85.333 38.4-85.333 85.333 0 17.067 4.267 29.867 12.8 42.667 0 0 0 0 0 0s0 0 0 0c12.8 25.6 42.667 42.667 72.533 42.667 46.933 0 85.333-38.4 85.333-85.333s-38.4-85.333-85.333-85.333z" />
|
||||
<glyph unicode="" glyph-name="watch" d="M853.333 426.667c0 98.133-42.667 183.467-106.667 247.467l-12.8 149.333c-8.533 64-59.733 115.2-128 115.2 0 0 0 0 0 0h-187.733c-64 0-119.467-51.2-128-115.2l-12.8-149.333c-64-59.733-106.667-149.333-106.667-247.467s42.667-187.733 106.667-247.467l12.8-149.333c8.533-64 64-115.2 128-115.2 0 0 0 0 0 0h183.467c0 0 0 0 0 0 68.267 0 119.467 51.2 128 115.2l12.8 145.067c68.267 64 110.933 153.6 110.933 251.733zM375.467 814.934c0 21.333 21.333 38.4 42.667 38.4h187.733c21.333 0 42.667-17.067 42.667-38.4l8.533-76.8c-46.933 17.067-93.867 29.867-145.067 29.867s-98.133-12.8-140.8-29.867l4.267 76.8zM256 426.667c0 140.8 115.2 256 256 256s256-115.2 256-256-115.2-256-256-256-256 115.2-256 256zM648.533 38.4c0-21.333-21.333-38.4-42.667-38.4 0 0 0 0 0 0h-187.733c0 0 0 0 0 0-21.333 0-38.4 17.067-42.667 38.4l-8.533 76.8c42.667-21.333 89.6-29.867 140.8-29.867s98.133 12.8 140.8 29.867v-76.8zM546.133 332.8c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-51.2 51.2v110.933c0 25.6-17.067 42.667-42.667 42.667s-42.667-17.067-42.667-42.667v-128c0-12.8 4.267-21.333 12.8-29.867l64-64z" />
|
||||
<glyph unicode="" glyph-name="x" d="M571.733 426.667l226.133 226.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-226.133-226.133-226.133 226.133c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l226.133-226.133-226.133-226.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 17.067-12.8 29.867-12.8s21.333 4.267 29.867 12.8l226.133 226.133 226.133-226.133c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-226.133 226.133z" />
|
||||
<glyph unicode="" glyph-name="x-circle" d="M512 896c-260.267 0-469.333-209.067-469.333-469.333s209.067-469.333 469.333-469.333 469.333 209.067 469.333 469.333-209.067 469.333-469.333 469.333zM512 42.667c-213.333 0-384 170.667-384 384s170.667 384 384 384c213.333 0 384-170.667 384-384s-170.667-384-384-384zM669.867 584.534c-17.067 17.067-42.667 17.067-59.733 0l-98.133-98.133-98.133 98.133c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l98.133-98.133-98.133-98.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 17.067-12.8 29.867-12.8s21.333 4.267 29.867 12.8l98.133 98.133 98.133-98.133c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-98.133 98.133 98.133 98.133c17.067 17.067 17.067 42.667 0 59.733z" />
|
||||
<glyph unicode="" glyph-name="share-top" d="M853.333 469.334c-25.6 0-42.667-17.067-42.667-42.667v-341.333c0-25.6-17.067-42.667-42.667-42.667h-512c-25.6 0-42.667 17.067-42.667 42.667v341.333c0 25.6-17.067 42.667-42.667 42.667s-42.667-17.067-42.667-42.667v-341.333c0-72.533 55.467-128 128-128h512c72.533 0 128 55.467 128 128v341.333c0 25.6-17.067 42.667-42.667 42.667zM371.2 652.8l98.133 98.133v-452.267c0-25.6 17.067-42.667 42.667-42.667s42.667 17.067 42.667 42.667v452.267l98.133-98.133c8.533-8.533 17.067-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-170.667 170.667c-4.267 4.267-8.533 8.533-12.8 8.533-8.533 4.267-21.333 4.267-34.133 0-4.267-4.267-8.533-4.267-12.8-8.533l-170.667-170.667c-17.067-17.067-17.067-42.667 0-59.733s42.667-17.067 59.733 0z" />
|
||||
<glyph unicode="" glyph-name="arrow-long-bottom" d="M479.22 960.001v-897.794l-183.579 183.579-45.886-47.54 262.245-262.245 262.245 262.245-45.89 45.885-183.576-181.924v897.794z" />
|
||||
<glyph unicode="" glyph-name="arrow-long-top" d="M479.22-64.001v897.794l-183.579-183.579-45.886 47.54 262.245 262.245 262.245-262.245-45.89-45.885-183.576 181.924v-897.794z" />
|
||||
<glyph unicode="" glyph-name="arrow-long-left" d="M1024.001 415.22h-897.794l183.579-183.579-47.54-45.886-262.245 262.245 262.245 262.245 45.885-45.89-181.924-183.576h897.794z" />
|
||||
<glyph unicode="" glyph-name="arrow-long-right" d="M-0.001 415.22h897.794l-183.579-183.579 47.54-45.886 262.245 262.245-262.245 262.245-45.885-45.89 181.924-183.576h-897.794z" />
|
||||
</font></defs></svg>
|
||||
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* Lightbox
|
||||
*/
|
||||
|
||||
import {
|
||||
$,
|
||||
$window,
|
||||
$doc,
|
||||
$body,
|
||||
sight
|
||||
} from './utility';
|
||||
|
||||
( function( $ ) {
|
||||
|
||||
$.fn.SightLightbox = function( options ) {
|
||||
|
||||
var settings = $.extend( {
|
||||
gallery : false,
|
||||
}, options);
|
||||
|
||||
var containerSelector = this;
|
||||
var imageSelector = null;
|
||||
|
||||
$( containerSelector ).each( function() {
|
||||
|
||||
if ( $( this ).is( 'img' ) ) {
|
||||
imageSelector = this;
|
||||
} else {
|
||||
imageSelector = $( this ).find( 'img' );
|
||||
}
|
||||
|
||||
$( imageSelector ).each( function() {
|
||||
|
||||
var link = $( this ).closest( '.sight-portfolio-entry' ).find( '.sight-portfolio-overlay-link' );
|
||||
|
||||
if ( ! $( link ).is( 'a' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var imagehref = $( link ).attr( 'href' );
|
||||
|
||||
if ( ! imagehref.match( /\.(gif|jpeg|jpg|png)/ ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$( link ).addClass( 'sight-image-popup' );
|
||||
});
|
||||
|
||||
if ( $( this ).closest( '.elementor-element' ).length > 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$( containerSelector ).magnificPopup( {
|
||||
delegate: '.sight-image-popup',
|
||||
type: 'image',
|
||||
tClose: sight_lightbox_localize.text_close + '(Esc)',
|
||||
tLoading: sight_lightbox_localize.text_loading,
|
||||
gallery: {
|
||||
enabled: settings.gallery,
|
||||
tPrev: sight_lightbox_localize.text_previous,
|
||||
tNext: sight_lightbox_localize.text_next,
|
||||
tCounter: '<span class="mfp-counter">%curr% ' + sight_lightbox_localize.text_counter + ' %total%</span>'
|
||||
},
|
||||
image: {
|
||||
titleSrc: function( item ) {
|
||||
let entry = item.el.closest( '.sight-portfolio-entry' );
|
||||
|
||||
if ( $( entry ).hasClass( 'sight-portfolio-entry-custom' ) ) {
|
||||
|
||||
return $( entry ).find( '.sight-portfolio-entry__caption' ).text();
|
||||
|
||||
} else if ( $( entry ).hasClass( 'sight-portfolio-entry-post' ) ) {
|
||||
|
||||
return $( entry ).find( '.sight-portfolio-entry__caption' ).text();
|
||||
|
||||
} else {
|
||||
return $( entry ).find( '.sight-portfolio-entry__heading' ).text();
|
||||
}
|
||||
}
|
||||
},
|
||||
} );
|
||||
} );
|
||||
|
||||
};
|
||||
|
||||
function initSightLightbox() {
|
||||
$( '.sight-portfolio-area-lightbox' ).imagesLoaded( function() {
|
||||
$( '.sight-portfolio-area-lightbox' ).SightLightbox( { gallery: true } );
|
||||
} );
|
||||
}
|
||||
|
||||
$( document ).ready( function() {
|
||||
initSightLightbox();
|
||||
$( document.body ).on( 'post-load image-load', function() {
|
||||
initSightLightbox();
|
||||
} );
|
||||
} );
|
||||
|
||||
} )( jQuery );
|
||||
@@ -0,0 +1,272 @@
|
||||
/**
|
||||
* AJAX Load More.
|
||||
*
|
||||
* Contains functions for AJAX Load More.
|
||||
*/
|
||||
|
||||
import {
|
||||
$,
|
||||
$window,
|
||||
$doc,
|
||||
$body,
|
||||
sight
|
||||
} from './utility';
|
||||
|
||||
/**
|
||||
* Insert Load More
|
||||
*/
|
||||
function sight_portfolio_load_more_insert( container, settings ) {
|
||||
if ( 'none' === settings.pagination_type ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $( container ).find( '.sight-portfolio-area__pagination' ).length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$( container ).append( '<div class="sight-portfolio-area__pagination"><button class="sight-portfolio-load-more">' + settings.translation.load_more + '</button></div>' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get next posts
|
||||
*/
|
||||
function sight_portfolio_ajax_get_posts( container, reload ) {
|
||||
var pagination = $( container ).find( '.sight-portfolio-area__pagination' );
|
||||
var loadMore = $( container ).find( '.sight-portfolio-load-more' );
|
||||
var settings = $( container ).data( 'settings' );
|
||||
var page = $( container ).data( 'page' );
|
||||
|
||||
// Filter terms.
|
||||
var terms = [];
|
||||
|
||||
$( container ).find( '.sight-portfolio-area-filter__list li' ).each( function( index, elem ) {
|
||||
if ( $( this ).is( '.sight-filter-active:not(.sight-filter-all)' ) ) {
|
||||
terms.push( $( this ).find( 'a' ).data( 'filter' ) );
|
||||
}
|
||||
} );
|
||||
|
||||
// Set area loading.
|
||||
$( container ).find( '.sight-portfolio-area__main' ).addClass( 'sight-portfolio-loading' );
|
||||
|
||||
// Set ajax settings.
|
||||
if ( reload ) {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
var data = {
|
||||
action: 'sight_portfolio_ajax_load_more',
|
||||
terms: terms,
|
||||
page: page,
|
||||
posts_per_page: settings.posts_per_page,
|
||||
query_data: settings.query_data,
|
||||
attributes: settings.attributes,
|
||||
options: settings.options,
|
||||
_ajax_nonce: settings.nonce,
|
||||
};
|
||||
|
||||
// Set the loading state.
|
||||
$( container ).data( 'loading', true );
|
||||
|
||||
// Set button text to Load More.
|
||||
$( loadMore ).text( settings.translation.loading );
|
||||
|
||||
// Request Url.
|
||||
var sight_pagination_url;
|
||||
|
||||
if ( 'ajax_restapi' === settings.type ) {
|
||||
sight_pagination_url = settings.rest_url;
|
||||
} else {
|
||||
sight_pagination_url = settings.url;
|
||||
}
|
||||
|
||||
// Send Request.
|
||||
$.post( sight_pagination_url, data, function( res ) {
|
||||
if ( res.success ) {
|
||||
|
||||
// Get the posts.
|
||||
var data = $( res.data.content );
|
||||
|
||||
data.imagesLoaded( function() {
|
||||
|
||||
// Append new posts to list, standard and grid archives.
|
||||
if ( reload ) {
|
||||
$( container ).find( '.sight-portfolio-area__main' ).html( data );
|
||||
} else {
|
||||
$( container ).find( '.sight-portfolio-area__main' ).append( data );
|
||||
}
|
||||
|
||||
// Entry animations.
|
||||
$( container ).find( '.sight-portfolio-entry-request' ).each( function() {
|
||||
if ( !$( this ).is( 'sight-portfolio-entry-animation' ) ) {
|
||||
$( this ).addClass( 'sight-portfolio-entry-animation' ).animate( {opacity: 1, top: 0}, 600);
|
||||
}
|
||||
} );
|
||||
|
||||
// WP Post Load trigger.
|
||||
$( window ).trigger( 'post-load' );
|
||||
|
||||
// Reinit Facebook widgets.
|
||||
if ( $( '#fb-root' ).length ) {
|
||||
FB.XFBML.parse();
|
||||
}
|
||||
|
||||
// Set button text to Load More.
|
||||
$( loadMore ).text( settings.translation.load_more );
|
||||
|
||||
// Increment a page.
|
||||
page = page + 1;
|
||||
|
||||
$( container ).data( 'page', page );
|
||||
|
||||
// Set the loading state.
|
||||
$( container ).data( 'loading', false );
|
||||
} );
|
||||
|
||||
// Remove Button on Posts End.
|
||||
if ( res.data.posts_end || !data.length ) {
|
||||
|
||||
// Remove Load More button.
|
||||
$( pagination ).remove();
|
||||
} else {
|
||||
|
||||
// Add Load More button.
|
||||
sight_portfolio_load_more_insert( container, settings );
|
||||
}
|
||||
|
||||
$( container ).find( '.sight-portfolio-area__main' ).removeClass( 'sight-portfolio-loading' );
|
||||
} else {
|
||||
$( container ).find( '.sight-portfolio-area__main' ).removeClass( 'sight-portfolio-loading' );
|
||||
}
|
||||
|
||||
|
||||
} ).fail( function( xhr, textStatus, e ) {
|
||||
// console.log(xhr.responseText);
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization Load More
|
||||
*/
|
||||
function sight_portfolio_load_more_init( infinite, blockId ) {
|
||||
|
||||
$( '.sight-portfolio-area' ).each( function() {
|
||||
|
||||
var sight_ajax_settings;
|
||||
|
||||
if ( blockId ) {
|
||||
let itemId = $( this ).closest( `[data-block]` ).attr( 'id' );
|
||||
|
||||
if ( itemId !== blockId ) {
|
||||
return;
|
||||
}
|
||||
} else if ( $( this ).data( 'init' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var archive_data = $( this ).data( 'items-area' );
|
||||
|
||||
if ( archive_data ) {
|
||||
sight_ajax_settings = JSON.parse( window.atob( archive_data ) );
|
||||
}
|
||||
|
||||
if ( sight_ajax_settings ) {
|
||||
// Set load more settings.
|
||||
$( this ).data( 'settings', sight_ajax_settings );
|
||||
$( this ).data( 'page', 2 );
|
||||
$( this ).data( 'loading', false );
|
||||
$( this ).data( 'scrollHandling', {
|
||||
allow: $.parseJSON( 'infinite' === sight_ajax_settings.pagination_type ? true : false ),
|
||||
delay: 400
|
||||
} );
|
||||
|
||||
if ( !infinite && ( 'infinite' === sight_ajax_settings.pagination_type ? true : false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add load more button.
|
||||
if ( sight_ajax_settings.max_num_pages > 1 ) {
|
||||
sight_portfolio_load_more_insert( this, sight_ajax_settings );
|
||||
}
|
||||
}
|
||||
|
||||
$( this ).data( 'init', true );
|
||||
} );
|
||||
}
|
||||
|
||||
sight_portfolio_load_more_init( true, false );
|
||||
|
||||
sight.addAction( 'sight.components.serverSideRender.onChange', 'sight/portfolio/loadmore', function( props ) {
|
||||
if ( 'sight/portfolio' === props.block ) {
|
||||
|
||||
let blockId = $( `[id=block-${props.blockProps.clientId}]` ).attr( 'id' );
|
||||
|
||||
sight_portfolio_load_more_init( false, blockId );
|
||||
}
|
||||
} );
|
||||
|
||||
// On Scroll Event.
|
||||
$( window ).scroll( function() {
|
||||
|
||||
$( '.sight-portfolio-area .sight-portfolio-load-more' ).each( function() {
|
||||
|
||||
var container = $( this ).closest( '.sight-portfolio-area' );
|
||||
|
||||
// Vars loading.
|
||||
var loading = $( container ).data( 'loading' );
|
||||
var scrollHandling = $( container ).data( 'scrollHandling' );
|
||||
|
||||
if ( 'undefined' === typeof scrollHandling ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $( this ).length && !loading && scrollHandling.allow ) {
|
||||
|
||||
scrollHandling.allow = false;
|
||||
|
||||
$( container ).data( 'scrollHandling', scrollHandling );
|
||||
|
||||
setTimeout( function() {
|
||||
var scrollHandling = $( container ).data( 'scrollHandling' );
|
||||
|
||||
if ( 'undefined' === typeof scrollHandling ) {
|
||||
return;
|
||||
}
|
||||
|
||||
scrollHandling.allow = true;
|
||||
|
||||
$( container ).data( 'scrollHandling', scrollHandling );
|
||||
}, scrollHandling.delay );
|
||||
|
||||
var offset = $( this ).offset().top - $( window ).scrollTop();
|
||||
if ( 4000 > offset ) {
|
||||
sight_portfolio_ajax_get_posts( container );
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// On Click Event.
|
||||
$( 'body' ).on( 'click', '.sight-portfolio-load-more', function() {
|
||||
var container = $( this ).closest( '.sight-portfolio-area' );
|
||||
var loading = $( this ).data( 'loading' );
|
||||
|
||||
if ( !loading ) {
|
||||
sight_portfolio_ajax_get_posts( container, false );
|
||||
}
|
||||
} );
|
||||
|
||||
// On Click Categories.
|
||||
$( 'body' ).on( 'click', '.sight-portfolio-area-filter__list a', function( e ) {
|
||||
var container = $( this ).closest( '.sight-portfolio-area' );
|
||||
|
||||
// Remove active item.
|
||||
$( this ).parent().siblings().removeClass( 'sight-filter-active' );
|
||||
|
||||
// Active item.
|
||||
$( this ).parent().addClass( 'sight-filter-active' );
|
||||
|
||||
// Ajax.
|
||||
sight_portfolio_ajax_get_posts( container, true );
|
||||
|
||||
e.preventDefault();
|
||||
} );
|
||||
@@ -0,0 +1,544 @@
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Video Background */
|
||||
|
||||
import {
|
||||
$,
|
||||
$window,
|
||||
$doc,
|
||||
$body
|
||||
} from './utility';
|
||||
|
||||
var sightVideoPortfolio = {};
|
||||
|
||||
( function() {
|
||||
var $this;
|
||||
var YTdeferredDone = false;
|
||||
var initAPI = false;
|
||||
var process = false;
|
||||
var contex = [];
|
||||
var players = [];
|
||||
var attrs = [];
|
||||
|
||||
// Create deferred object
|
||||
var YTdeferred = $.Deferred();
|
||||
|
||||
if ( typeof window.onYouTubePlayerAPIReady !== 'undefined' ) {
|
||||
if ( typeof window.sightYTAPIReady === 'undefined' ) {
|
||||
window.sightYTAPIReady = [];
|
||||
}
|
||||
window.sightYTAPIReady.push( window.onYouTubePlayerAPIReady );
|
||||
}
|
||||
|
||||
window.onYouTubePlayerAPIReady = function() {
|
||||
if ( typeof window.sightYTAPIReady !== 'undefined' ) {
|
||||
if ( window.sightYTAPIReady.length ) {
|
||||
window.sightYTAPIReady.pop()();
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve when youtube callback is called
|
||||
// passing YT as a parameter.
|
||||
YTdeferred.resolve( window.YT );
|
||||
};
|
||||
|
||||
// Whenever youtube callback was called = deferred resolved
|
||||
// your custom function will be executed with YT as an argument.
|
||||
YTdeferred.done( function( YT ) {
|
||||
YTdeferredDone = true;
|
||||
} );
|
||||
|
||||
// Embedding youtube iframe api.
|
||||
function embedYoutubeAPI() {
|
||||
if ( 'function' === typeof( window.onYTReady ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tag = document.createElement( 'script' );
|
||||
tag.src = 'https://www.youtube.com/iframe_api';
|
||||
|
||||
var firstScriptTag = document.getElementsByTagName( 'script' )[ 0 ];
|
||||
firstScriptTag.parentNode.insertBefore( tag, firstScriptTag );
|
||||
}
|
||||
|
||||
$.fn.contexObject = function( id, type ) {
|
||||
if ( 'string' === typeof id ) {
|
||||
id = `[data-id="${id}"]`;
|
||||
} else {
|
||||
id = this;
|
||||
}
|
||||
|
||||
if ( 'wrap' === type ) {
|
||||
return $( id ).closest( '.sight-portfolio-video-wrap' );
|
||||
} else if ( 'container' === type ) {
|
||||
return $( id ).closest( '.sight-portfolio-video-container' );
|
||||
} else if ( 'inner' === type ) {
|
||||
return $( id ).closest( '.sight-portfolio-video-wrap' ).find( '.sight-portfolio-video-inner' );
|
||||
} else {
|
||||
return $( id );
|
||||
}
|
||||
};
|
||||
|
||||
// Object Video Portfolio.
|
||||
sightVideoPortfolio = {
|
||||
|
||||
/** Initialize */
|
||||
init: function( e ) {
|
||||
if ( $( 'body' ).hasClass( 'wp-admin' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this = sightVideoPortfolio;
|
||||
|
||||
// Init events.
|
||||
$this.events( e );
|
||||
},
|
||||
|
||||
// Video rescale.
|
||||
rescaleVideoBackground: function() {
|
||||
$( '.sight-portfolio-video-init' ).each( function() {
|
||||
let w = $( this ).parent().width();
|
||||
let h = $( this ).parent().height();
|
||||
|
||||
var hideControl = 400;
|
||||
|
||||
let id = $( this ).attr( 'data-id' );
|
||||
|
||||
if ( w / h > 16 / 9 ) {
|
||||
if ( 'youtube' === $( this ).parent().data( 'video-mode' ) ) {
|
||||
players[ id ].setSize( w, w / 16 * 9 + hideControl );
|
||||
} else {
|
||||
players[ id ].width( w );
|
||||
players[ id ].height( w / 16 * 9 + hideControl );
|
||||
}
|
||||
} else {
|
||||
if ( 'youtube' === $( this ).parent().data( 'video-mode' ) ) {
|
||||
players[ id ].setSize( h / 9 * 16, h + hideControl );
|
||||
} else {
|
||||
players[ id ].width( h / 9 * 16 );
|
||||
players[ id ].height( h + hideControl );
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
// Init video background.
|
||||
initVideoBackground: function( mode, object ) {
|
||||
|
||||
$( '.sight-portfolio-video-inner' ).each( function() {
|
||||
|
||||
// The mode.
|
||||
if ( !$( this ).parent().is( `[data-video-mode="${mode}"]` ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The state.
|
||||
var isInit = $( this ).hasClass( 'sight-portfolio-video-init' );
|
||||
|
||||
var id = null;
|
||||
|
||||
// Generate unique ID.
|
||||
if ( !isInit ) {
|
||||
id = Math.random().toString( 36 ).substr( 2, 9 );
|
||||
} else {
|
||||
id = $( this ).attr( 'data-id' );
|
||||
}
|
||||
|
||||
// Create contex.
|
||||
contex[ id ] = this;
|
||||
|
||||
// The monitor.
|
||||
var isInView = $( contex[ id ] ).isInViewport();
|
||||
|
||||
// The actived.
|
||||
var isActive = $( contex[ id ] ).hasClass( 'active' );
|
||||
|
||||
// Get video attrs.
|
||||
var youtubeID = $( contex[ id ] ).parent().data( 'youtube-id' );
|
||||
var videoType = $( contex[ id ] ).parent().data( 'video-type' );
|
||||
var videoStart = $( contex[ id ] ).parent().data( 'video-start' );
|
||||
var videoEnd = $( contex[ id ] ).parent().data( 'video-end' );
|
||||
|
||||
// Initialization.
|
||||
if ( isInView && !isInit ) {
|
||||
|
||||
// Add init class.
|
||||
$( contex[ id ] ).addClass( 'sight-portfolio-video-init' );
|
||||
|
||||
// Add unique ID.
|
||||
$( contex[ id ] ).attr( 'data-id', id );
|
||||
|
||||
// Check video mode.
|
||||
if ( 'youtube' === mode ) {
|
||||
// Check video id.
|
||||
if ( typeof youtubeID === 'undefined' || !youtubeID ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Video attrs.
|
||||
attrs[ id ] = {
|
||||
'videoId': youtubeID,
|
||||
'startSeconds': videoStart,
|
||||
'endSeconds': videoEnd,
|
||||
'suggestedQuality': 'hd720'
|
||||
};
|
||||
|
||||
// Creating a player.
|
||||
players[ id ] = new YT.Player( contex[ id ], {
|
||||
playerVars: {
|
||||
autoplay: 0,
|
||||
autohide: 1,
|
||||
modestbranding: 1,
|
||||
rel: 0,
|
||||
showinfo: 0,
|
||||
controls: 0,
|
||||
disablekb: 1,
|
||||
enablejsapi: 0,
|
||||
iv_load_policy: 3,
|
||||
playsinline: 1,
|
||||
loop: 1
|
||||
},
|
||||
events: {
|
||||
'onReady': function() {
|
||||
|
||||
players[ id ].cueVideoById( attrs[ id ] );
|
||||
players[ id ].mute();
|
||||
|
||||
if ( 'always' === videoType ) {
|
||||
$this.playVideo( id );
|
||||
}
|
||||
},
|
||||
'onStateChange': function( e ) {
|
||||
if ( e.data === 1 ) {
|
||||
$( this ).contexObject( id ).closest( '.sight-portfolio-video-wrap' ).addClass( 'sight-portfolio-video-bg-init' );
|
||||
$( this ).contexObject( id ).addClass( 'active' );
|
||||
} else if ( e.data === 0 ) {
|
||||
players[ id ].seekTo( attrs[ id ].startSeconds );
|
||||
} else if ( e.data === 5 ) {
|
||||
players[ id ].videoReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
// Creating a player.
|
||||
players[ id ] = $( contex[ id ] );
|
||||
|
||||
// Ready play.
|
||||
players[ id ].on( 'canplay', function() {
|
||||
players[ id ].videoReady = true;
|
||||
|
||||
if ( true !== players[ id ].start ) {
|
||||
players[ id ].start = true;
|
||||
|
||||
this.currentTime = videoStart ? videoStart : 0;
|
||||
|
||||
if ( 'always' === videoType ) {
|
||||
$this.playVideo( id );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// Play.
|
||||
players[ id ].on( 'play', function() {
|
||||
players[ id ].parents( '.sight-portfolio-video-wrap' ).addClass( 'sight-portfolio-video-bg-init' );
|
||||
players[ id ].addClass( 'active' );
|
||||
} );
|
||||
|
||||
// Ended.
|
||||
players[ id ].on( 'timeupdate', function() {
|
||||
if ( videoEnd && this.currentTime >= videoEnd ) {
|
||||
players[ id ].trigger( 'pause' );
|
||||
|
||||
this.currentTime = videoStart;
|
||||
|
||||
players[ id ].trigger( 'play' );
|
||||
}
|
||||
} );
|
||||
|
||||
players[ id ].trigger( 'load' );
|
||||
}
|
||||
|
||||
$this.rescaleVideoBackground();
|
||||
}
|
||||
|
||||
// Pause and play.
|
||||
if ( 'always' === videoType && isActive && isInit && ! $this.getVideoUpause( id ) ) {
|
||||
|
||||
if ( isInView ) {
|
||||
$this.playVideo( id );
|
||||
}
|
||||
|
||||
if ( ! isInView ) {
|
||||
$this.pauseVideo( id );
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
// Construct video background.
|
||||
constructVideoBackground: function( object ) {
|
||||
if ( $( 'body' ).hasClass( 'wp-admin' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( process ) {
|
||||
return;
|
||||
}
|
||||
|
||||
process = true;
|
||||
|
||||
// Smart init API.
|
||||
if ( !initAPI ) {
|
||||
let elements = $( '[data-video-mode="youtube"][data-youtube-id]' );
|
||||
|
||||
if ( elements.length ) {
|
||||
embedYoutubeAPI();
|
||||
|
||||
initAPI = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !initAPI ) {
|
||||
process = false;
|
||||
}
|
||||
|
||||
// Play Video.
|
||||
$this.initVideoBackground( 'local', object );
|
||||
|
||||
if ( initAPI && YTdeferredDone ) {
|
||||
$this.initVideoBackground( 'youtube', object );
|
||||
}
|
||||
|
||||
process = false;
|
||||
},
|
||||
|
||||
// Get video type.
|
||||
getVideoType: function( id ) {
|
||||
return $( this ).contexObject( id, 'container' ).data( 'video-type' );
|
||||
},
|
||||
|
||||
// Get video mode.
|
||||
getVideoMode: function( id ) {
|
||||
return $( this ).contexObject( id, 'container' ).data( 'video-mode' );
|
||||
},
|
||||
|
||||
// Get video state.
|
||||
getVideoState: function( id ) {
|
||||
return players[ id ].videoState;
|
||||
},
|
||||
|
||||
// Get video ready.
|
||||
getVideoReady: function( id ) {
|
||||
return players[ id ].videoReady ? players[ id ].videoReady : false;
|
||||
},
|
||||
|
||||
// Get video upause.
|
||||
getVideoUpause: function( id ) {
|
||||
return players[ id ].videoUpause ? players[ id ].videoUpause : false;
|
||||
},
|
||||
|
||||
// Get video volume.
|
||||
getVideoVolume: function( id ) {
|
||||
return players[ id ].videoVolume ? players[ id ].videoVolume : 'mute';
|
||||
},
|
||||
|
||||
// Change video upause.
|
||||
changeVideoUpause: function( id, val ) {
|
||||
players[ id ].videoUpause = val;
|
||||
},
|
||||
|
||||
// Play video.
|
||||
playVideo: function( id ) {
|
||||
if ( 'play' === players[ id ].videoState ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! players[ id ].videoReady ) {
|
||||
return setTimeout(function(){
|
||||
$this.playVideo( id );
|
||||
}, 100);
|
||||
}
|
||||
|
||||
if ( 'youtube' === $this.getVideoMode( id ) ) {
|
||||
players[ id ].playVideo();
|
||||
} else {
|
||||
players[ id ].trigger( 'play' );
|
||||
}
|
||||
|
||||
// Change control.
|
||||
let control = $( this ).contexObject( id, 'wrap' ).find( '.sight-portfolio-player-state' );
|
||||
|
||||
$( control ).removeClass( 'sight-portfolio-player-pause' );
|
||||
$( control ).addClass( 'sight-portfolio-player-play' );
|
||||
|
||||
// Set state.
|
||||
players[ id ].videoState = 'play';
|
||||
},
|
||||
|
||||
// Pause video.
|
||||
pauseVideo: function( id ) {
|
||||
if ( 'pause' === players[ id ].videoState ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! players[ id ].videoReady ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'youtube' === $this.getVideoMode( id ) ) {
|
||||
players[ id ].pauseVideo();
|
||||
} else {
|
||||
players[ id ].trigger( 'pause' );
|
||||
}
|
||||
|
||||
// Change control.
|
||||
let control = $( this ).contexObject( id, 'wrap' ).find( '.sight-portfolio-player-state' );
|
||||
|
||||
$( control ).removeClass( 'sight-portfolio-player-play' );
|
||||
$( control ).addClass( 'sight-portfolio-player-pause' );
|
||||
|
||||
// Set state.
|
||||
players[ id ].videoState = 'pause';
|
||||
},
|
||||
|
||||
// Unmute video.
|
||||
unmuteVideo: function( id ) {
|
||||
if ( ! players[ id ].videoReady ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'youtube' === $this.getVideoMode( id ) ) {
|
||||
players[ id ].unMute();
|
||||
} else {
|
||||
players[ id ].prop( 'muted', false );
|
||||
}
|
||||
|
||||
// Change control.
|
||||
let control = $( this ).contexObject( id, 'wrap' ).find( '.sight-portfolio-player-volume' );
|
||||
|
||||
$( control ).removeClass( 'sight-portfolio-player-mute' );
|
||||
$( control ).addClass( 'sight-portfolio-player-unmute' );
|
||||
|
||||
// Set state.
|
||||
players[ id ].videoVolume = 'unmute';
|
||||
},
|
||||
|
||||
// Mute video.
|
||||
muteVideo: function( id ) {
|
||||
if ( ! players[ id ].videoReady ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'youtube' === $this.getVideoMode( id ) ) {
|
||||
players[ id ].mute();
|
||||
} else {
|
||||
players[ id ].prop( 'muted', true );
|
||||
}
|
||||
|
||||
// Change control.
|
||||
let control = $( this ).contexObject( id, 'wrap' ).find( '.sight-portfolio-player-volume' );
|
||||
|
||||
$( control ).removeClass( 'sight-portfolio-player-unmute' );
|
||||
$( control ).addClass( 'sight-portfolio-player-mute' );
|
||||
|
||||
// Set state.
|
||||
players[ id ].videoVolume = 'muted';
|
||||
},
|
||||
|
||||
// Toogle video state.
|
||||
toogleVideoState: function( id ) {
|
||||
if ( 'play' === $this.getVideoState( id ) ) {
|
||||
$this.pauseVideo( id );
|
||||
} else {
|
||||
$this.playVideo( id );
|
||||
}
|
||||
},
|
||||
|
||||
// Toogle video volume.
|
||||
toogleVideoVolume: function( id ) {
|
||||
if ( 'unmute' === $this.getVideoVolume( id ) ) {
|
||||
$this.muteVideo( id );
|
||||
} else {
|
||||
$this.unmuteVideo( id );
|
||||
}
|
||||
},
|
||||
|
||||
/** Events */
|
||||
events: function( e ) {
|
||||
// State Control.
|
||||
$doc.on( 'click', '.sight-portfolio-player-state', function() {
|
||||
let id = $( this ).contexObject( false, 'inner' ).attr( 'data-id' );
|
||||
|
||||
$this.toogleVideoState( id );
|
||||
|
||||
if ( 'play' === $this.getVideoState( id ) ) {
|
||||
$this.changeVideoUpause( id, false );
|
||||
} else {
|
||||
$this.changeVideoUpause( id, true );
|
||||
}
|
||||
} );
|
||||
|
||||
// Stop Control.
|
||||
$doc.on( 'click', '.sight-portfolio-player-stop', function() {
|
||||
let id = $( this ).contexObject( false, 'inner' ).attr( 'data-id' );
|
||||
|
||||
if ( 'play' === $this.getVideoState( id ) ) {
|
||||
$this.changeVideoUpause( id, true );
|
||||
}
|
||||
|
||||
$this.pauseVideo( id );
|
||||
} );
|
||||
|
||||
// Volume Control.
|
||||
$doc.on( 'click', '.sight-portfolio-player-volume', function() {
|
||||
let id = $( this ).contexObject( false, 'inner' ).attr( 'data-id' );
|
||||
|
||||
$this.toogleVideoVolume( id );
|
||||
} );
|
||||
|
||||
// Mouseover.
|
||||
$doc.on( 'mouseover mousemove', '.sight-portfolio-entry__thumbnail', function() {
|
||||
let id = $( this ).contexObject( false, 'inner' ).attr( 'data-id' );
|
||||
|
||||
if ( 'hover' === $this.getVideoType( id ) ) {
|
||||
$this.playVideo( id );
|
||||
}
|
||||
} );
|
||||
|
||||
// Mouseout.
|
||||
$doc.on( 'mouseout', '.sight-portfolio-entry__thumbnail', function() {
|
||||
let id = $( this ).contexObject( false, 'inner' ).attr( 'data-id' );
|
||||
|
||||
if ( 'hover' === $this.getVideoType( id ) ) {
|
||||
$this.pauseVideo( id );
|
||||
}
|
||||
} );
|
||||
|
||||
// Document scroll.
|
||||
$window.on( 'load scroll resize scrollstop', function() {
|
||||
$this.constructVideoBackground();
|
||||
} );
|
||||
|
||||
// Document ready.
|
||||
$doc.ready( function() {
|
||||
$this.constructVideoBackground();
|
||||
} );
|
||||
|
||||
// Post load.
|
||||
$body.on( 'post-load', function() {
|
||||
$this.constructVideoBackground();
|
||||
} );
|
||||
|
||||
// Document resize.
|
||||
$window.on( 'resize', function() {
|
||||
$this.rescaleVideoBackground();
|
||||
} );
|
||||
|
||||
// Init.
|
||||
$this.constructVideoBackground();
|
||||
}
|
||||
};
|
||||
} )();
|
||||
|
||||
// Initialize.
|
||||
sightVideoPortfolio.init();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,954 @@
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
__webpack_require__(1);
|
||||
__webpack_require__(3);
|
||||
module.exports = __webpack_require__(4);
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _utility__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
||||
/**
|
||||
* Lightbox
|
||||
*/
|
||||
|
||||
|
||||
(function ($) {
|
||||
$.fn.SightLightbox = function (options) {
|
||||
var settings = $.extend({
|
||||
gallery: false
|
||||
}, options);
|
||||
var containerSelector = this;
|
||||
var imageSelector = null;
|
||||
$(containerSelector).each(function () {
|
||||
if ($(this).is('img')) {
|
||||
imageSelector = this;
|
||||
} else {
|
||||
imageSelector = $(this).find('img');
|
||||
}
|
||||
|
||||
$(imageSelector).each(function () {
|
||||
var link = $(this).closest('.sight-portfolio-entry').find('.sight-portfolio-overlay-link');
|
||||
|
||||
if (!$(link).is('a')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var imagehref = $(link).attr('href');
|
||||
|
||||
if (!imagehref.match(/\.(gif|jpeg|jpg|png)/)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(link).addClass('sight-image-popup');
|
||||
});
|
||||
|
||||
if ($(this).closest('.elementor-element').length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(containerSelector).magnificPopup({
|
||||
delegate: '.sight-image-popup',
|
||||
type: 'image',
|
||||
tClose: sight_lightbox_localize.text_close + '(Esc)',
|
||||
tLoading: sight_lightbox_localize.text_loading,
|
||||
gallery: {
|
||||
enabled: settings.gallery,
|
||||
tPrev: sight_lightbox_localize.text_previous,
|
||||
tNext: sight_lightbox_localize.text_next,
|
||||
tCounter: '<span class="mfp-counter">%curr% ' + sight_lightbox_localize.text_counter + ' %total%</span>'
|
||||
},
|
||||
image: {
|
||||
titleSrc: function titleSrc(item) {
|
||||
var entry = item.el.closest('.sight-portfolio-entry');
|
||||
|
||||
if ($(entry).hasClass('sight-portfolio-entry-custom')) {
|
||||
return $(entry).find('.sight-portfolio-entry__caption').text();
|
||||
} else if ($(entry).hasClass('sight-portfolio-entry-post')) {
|
||||
return $(entry).find('.sight-portfolio-entry__caption').text();
|
||||
} else {
|
||||
return $(entry).find('.sight-portfolio-entry__heading').text();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function initSightLightbox() {
|
||||
$('.sight-portfolio-area-lightbox').imagesLoaded(function () {
|
||||
$('.sight-portfolio-area-lightbox').SightLightbox({
|
||||
gallery: true
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
initSightLightbox();
|
||||
$(document.body).on('post-load image-load', function () {
|
||||
initSightLightbox();
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
/***/ }),
|
||||
/* 2 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$", function() { return $; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$window", function() { return $window; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$doc", function() { return $doc; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$body", function() { return $body; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sight", function() { return sight; });
|
||||
// Create csco object.
|
||||
var sight = {
|
||||
addAction: function addAction(x, y, z) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if ('undefined' !== typeof wp && 'undefined' !== typeof wp.hooks) {
|
||||
sight.addAction = wp.hooks.addAction;
|
||||
}
|
||||
|
||||
if ('undefined' === typeof window.load_more_query) {
|
||||
window.load_more_query = [];
|
||||
}
|
||||
/**
|
||||
* Window size
|
||||
*/
|
||||
|
||||
|
||||
var $ = jQuery;
|
||||
var $window = $(window);
|
||||
var $doc = $(document);
|
||||
var $body = $('body');
|
||||
/**
|
||||
* In Viewport checker
|
||||
*/
|
||||
|
||||
$.fn.isInViewport = function () {
|
||||
var elementTop = $(this).offset().top;
|
||||
var elementBottom = elementTop + $(this).outerHeight();
|
||||
var viewportTop = $(window).scrollTop();
|
||||
var viewportBottom = viewportTop + $(window).height();
|
||||
return elementBottom > viewportTop && elementTop < viewportBottom;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _utility__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
||||
/**
|
||||
* AJAX Load More.
|
||||
*
|
||||
* Contains functions for AJAX Load More.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Insert Load More
|
||||
*/
|
||||
|
||||
function sight_portfolio_load_more_insert(container, settings) {
|
||||
if ('none' === settings.pagination_type) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-area__pagination').length) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).append('<div class="sight-portfolio-area__pagination"><button class="sight-portfolio-load-more">' + settings.translation.load_more + '</button></div>');
|
||||
}
|
||||
/**
|
||||
* Get next posts
|
||||
*/
|
||||
|
||||
|
||||
function sight_portfolio_ajax_get_posts(container, reload) {
|
||||
var pagination = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-area__pagination');
|
||||
var loadMore = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-load-more');
|
||||
var settings = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('settings');
|
||||
var page = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('page'); // Filter terms.
|
||||
|
||||
var terms = [];
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-area-filter__list li').each(function (index, elem) {
|
||||
if (Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).is('.sight-filter-active:not(.sight-filter-all)')) {
|
||||
terms.push(Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).find('a').data('filter'));
|
||||
}
|
||||
}); // Set area loading.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-area__main').addClass('sight-portfolio-loading'); // Set ajax settings.
|
||||
|
||||
if (reload) {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
var data = {
|
||||
action: 'sight_portfolio_ajax_load_more',
|
||||
terms: terms,
|
||||
page: page,
|
||||
posts_per_page: settings.posts_per_page,
|
||||
query_data: settings.query_data,
|
||||
attributes: settings.attributes,
|
||||
options: settings.options,
|
||||
_ajax_nonce: settings.nonce
|
||||
}; // Set the loading state.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('loading', true); // Set button text to Load More.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(loadMore).text(settings.translation.loading); // Request Url.
|
||||
|
||||
var sight_pagination_url;
|
||||
|
||||
if ('ajax_restapi' === settings.type) {
|
||||
sight_pagination_url = settings.rest_url;
|
||||
} else {
|
||||
sight_pagination_url = settings.url;
|
||||
} // Send Request.
|
||||
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$"].post(sight_pagination_url, data, function (res) {
|
||||
if (res.success) {
|
||||
// Get the posts.
|
||||
var data = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(res.data.content);
|
||||
data.imagesLoaded(function () {
|
||||
// Append new posts to list, standard and grid archives.
|
||||
if (reload) {
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-area__main').html(data);
|
||||
} else {
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-area__main').append(data);
|
||||
} // Entry animations.
|
||||
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-entry-request').each(function () {
|
||||
if (!Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).is('sight-portfolio-entry-animation')) {
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).addClass('sight-portfolio-entry-animation').animate({
|
||||
opacity: 1,
|
||||
top: 0
|
||||
}, 600);
|
||||
}
|
||||
}); // WP Post Load trigger.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(window).trigger('post-load'); // Reinit Facebook widgets.
|
||||
|
||||
if (Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('#fb-root').length) {
|
||||
FB.XFBML.parse();
|
||||
} // Set button text to Load More.
|
||||
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(loadMore).text(settings.translation.load_more); // Increment a page.
|
||||
|
||||
page = page + 1;
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('page', page); // Set the loading state.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('loading', false);
|
||||
}); // Remove Button on Posts End.
|
||||
|
||||
if (res.data.posts_end || !data.length) {
|
||||
// Remove Load More button.
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(pagination).remove();
|
||||
} else {
|
||||
// Add Load More button.
|
||||
sight_portfolio_load_more_insert(container, settings);
|
||||
}
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-area__main').removeClass('sight-portfolio-loading');
|
||||
} else {
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).find('.sight-portfolio-area__main').removeClass('sight-portfolio-loading');
|
||||
}
|
||||
}).fail(function (xhr, textStatus, e) {// console.log(xhr.responseText);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Initialization Load More
|
||||
*/
|
||||
|
||||
|
||||
function sight_portfolio_load_more_init(infinite, blockId) {
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('.sight-portfolio-area').each(function () {
|
||||
var sight_ajax_settings;
|
||||
|
||||
if (blockId) {
|
||||
var itemId = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).closest("[data-block]").attr('id');
|
||||
|
||||
if (itemId !== blockId) {
|
||||
return;
|
||||
}
|
||||
} else if (Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).data('init')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var archive_data = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).data('items-area');
|
||||
|
||||
if (archive_data) {
|
||||
sight_ajax_settings = JSON.parse(window.atob(archive_data));
|
||||
}
|
||||
|
||||
if (sight_ajax_settings) {
|
||||
// Set load more settings.
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).data('settings', sight_ajax_settings);
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).data('page', 2);
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).data('loading', false);
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).data('scrollHandling', {
|
||||
allow: _utility__WEBPACK_IMPORTED_MODULE_0__["$"].parseJSON('infinite' === sight_ajax_settings.pagination_type ? true : false),
|
||||
delay: 400
|
||||
});
|
||||
|
||||
if (!infinite && ('infinite' === sight_ajax_settings.pagination_type ? true : false)) {
|
||||
return;
|
||||
} // Add load more button.
|
||||
|
||||
|
||||
if (sight_ajax_settings.max_num_pages > 1) {
|
||||
sight_portfolio_load_more_insert(this, sight_ajax_settings);
|
||||
}
|
||||
}
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).data('init', true);
|
||||
});
|
||||
}
|
||||
|
||||
sight_portfolio_load_more_init(true, false);
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["sight"].addAction('sight.components.serverSideRender.onChange', 'sight/portfolio/loadmore', function (props) {
|
||||
if ('sight/portfolio' === props.block) {
|
||||
var blockId = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])("[id=block-".concat(props.blockProps.clientId, "]")).attr('id');
|
||||
sight_portfolio_load_more_init(false, blockId);
|
||||
}
|
||||
}); // On Scroll Event.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(window).scroll(function () {
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('.sight-portfolio-area .sight-portfolio-load-more').each(function () {
|
||||
var container = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).closest('.sight-portfolio-area'); // Vars loading.
|
||||
|
||||
var loading = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('loading');
|
||||
var scrollHandling = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('scrollHandling');
|
||||
|
||||
if ('undefined' === typeof scrollHandling) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).length && !loading && scrollHandling.allow) {
|
||||
scrollHandling.allow = false;
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('scrollHandling', scrollHandling);
|
||||
setTimeout(function () {
|
||||
var scrollHandling = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('scrollHandling');
|
||||
|
||||
if ('undefined' === typeof scrollHandling) {
|
||||
return;
|
||||
}
|
||||
|
||||
scrollHandling.allow = true;
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(container).data('scrollHandling', scrollHandling);
|
||||
}, scrollHandling.delay);
|
||||
var offset = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).offset().top - Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(window).scrollTop();
|
||||
|
||||
if (4000 > offset) {
|
||||
sight_portfolio_ajax_get_posts(container);
|
||||
}
|
||||
}
|
||||
});
|
||||
}); // On Click Event.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('body').on('click', '.sight-portfolio-load-more', function () {
|
||||
var container = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).closest('.sight-portfolio-area');
|
||||
var loading = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).data('loading');
|
||||
|
||||
if (!loading) {
|
||||
sight_portfolio_ajax_get_posts(container, false);
|
||||
}
|
||||
}); // On Click Categories.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('body').on('click', '.sight-portfolio-area-filter__list a', function (e) {
|
||||
var container = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).closest('.sight-portfolio-area'); // Remove active item.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).parent().siblings().removeClass('sight-filter-active'); // Active item.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).parent().addClass('sight-filter-active'); // Ajax.
|
||||
|
||||
sight_portfolio_ajax_get_posts(container, true);
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 4 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _utility__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Video Background */
|
||||
|
||||
var sightVideoPortfolio = {};
|
||||
|
||||
(function () {
|
||||
var $this;
|
||||
var YTdeferredDone = false;
|
||||
var initAPI = false;
|
||||
var process = false;
|
||||
var contex = [];
|
||||
var players = [];
|
||||
var attrs = []; // Create deferred object
|
||||
|
||||
var YTdeferred = _utility__WEBPACK_IMPORTED_MODULE_0__["$"].Deferred();
|
||||
|
||||
if (typeof window.onYouTubePlayerAPIReady !== 'undefined') {
|
||||
if (typeof window.sightYTAPIReady === 'undefined') {
|
||||
window.sightYTAPIReady = [];
|
||||
}
|
||||
|
||||
window.sightYTAPIReady.push(window.onYouTubePlayerAPIReady);
|
||||
}
|
||||
|
||||
window.onYouTubePlayerAPIReady = function () {
|
||||
if (typeof window.sightYTAPIReady !== 'undefined') {
|
||||
if (window.sightYTAPIReady.length) {
|
||||
window.sightYTAPIReady.pop()();
|
||||
}
|
||||
} // Resolve when youtube callback is called
|
||||
// passing YT as a parameter.
|
||||
|
||||
|
||||
YTdeferred.resolve(window.YT);
|
||||
}; // Whenever youtube callback was called = deferred resolved
|
||||
// your custom function will be executed with YT as an argument.
|
||||
|
||||
|
||||
YTdeferred.done(function (YT) {
|
||||
YTdeferredDone = true;
|
||||
}); // Embedding youtube iframe api.
|
||||
|
||||
function embedYoutubeAPI() {
|
||||
if ('function' === typeof window.onYTReady) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tag = document.createElement('script');
|
||||
tag.src = 'https://www.youtube.com/iframe_api';
|
||||
var firstScriptTag = document.getElementsByTagName('script')[0];
|
||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||
}
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$"].fn.contexObject = function (id, type) {
|
||||
if ('string' === typeof id) {
|
||||
id = "[data-id=\"".concat(id, "\"]");
|
||||
} else {
|
||||
id = this;
|
||||
}
|
||||
|
||||
if ('wrap' === type) {
|
||||
return Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(id).closest('.sight-portfolio-video-wrap');
|
||||
} else if ('container' === type) {
|
||||
return Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(id).closest('.sight-portfolio-video-container');
|
||||
} else if ('inner' === type) {
|
||||
return Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(id).closest('.sight-portfolio-video-wrap').find('.sight-portfolio-video-inner');
|
||||
} else {
|
||||
return Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(id);
|
||||
}
|
||||
}; // Object Video Portfolio.
|
||||
|
||||
|
||||
sightVideoPortfolio = {
|
||||
/** Initialize */
|
||||
init: function init(e) {
|
||||
if (Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('body').hasClass('wp-admin')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this = sightVideoPortfolio; // Init events.
|
||||
|
||||
$this.events(e);
|
||||
},
|
||||
// Video rescale.
|
||||
rescaleVideoBackground: function rescaleVideoBackground() {
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('.sight-portfolio-video-init').each(function () {
|
||||
var w = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).parent().width();
|
||||
var h = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).parent().height();
|
||||
var hideControl = 400;
|
||||
var id = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).attr('data-id');
|
||||
|
||||
if (w / h > 16 / 9) {
|
||||
if ('youtube' === Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).parent().data('video-mode')) {
|
||||
players[id].setSize(w, w / 16 * 9 + hideControl);
|
||||
} else {
|
||||
players[id].width(w);
|
||||
players[id].height(w / 16 * 9 + hideControl);
|
||||
}
|
||||
} else {
|
||||
if ('youtube' === Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).parent().data('video-mode')) {
|
||||
players[id].setSize(h / 9 * 16, h + hideControl);
|
||||
} else {
|
||||
players[id].width(h / 9 * 16);
|
||||
players[id].height(h + hideControl);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// Init video background.
|
||||
initVideoBackground: function initVideoBackground(mode, object) {
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('.sight-portfolio-video-inner').each(function () {
|
||||
// The mode.
|
||||
if (!Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).parent().is("[data-video-mode=\"".concat(mode, "\"]"))) {
|
||||
return;
|
||||
} // The state.
|
||||
|
||||
|
||||
var isInit = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).hasClass('sight-portfolio-video-init');
|
||||
var id = null; // Generate unique ID.
|
||||
|
||||
if (!isInit) {
|
||||
id = Math.random().toString(36).substr(2, 9);
|
||||
} else {
|
||||
id = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).attr('data-id');
|
||||
} // Create contex.
|
||||
|
||||
|
||||
contex[id] = this; // The monitor.
|
||||
|
||||
var isInView = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(contex[id]).isInViewport(); // The actived.
|
||||
|
||||
var isActive = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(contex[id]).hasClass('active'); // Get video attrs.
|
||||
|
||||
var youtubeID = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(contex[id]).parent().data('youtube-id');
|
||||
var videoType = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(contex[id]).parent().data('video-type');
|
||||
var videoStart = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(contex[id]).parent().data('video-start');
|
||||
var videoEnd = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(contex[id]).parent().data('video-end'); // Initialization.
|
||||
|
||||
if (isInView && !isInit) {
|
||||
// Add init class.
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(contex[id]).addClass('sight-portfolio-video-init'); // Add unique ID.
|
||||
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(contex[id]).attr('data-id', id); // Check video mode.
|
||||
|
||||
if ('youtube' === mode) {
|
||||
// Check video id.
|
||||
if (typeof youtubeID === 'undefined' || !youtubeID) {
|
||||
return;
|
||||
} // Video attrs.
|
||||
|
||||
|
||||
attrs[id] = {
|
||||
'videoId': youtubeID,
|
||||
'startSeconds': videoStart,
|
||||
'endSeconds': videoEnd,
|
||||
'suggestedQuality': 'hd720'
|
||||
}; // Creating a player.
|
||||
|
||||
players[id] = new YT.Player(contex[id], {
|
||||
playerVars: {
|
||||
autoplay: 0,
|
||||
autohide: 1,
|
||||
modestbranding: 1,
|
||||
rel: 0,
|
||||
showinfo: 0,
|
||||
controls: 0,
|
||||
disablekb: 1,
|
||||
enablejsapi: 0,
|
||||
iv_load_policy: 3,
|
||||
playsinline: 1,
|
||||
loop: 1
|
||||
},
|
||||
events: {
|
||||
'onReady': function onReady() {
|
||||
players[id].cueVideoById(attrs[id]);
|
||||
players[id].mute();
|
||||
|
||||
if ('always' === videoType) {
|
||||
$this.playVideo(id);
|
||||
}
|
||||
},
|
||||
'onStateChange': function onStateChange(e) {
|
||||
if (e.data === 1) {
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(id).closest('.sight-portfolio-video-wrap').addClass('sight-portfolio-video-bg-init');
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(id).addClass('active');
|
||||
} else if (e.data === 0) {
|
||||
players[id].seekTo(attrs[id].startSeconds);
|
||||
} else if (e.data === 5) {
|
||||
players[id].videoReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Creating a player.
|
||||
players[id] = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(contex[id]); // Ready play.
|
||||
|
||||
players[id].on('canplay', function () {
|
||||
players[id].videoReady = true;
|
||||
|
||||
if (true !== players[id].start) {
|
||||
players[id].start = true;
|
||||
this.currentTime = videoStart ? videoStart : 0;
|
||||
|
||||
if ('always' === videoType) {
|
||||
$this.playVideo(id);
|
||||
}
|
||||
}
|
||||
}); // Play.
|
||||
|
||||
players[id].on('play', function () {
|
||||
players[id].parents('.sight-portfolio-video-wrap').addClass('sight-portfolio-video-bg-init');
|
||||
players[id].addClass('active');
|
||||
}); // Ended.
|
||||
|
||||
players[id].on('timeupdate', function () {
|
||||
if (videoEnd && this.currentTime >= videoEnd) {
|
||||
players[id].trigger('pause');
|
||||
this.currentTime = videoStart;
|
||||
players[id].trigger('play');
|
||||
}
|
||||
});
|
||||
players[id].trigger('load');
|
||||
}
|
||||
|
||||
$this.rescaleVideoBackground();
|
||||
} // Pause and play.
|
||||
|
||||
|
||||
if ('always' === videoType && isActive && isInit && !$this.getVideoUpause(id)) {
|
||||
if (isInView) {
|
||||
$this.playVideo(id);
|
||||
}
|
||||
|
||||
if (!isInView) {
|
||||
$this.pauseVideo(id);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// Construct video background.
|
||||
constructVideoBackground: function constructVideoBackground(object) {
|
||||
if (Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('body').hasClass('wp-admin')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (process) {
|
||||
return;
|
||||
}
|
||||
|
||||
process = true; // Smart init API.
|
||||
|
||||
if (!initAPI) {
|
||||
var elements = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])('[data-video-mode="youtube"][data-youtube-id]');
|
||||
|
||||
if (elements.length) {
|
||||
embedYoutubeAPI();
|
||||
initAPI = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!initAPI) {
|
||||
process = false;
|
||||
} // Play Video.
|
||||
|
||||
|
||||
$this.initVideoBackground('local', object);
|
||||
|
||||
if (initAPI && YTdeferredDone) {
|
||||
$this.initVideoBackground('youtube', object);
|
||||
}
|
||||
|
||||
process = false;
|
||||
},
|
||||
// Get video type.
|
||||
getVideoType: function getVideoType(id) {
|
||||
return Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(id, 'container').data('video-type');
|
||||
},
|
||||
// Get video mode.
|
||||
getVideoMode: function getVideoMode(id) {
|
||||
return Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(id, 'container').data('video-mode');
|
||||
},
|
||||
// Get video state.
|
||||
getVideoState: function getVideoState(id) {
|
||||
return players[id].videoState;
|
||||
},
|
||||
// Get video ready.
|
||||
getVideoReady: function getVideoReady(id) {
|
||||
return players[id].videoReady ? players[id].videoReady : false;
|
||||
},
|
||||
// Get video upause.
|
||||
getVideoUpause: function getVideoUpause(id) {
|
||||
return players[id].videoUpause ? players[id].videoUpause : false;
|
||||
},
|
||||
// Get video volume.
|
||||
getVideoVolume: function getVideoVolume(id) {
|
||||
return players[id].videoVolume ? players[id].videoVolume : 'mute';
|
||||
},
|
||||
// Change video upause.
|
||||
changeVideoUpause: function changeVideoUpause(id, val) {
|
||||
players[id].videoUpause = val;
|
||||
},
|
||||
// Play video.
|
||||
playVideo: function playVideo(id) {
|
||||
if ('play' === players[id].videoState) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!players[id].videoReady) {
|
||||
return setTimeout(function () {
|
||||
$this.playVideo(id);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
if ('youtube' === $this.getVideoMode(id)) {
|
||||
players[id].playVideo();
|
||||
} else {
|
||||
players[id].trigger('play');
|
||||
} // Change control.
|
||||
|
||||
|
||||
var control = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(id, 'wrap').find('.sight-portfolio-player-state');
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(control).removeClass('sight-portfolio-player-pause');
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(control).addClass('sight-portfolio-player-play'); // Set state.
|
||||
|
||||
players[id].videoState = 'play';
|
||||
},
|
||||
// Pause video.
|
||||
pauseVideo: function pauseVideo(id) {
|
||||
if ('pause' === players[id].videoState) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!players[id].videoReady) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ('youtube' === $this.getVideoMode(id)) {
|
||||
players[id].pauseVideo();
|
||||
} else {
|
||||
players[id].trigger('pause');
|
||||
} // Change control.
|
||||
|
||||
|
||||
var control = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(id, 'wrap').find('.sight-portfolio-player-state');
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(control).removeClass('sight-portfolio-player-play');
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(control).addClass('sight-portfolio-player-pause'); // Set state.
|
||||
|
||||
players[id].videoState = 'pause';
|
||||
},
|
||||
// Unmute video.
|
||||
unmuteVideo: function unmuteVideo(id) {
|
||||
if (!players[id].videoReady) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ('youtube' === $this.getVideoMode(id)) {
|
||||
players[id].unMute();
|
||||
} else {
|
||||
players[id].prop('muted', false);
|
||||
} // Change control.
|
||||
|
||||
|
||||
var control = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(id, 'wrap').find('.sight-portfolio-player-volume');
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(control).removeClass('sight-portfolio-player-mute');
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(control).addClass('sight-portfolio-player-unmute'); // Set state.
|
||||
|
||||
players[id].videoVolume = 'unmute';
|
||||
},
|
||||
// Mute video.
|
||||
muteVideo: function muteVideo(id) {
|
||||
if (!players[id].videoReady) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ('youtube' === $this.getVideoMode(id)) {
|
||||
players[id].mute();
|
||||
} else {
|
||||
players[id].prop('muted', true);
|
||||
} // Change control.
|
||||
|
||||
|
||||
var control = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(id, 'wrap').find('.sight-portfolio-player-volume');
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(control).removeClass('sight-portfolio-player-unmute');
|
||||
Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(control).addClass('sight-portfolio-player-mute'); // Set state.
|
||||
|
||||
players[id].videoVolume = 'muted';
|
||||
},
|
||||
// Toogle video state.
|
||||
toogleVideoState: function toogleVideoState(id) {
|
||||
if ('play' === $this.getVideoState(id)) {
|
||||
$this.pauseVideo(id);
|
||||
} else {
|
||||
$this.playVideo(id);
|
||||
}
|
||||
},
|
||||
// Toogle video volume.
|
||||
toogleVideoVolume: function toogleVideoVolume(id) {
|
||||
if ('unmute' === $this.getVideoVolume(id)) {
|
||||
$this.muteVideo(id);
|
||||
} else {
|
||||
$this.unmuteVideo(id);
|
||||
}
|
||||
},
|
||||
|
||||
/** Events */
|
||||
events: function events(e) {
|
||||
// State Control.
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$doc"].on('click', '.sight-portfolio-player-state', function () {
|
||||
var id = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(false, 'inner').attr('data-id');
|
||||
$this.toogleVideoState(id);
|
||||
|
||||
if ('play' === $this.getVideoState(id)) {
|
||||
$this.changeVideoUpause(id, false);
|
||||
} else {
|
||||
$this.changeVideoUpause(id, true);
|
||||
}
|
||||
}); // Stop Control.
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$doc"].on('click', '.sight-portfolio-player-stop', function () {
|
||||
var id = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(false, 'inner').attr('data-id');
|
||||
|
||||
if ('play' === $this.getVideoState(id)) {
|
||||
$this.changeVideoUpause(id, true);
|
||||
}
|
||||
|
||||
$this.pauseVideo(id);
|
||||
}); // Volume Control.
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$doc"].on('click', '.sight-portfolio-player-volume', function () {
|
||||
var id = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(false, 'inner').attr('data-id');
|
||||
$this.toogleVideoVolume(id);
|
||||
}); // Mouseover.
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$doc"].on('mouseover mousemove', '.sight-portfolio-entry__thumbnail', function () {
|
||||
var id = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(false, 'inner').attr('data-id');
|
||||
|
||||
if ('hover' === $this.getVideoType(id)) {
|
||||
$this.playVideo(id);
|
||||
}
|
||||
}); // Mouseout.
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$doc"].on('mouseout', '.sight-portfolio-entry__thumbnail', function () {
|
||||
var id = Object(_utility__WEBPACK_IMPORTED_MODULE_0__["$"])(this).contexObject(false, 'inner').attr('data-id');
|
||||
|
||||
if ('hover' === $this.getVideoType(id)) {
|
||||
$this.pauseVideo(id);
|
||||
}
|
||||
}); // Document scroll.
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$window"].on('load scroll resize scrollstop', function () {
|
||||
$this.constructVideoBackground();
|
||||
}); // Document ready.
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$doc"].ready(function () {
|
||||
$this.constructVideoBackground();
|
||||
}); // Post load.
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$body"].on('post-load', function () {
|
||||
$this.constructVideoBackground();
|
||||
}); // Document resize.
|
||||
|
||||
_utility__WEBPACK_IMPORTED_MODULE_0__["$window"].on('resize', function () {
|
||||
$this.rescaleVideoBackground();
|
||||
}); // Init.
|
||||
|
||||
$this.constructVideoBackground();
|
||||
}
|
||||
};
|
||||
})(); // Initialize.
|
||||
|
||||
|
||||
sightVideoPortfolio.init();
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
||||
@@ -0,0 +1,43 @@
|
||||
// Create csco object.
|
||||
var sight = {
|
||||
addAction: function( x, y, z ) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if ( 'undefined' !== typeof wp && 'undefined' !== typeof wp.hooks ) {
|
||||
sight.addAction = wp.hooks.addAction;
|
||||
}
|
||||
|
||||
if ( 'undefined' === typeof window.load_more_query ) {
|
||||
window.load_more_query = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Window size
|
||||
*/
|
||||
const $ = jQuery;
|
||||
const $window = $( window );
|
||||
const $doc = $( document );
|
||||
const $body = $( 'body' );
|
||||
|
||||
/**
|
||||
* In Viewport checker
|
||||
*/
|
||||
$.fn.isInViewport = function() {
|
||||
var elementTop = $( this ).offset().top;
|
||||
var elementBottom = elementTop + $( this ).outerHeight();
|
||||
|
||||
var viewportTop = $( window ).scrollTop();
|
||||
var viewportBottom = viewportTop + $( window ).height();
|
||||
|
||||
return elementBottom > viewportTop && elementTop < viewportBottom;
|
||||
};
|
||||
|
||||
export {
|
||||
$,
|
||||
$window,
|
||||
$doc,
|
||||
$body,
|
||||
sight
|
||||
};
|
||||
@@ -0,0 +1,637 @@
|
||||
<?php
|
||||
/**
|
||||
* The Class Portfolio Entry
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'Sight_Entry' ) ) {
|
||||
/**
|
||||
* Create Class Portfolio Entry
|
||||
*/
|
||||
class Sight_Entry {
|
||||
/**
|
||||
* The attributes.
|
||||
*
|
||||
* @var string $attributes The attributes.
|
||||
*/
|
||||
public $attributes = null;
|
||||
|
||||
/**
|
||||
* The options.
|
||||
*
|
||||
* @var string $options The options.
|
||||
*/
|
||||
public $options = null;
|
||||
|
||||
/**
|
||||
* The source.
|
||||
*
|
||||
* @var string $source The source.
|
||||
*/
|
||||
public $source = null;
|
||||
|
||||
/**
|
||||
* The object_id.
|
||||
*
|
||||
* @var string $object_id The object_id.
|
||||
*/
|
||||
public $object_id = null;
|
||||
|
||||
/**
|
||||
* The obgect_link.
|
||||
*
|
||||
* @var string $obgect_link The obgect_link.
|
||||
*/
|
||||
public $obgect_link = null;
|
||||
|
||||
/**
|
||||
* The attachment_id.
|
||||
*
|
||||
* @var string $attachment_id The attachment_id.
|
||||
*/
|
||||
public $attachment_id = null;
|
||||
|
||||
/**
|
||||
* The attachment_lightbox.
|
||||
*
|
||||
* @var string $attachment_lightbox The attachment_lightbox.
|
||||
*/
|
||||
public $attachment_lightbox = null;
|
||||
|
||||
/**
|
||||
* The attachment_lightbox_icon.
|
||||
*
|
||||
* @var string $attachment_lightbox_icon The attachment_lightbox_icon.
|
||||
*/
|
||||
public $attachment_lightbox_icon = null;
|
||||
|
||||
/**
|
||||
* The attachment_link.
|
||||
*
|
||||
* @var string $attachment_link The attachment_link.
|
||||
*/
|
||||
public $attachment_link = null;
|
||||
|
||||
/**
|
||||
* The attachment_link_to.
|
||||
*
|
||||
* @var string $attachment_link_to The attachment_link_to.
|
||||
*/
|
||||
public $attachment_link_to = null;
|
||||
|
||||
/**
|
||||
* The attachment_full_link.
|
||||
*
|
||||
* @var string $attachment_full_link The attachment_full_link.
|
||||
*/
|
||||
public $attachment_full_link = null;
|
||||
|
||||
/**
|
||||
* The attachment_view_more.
|
||||
*
|
||||
* @var string $attachment_view_more The attachment_view_more.
|
||||
*/
|
||||
public $attachment_view_more = null;
|
||||
|
||||
/**
|
||||
* The attachment_view_more_label.
|
||||
*
|
||||
* @var string $attachment_view_more_label The attachment_view_more_label.
|
||||
*/
|
||||
public $attachment_view_more_label = null;
|
||||
|
||||
/**
|
||||
* The attachment_html.
|
||||
*
|
||||
* @var string $attachment_html The attachment_html.
|
||||
*/
|
||||
public $attachment_html = null;
|
||||
|
||||
/**
|
||||
* The attachment_title.
|
||||
*
|
||||
* @var string $attachment_title The attachment_title.
|
||||
*/
|
||||
public $attachment_title = null;
|
||||
|
||||
/**
|
||||
* The attachment_title_tag.
|
||||
*
|
||||
* @var string $attachment_title_tag The attachment_title_tag.
|
||||
*/
|
||||
public $attachment_title_tag = 'h3';
|
||||
|
||||
/**
|
||||
* The attachment_meta.
|
||||
*
|
||||
* @var string $attachment_meta The attachment_meta.
|
||||
*/
|
||||
public $attachment_meta = null;
|
||||
|
||||
/**
|
||||
* The attachment_caption.
|
||||
*
|
||||
* @var string $attachment_caption The attachment_caption.
|
||||
*/
|
||||
public $attachment_caption = null;
|
||||
|
||||
/**
|
||||
* The attachment_orientation.
|
||||
*
|
||||
* @var string $attachment_orientation The attachment_orientation.
|
||||
*/
|
||||
public $attachment_orientation = null;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* This function will initialize the initialize
|
||||
*
|
||||
* @param array $attributes The attributes of block.
|
||||
* @param array $options The options of block.
|
||||
*/
|
||||
public function __construct( $attributes, $options ) {
|
||||
$this->attributes = $attributes;
|
||||
$this->options = $options;
|
||||
|
||||
// Set source of entry.
|
||||
$this->source = $attributes['source'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Init Entry
|
||||
*/
|
||||
public function init() {
|
||||
$this->set_object_id();
|
||||
$this->set_object_link();
|
||||
$this->set_attachment_id();
|
||||
$this->set_attachment_lightbox();
|
||||
$this->set_attachment_lightbox_icon();
|
||||
$this->set_attachment_link();
|
||||
$this->set_attachment_link_to();
|
||||
$this->set_attachment_full_link();
|
||||
$this->set_attachment_view_more();
|
||||
$this->set_attachment_view_more_label();
|
||||
$this->set_attachment_html();
|
||||
$this->set_attachment_title();
|
||||
$this->set_attachment_title_tag();
|
||||
$this->set_attachment_meta();
|
||||
$this->set_attachment_caption();
|
||||
$this->set_attachment_orientation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object Id
|
||||
*/
|
||||
public function set_object_id() {
|
||||
if ( 'projects' === $this->source ) {
|
||||
$this->object_id = get_the_ID();
|
||||
}
|
||||
if ( 'categories' === $this->source ) {
|
||||
$this->object_id = intval( $this->object_id );
|
||||
}
|
||||
if ( 'post' === $this->source ) {
|
||||
$this->object_id = intval( $this->attachment_id );
|
||||
}
|
||||
if ( 'custom' === $this->source ) {
|
||||
$this->object_id = intval( $this->attachment_id );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object Link
|
||||
*/
|
||||
public function set_object_link() {
|
||||
if ( 'projects' === $this->source ) {
|
||||
$this->object_link = get_permalink( get_the_ID() );
|
||||
}
|
||||
if ( 'categories' === $this->source ) {
|
||||
$this->object_link = get_term_link( $this->object_id );
|
||||
|
||||
if ( empty( sight_is_archive() ) ) {
|
||||
$this->object_link = null;
|
||||
}
|
||||
}
|
||||
if ( 'post' === $this->source ) {
|
||||
$this->object_link = get_attachment_link( $this->attachment_id );
|
||||
}
|
||||
if ( 'custom' === $this->source ) {
|
||||
$this->object_link = get_attachment_link( $this->attachment_id );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Id
|
||||
*/
|
||||
public function set_attachment_id() {
|
||||
if ( 'projects' === $this->source ) {
|
||||
$this->attachment_id = get_post_thumbnail_id();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Lightbox
|
||||
*/
|
||||
public function set_attachment_lightbox() {
|
||||
if ( ! isset( $this->attributes['attachment_lightbox'] ) || ! $this->attributes['attachment_lightbox'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->attachment_lightbox = true;
|
||||
}
|
||||
/**
|
||||
* Set Attachment Lightbox Icon
|
||||
*/
|
||||
public function set_attachment_lightbox_icon() {
|
||||
if ( ! isset( $this->attributes['attachment_lightbox'] ) || ! $this->attributes['attachment_lightbox'] ) {
|
||||
return;
|
||||
}
|
||||
if ( ! isset( $this->attributes['attachment_lightbox_icon'] ) || ! $this->attributes['attachment_lightbox_icon'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->attachment_lightbox_icon = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Link
|
||||
*/
|
||||
public function set_attachment_link() {
|
||||
$this->attachment_link = wp_get_attachment_image_url( $this->attachment_id, $this->attributes['attachment_size'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Full Link
|
||||
*/
|
||||
public function set_attachment_full_link() {
|
||||
$this->attachment_full_link = wp_get_attachment_image_url( $this->attachment_id, 'full' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Html
|
||||
*/
|
||||
public function set_attachment_html() {
|
||||
$attrs = apply_filters( 'sight_portfolio_attachment_attrs', array(), $this->attributes );
|
||||
|
||||
$this->attachment_html = wp_get_attachment_image( $this->attachment_id, $this->attributes['attachment_size'], false, $attrs );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Link To
|
||||
*/
|
||||
public function set_attachment_link_to() {
|
||||
if ( isset( $this->attributes['attachment_link_to'] ) && $this->attributes['attachment_link_to'] ) {
|
||||
$this->attachment_link_to = $this->attributes['attachment_link_to'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment View More
|
||||
*/
|
||||
public function set_attachment_view_more() {
|
||||
if ( isset( $this->attributes['attachment_view_more'] ) && $this->attributes['attachment_view_more'] ) {
|
||||
$this->attachment_view_more = $this->attributes['attachment_view_more'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment View More Label
|
||||
*/
|
||||
public function set_attachment_view_more_label() {
|
||||
switch ( $this->attachment_link_to ) {
|
||||
case 'media':
|
||||
$this->attachment_view_more_label = apply_filters( 'sight_portfolio_view_more', esc_html__( 'View Media', 'sight' ), $this );
|
||||
break;
|
||||
case 'page':
|
||||
$this->attachment_view_more_label = apply_filters( 'sight_portfolio_view_more', esc_html__( 'View Project', 'sight' ), $this );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Title
|
||||
*/
|
||||
public function set_attachment_title() {
|
||||
if ( ! isset( $this->attributes['meta_title'] ) || ! $this->attributes['meta_title'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'projects' === $this->source ) {
|
||||
$this->attachment_title = get_the_title( $this->object_id );
|
||||
}
|
||||
if ( 'categories' === $this->source ) {
|
||||
$this->attachment_title = get_term( $this->object_id, 'sight-categories' )->name;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set Attachment Title Tag
|
||||
*/
|
||||
public function set_attachment_title_tag() {
|
||||
if ( ! isset( $this->attributes['meta_title'] ) || ! $this->attributes['meta_title'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $this->attributes['typography_heading_tag'] ) && $this->attributes['typography_heading_tag'] ) {
|
||||
$this->attachment_title_tag = $this->attributes['typography_heading_tag'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Meta
|
||||
*/
|
||||
public function set_attachment_meta() {
|
||||
ob_start();
|
||||
|
||||
// Meta Category.
|
||||
if ( isset( $this->attributes['meta_category'] ) && $this->attributes['meta_category'] ) {
|
||||
|
||||
if ( 'projects' === $this->source ) {
|
||||
|
||||
$terms_list = array();
|
||||
|
||||
$terms = get_the_terms( $this->object_id, 'sight-categories' );
|
||||
|
||||
foreach ( $terms as $term ) {
|
||||
if ( sight_is_archive() ) {
|
||||
$link = get_term_link( $term );
|
||||
|
||||
if ( ! is_wp_error( $link ) ) {
|
||||
$terms_list[] = '<a class="sight-portfolio-meta-item" href="' . esc_url( $link ) . '" rel="tag">' . $term->name . '</a>';
|
||||
}
|
||||
} else {
|
||||
$terms_list[] = '<span class="sight-portfolio-meta-item">' . $term->name . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $terms_list ) {
|
||||
?>
|
||||
<div class="sight-portfolio-meta-category">
|
||||
<?php call_user_func( 'printf', '%s', join( '', $terms_list ) ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Meta Date.
|
||||
if ( isset( $this->attributes['meta_date'] ) && $this->attributes['meta_date'] ) {
|
||||
?>
|
||||
<div class="sight-portfolio-meta-date">
|
||||
<?php call_user_func( 'printf', '%s', get_the_date( '', $this->object_id ) ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
$this->attachment_meta = ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Caption
|
||||
*/
|
||||
public function set_attachment_caption() {
|
||||
if ( ! isset( $this->attributes['meta_caption'] ) || ! $this->attributes['meta_caption'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'projects' === $this->source ) {
|
||||
$this->attachment_caption = sight_get_the_excerpt( $this->attributes['meta_caption_length'] );
|
||||
}
|
||||
if ( 'categories' === $this->source ) {
|
||||
$this->attachment_caption = sight_str_truncate( term_description( $this->object_id ), $this->attributes['meta_caption_length'] );
|
||||
}
|
||||
if ( 'custom' === $this->source ) {
|
||||
$this->attachment_caption = sight_str_truncate( wp_get_attachment_caption( $this->attachment_id ), $this->attributes['meta_caption_length'] );
|
||||
}
|
||||
if ( 'post' === $this->source ) {
|
||||
$this->attachment_caption = sight_str_truncate( wp_get_attachment_caption( $this->attachment_id ), $this->attributes['meta_caption_length'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Attachment Orientation
|
||||
*/
|
||||
public function set_attachment_orientation() {
|
||||
if ( isset( $this->attributes['attachment_orientation'] ) && $this->attributes['attachment_orientation'] ) {
|
||||
$this->attachment_orientation = sprintf( 'sight-portfolio-overlay-ratio sight-portfolio-ratio-%s', $this->attributes['attachment_orientation'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Has Item Content
|
||||
*/
|
||||
public function has_item_content() {
|
||||
$has_item_content = false;
|
||||
|
||||
if ( $this->attachment_title ) {
|
||||
$has_item_content = true;
|
||||
}
|
||||
if ( $this->attachment_meta ) {
|
||||
$has_item_content = true;
|
||||
}
|
||||
if ( $this->attachment_caption ) {
|
||||
$has_item_content = true;
|
||||
}
|
||||
|
||||
return apply_filters( 'sight_entry_has_item_content', $has_item_content, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile Item Class
|
||||
*
|
||||
* @param string $class The class of entry.
|
||||
*/
|
||||
public function item_class( $class = array() ) {
|
||||
$classes = array();
|
||||
|
||||
if ( $class ) {
|
||||
if ( ! is_array( $class ) ) {
|
||||
$class = preg_split( '#\s+#', $class );
|
||||
}
|
||||
$classes = array_map( 'esc_attr', $class );
|
||||
} else {
|
||||
// Ensure that we always coerce class to being an array.
|
||||
$class = array();
|
||||
}
|
||||
|
||||
// Set individual class.
|
||||
$classes[] = 'sight-portfolio-entry sight-portfolio-video-wrap';
|
||||
|
||||
// Set entry source.
|
||||
if ( $this->source ) {
|
||||
$classes[] = 'sight-portfolio-entry-' . $this->source;
|
||||
}
|
||||
|
||||
// Set entry object id.
|
||||
if ( $this->object_id ) {
|
||||
$classes[] = 'sight-portfolio-entry-' . $this->object_id;
|
||||
}
|
||||
|
||||
// Set entry link to.
|
||||
if ( $this->attachment_link_to ) {
|
||||
$classes[] = 'sight-portfolio-entry-link-' . $this->attachment_link_to;
|
||||
}
|
||||
|
||||
// Set entry request class.
|
||||
if ( 'standard' === $this->attributes['layout'] ) {
|
||||
|
||||
if ( isset( $_REQUEST['action'] ) && 'sight_portfolio_ajax_load_more' === $_REQUEST['action'] ) {
|
||||
$classes[] = 'sight-portfolio-entry-request';
|
||||
}
|
||||
}
|
||||
|
||||
// For projects.
|
||||
if ( 'projects' === $this->source ) {
|
||||
$post = get_post( get_the_ID() );
|
||||
|
||||
$classes[] = 'type-' . $post->post_type;
|
||||
$classes[] = 'status-' . $post->post_status;
|
||||
|
||||
// Post thumbnails.
|
||||
if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) ) {
|
||||
$classes[] = 'has-post-thumbnail';
|
||||
}
|
||||
}
|
||||
|
||||
call_user_func( 'printf', 'class="%s"', join( ' ', $classes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile Item Outer Class
|
||||
*
|
||||
* @param string $class The class of entry.
|
||||
*/
|
||||
public function item_outer_class( $class = array() ) {
|
||||
$classes = array();
|
||||
|
||||
if ( $class ) {
|
||||
if ( ! is_array( $class ) ) {
|
||||
$class = preg_split( '#\s+#', $class );
|
||||
}
|
||||
$classes = array_map( 'esc_attr', $class );
|
||||
} else {
|
||||
// Ensure that we always coerce class to being an array.
|
||||
$class = array();
|
||||
}
|
||||
|
||||
// Set individual class.
|
||||
$classes[] = 'sight-portfolio-entry-outer';
|
||||
|
||||
call_user_func( 'printf', 'class="%s"', join( ' ', $classes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile Item Attachment
|
||||
*/
|
||||
public function item_attachment() {
|
||||
if ( ! $this->attachment_html ) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( $this->attachment_link_to ) {
|
||||
case 'media':
|
||||
$attachment_link = $this->attachment_full_link;
|
||||
break;
|
||||
case 'page':
|
||||
$attachment_link = $this->object_link;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $this->attachment_lightbox ) {
|
||||
$attachment_link = $this->attachment_full_link;
|
||||
}
|
||||
?>
|
||||
<div class="sight-portfolio-entry__inner sight-portfolio-entry__thumbnail sight-portfolio-entry__overlay <?php echo esc_attr( $this->attachment_orientation ); ?>">
|
||||
<figure class="sight-portfolio-overlay-background">
|
||||
<?php do_action( 'sight_entry_item_attachment_before', $this ); ?>
|
||||
|
||||
<?php call_user_func( 'printf', '%s', $this->attachment_html ); ?>
|
||||
|
||||
<?php do_action( 'sight_entry_item_attachment_after', $this ); ?>
|
||||
|
||||
<?php
|
||||
if ( $this->attachment_view_more ) {
|
||||
?>
|
||||
<span class="sight-portfolio-view-more">
|
||||
<span class="sight-portfolio-view-more-label">
|
||||
<?php echo esc_html( $this->attachment_view_more_label ); ?>
|
||||
</span>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ( isset( $this->attributes['video'] ) && $this->attributes['video'] && 'none' !== $this->attributes['video'] ) {
|
||||
sight_get_video_background( $this->attributes['video'], null, null, 'default', (bool) $this->attributes['video_controls'] );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ( isset( $attachment_link ) ) {
|
||||
?>
|
||||
<a class="sight-portfolio-overlay-link" href="<?php echo esc_url( $attachment_link ); ?>"></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ( $this->attachment_lightbox_icon ) {
|
||||
?>
|
||||
<span class="sight-zoom-icon-popup"></span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</figure>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile Item Content
|
||||
*/
|
||||
public function item_content() {
|
||||
if ( $this->has_item_content() ) {
|
||||
?>
|
||||
<div class="sight-portfolio-entry__inner sight-portfolio-entry__content">
|
||||
<?php do_action( 'sight_entry_item_content_before', $this ); ?>
|
||||
|
||||
<?php if ( $this->attachment_title ) { ?>
|
||||
<div class="sight-portfolio-entry__title">
|
||||
<?php if ( $this->object_link ) { ?>
|
||||
<<?php echo esc_html( $this->attachment_title_tag ); ?> class="sight-portfolio-entry__heading">
|
||||
<a href="<?php echo esc_url( $this->object_link ); ?>">
|
||||
<?php echo wp_kses( $this->attachment_title, 'post' ); ?>
|
||||
</a>
|
||||
</<?php echo esc_html( $this->attachment_title_tag ); ?>>
|
||||
<?php } else { ?>
|
||||
<<?php echo esc_html( $this->attachment_title_tag ); ?> class="sight-portfolio-entry__heading">
|
||||
<?php echo wp_kses( $this->attachment_title, 'post' ); ?>
|
||||
</<?php echo esc_html( $this->attachment_title_tag ); ?>>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( $this->attachment_meta ) { ?>
|
||||
<div class="sight-portfolio-entry__meta">
|
||||
<?php echo wp_kses( $this->attachment_meta, 'post' ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( $this->attachment_caption ) { ?>
|
||||
<div class="sight-portfolio-entry__caption">
|
||||
<?php echo wp_kses( $this->attachment_caption, 'post' ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php do_action( 'sight_entry_item_content_after', $this ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio Load More Posts via AJAX.
|
||||
*
|
||||
* @package sight
|
||||
*/
|
||||
|
||||
/**
|
||||
* Processing data query for load more
|
||||
*
|
||||
* @param string $method Processing method $wp_query.
|
||||
* @param array $data Data array.
|
||||
*/
|
||||
function sight_portfolio_load_more_query_data( $method = 'get', $data = array() ) {
|
||||
global $wp_query;
|
||||
|
||||
$output = array();
|
||||
|
||||
$vars = array(
|
||||
'in_the_loop',
|
||||
'is_single',
|
||||
'is_page',
|
||||
'is_archive',
|
||||
'is_author',
|
||||
'is_category',
|
||||
'is_tag',
|
||||
'is_tax',
|
||||
'is_home',
|
||||
'is_singular',
|
||||
'is_post_query',
|
||||
);
|
||||
|
||||
if ( 'get' === $method ) {
|
||||
$output = $data;
|
||||
}
|
||||
|
||||
foreach ( $vars as $variable ) {
|
||||
if ( ! isset( $wp_query->$variable ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( 'get' === $method ) {
|
||||
$output[ $variable ] = $wp_query->$variable;
|
||||
}
|
||||
if ( ! isset( $data[ $variable ] ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( 'init' === $method ) {
|
||||
$wp_query->$variable = $data[ $variable ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'get' === $method ) {
|
||||
$output = apply_filters( 'ajax_query_args', $output );
|
||||
}
|
||||
|
||||
return wp_json_encode( $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get load more args.
|
||||
*
|
||||
* @param array $data The data.
|
||||
* @param array $attributes The attributes.
|
||||
* @param array $options The options.
|
||||
*/
|
||||
function sight_portfolio_get_load_more_args( $data, $attributes = false, $options = false ) {
|
||||
// Ajax Type.
|
||||
$ajax_type = version_compare( get_bloginfo( 'version' ), '4.7', '>=' ) ? 'ajax_restapi' : 'ajax';
|
||||
|
||||
$ajax_type = apply_filters( 'ajax_load_more_method', $ajax_type );
|
||||
|
||||
$args = array(
|
||||
'type' => $ajax_type,
|
||||
'nonce' => wp_create_nonce(),
|
||||
'url' => admin_url( 'admin-ajax.php' ),
|
||||
'rest_url' => esc_url( get_rest_url( null, '/sight/v1/portfolio-more-posts' ) ),
|
||||
'posts_per_page' => get_query_var( 'posts_per_page' ),
|
||||
'query_data' => sight_portfolio_load_more_query_data( 'get', $data ),
|
||||
'attributes' => wp_json_encode( $attributes ),
|
||||
'options' => wp_json_encode( $options ),
|
||||
'max_num_pages' => $data['max_num_pages'],
|
||||
'pagination_type' => $data['pagination_type'],
|
||||
'translation' => array(
|
||||
'load_more' => esc_html__( 'Load more', 'sight' ),
|
||||
'loading' => esc_html__( 'Loading', 'sight' ),
|
||||
),
|
||||
);
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after the query variable object is created, but before the actual query is run.
|
||||
*
|
||||
* @param object $wp_query WP Query.
|
||||
*/
|
||||
function sight_portfolio_pre_get_posts( &$wp_query ) {
|
||||
|
||||
if ( isset( $wp_query->query['is_sight_query'] ) ) {
|
||||
$offset = (int) $wp_query->get( 'offset' );
|
||||
$paged = (int) $wp_query->get( 'paged' );
|
||||
$posts_per_page = (int) $wp_query->get( 'posts_per_page' );
|
||||
|
||||
if ( $wp_query->is_paged ) {
|
||||
$page_offset = $offset + ( ( $paged - 1 ) * $posts_per_page );
|
||||
|
||||
$wp_query->set( 'offset', $page_offset );
|
||||
} else {
|
||||
$wp_query->set( 'offset', $offset );
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'pre_get_posts', 'sight_portfolio_pre_get_posts', 1 );
|
||||
|
||||
/**
|
||||
* Filters the number of found posts for the query.
|
||||
*
|
||||
* @param int $found_posts The number of posts found.
|
||||
* @param object $wp_query WP Query.
|
||||
*/
|
||||
function sight_portfolio_found_posts( $found_posts, $wp_query ) {
|
||||
|
||||
if ( isset( $wp_query->query['is_sight_query'] ) ) {
|
||||
|
||||
$offset = isset( $wp_query->query['offset'] ) ? $wp_query->query['offset'] : 0;
|
||||
|
||||
$found_posts = (int) $found_posts - (int) $offset;
|
||||
}
|
||||
|
||||
return $found_posts;
|
||||
}
|
||||
add_filter( 'found_posts', 'sight_portfolio_found_posts', 1, 2 );
|
||||
|
||||
/**
|
||||
* Get More Posts
|
||||
*/
|
||||
function sight_portfolio_load_more_posts() {
|
||||
|
||||
$posts_end = false;
|
||||
|
||||
// Response default.
|
||||
$response = array(
|
||||
'page' => 2,
|
||||
'posts_per_page' => 10,
|
||||
'query_data' => array(),
|
||||
);
|
||||
|
||||
if ( wp_doing_ajax() ) {
|
||||
check_ajax_referer();
|
||||
}
|
||||
|
||||
// Set response values of ajax query.
|
||||
if ( isset( $_POST['page'] ) && $_POST['page'] ) { // Input var ok.
|
||||
$response['page'] = sanitize_key( $_POST['page'] ); // Input var ok; sanitization ok.
|
||||
}
|
||||
if ( isset( $_POST['posts_per_page'] ) && $_POST['posts_per_page'] ) { // Input var ok.
|
||||
$response['posts_per_page'] = sanitize_key( $_POST['posts_per_page'] ); // Input var ok; sanitization ok.
|
||||
}
|
||||
if ( isset( $_POST['query_data'] ) && $_POST['query_data'] ) { // Input var ok.
|
||||
$response['query_data'] = map_deep( json_decode( stripslashes( $_POST['query_data'] ), true ), 'sanitize_text_field' ); // Input var ok; sanitization ok.
|
||||
}
|
||||
if ( isset( $_POST['attributes'] ) && $_POST['attributes'] ) { // Input var ok.
|
||||
$response['attributes'] = map_deep( json_decode( stripslashes( $_POST['attributes'] ), true ), 'sanitize_text_field' ); // Input var ok; sanitization ok.
|
||||
}
|
||||
if ( isset( $_POST['options'] ) && $_POST['options'] ) { // Input var ok.
|
||||
$response['options'] = map_deep( json_decode( stripslashes( $_POST['options'] ), true ), 'sanitize_text_field' ); // Input var ok; sanitization ok.
|
||||
}
|
||||
|
||||
// Set Query Vars.
|
||||
$query_vars = array_merge(
|
||||
(array) $response['query_data']['query_vars'],
|
||||
array(
|
||||
'is_sight_query' => true,
|
||||
'paged' => (int) $response['page'],
|
||||
'posts_per_page' => (int) $response['posts_per_page'],
|
||||
)
|
||||
);
|
||||
|
||||
// Supportfolio filtering for wp authors.
|
||||
if ( $response['query_data']['is_author'] && $query_vars['author'] ) {
|
||||
$query_vars['supportfolio_filters'] = true;
|
||||
}
|
||||
|
||||
$attributes = $response['attributes'];
|
||||
$options = $response['options'];
|
||||
|
||||
// Get Posts.
|
||||
ob_start();
|
||||
|
||||
if ( isset( $_POST['terms'] ) && $_POST['terms'] ) { // Input var ok.
|
||||
$terms = array_map( 'sanitize_text_field', $_POST['terms'] ); // Input var ok; sanitization ok.
|
||||
|
||||
if ( $terms ) {
|
||||
$query_vars['tax_query'] = array();
|
||||
|
||||
$query_vars['tax_query'][] = array(
|
||||
'taxonomy' => 'sight-categories',
|
||||
'field' => 'slug',
|
||||
'terms' => $terms,
|
||||
);
|
||||
|
||||
$query_vars['tax_query']['relation'] = 'AND';
|
||||
}
|
||||
}
|
||||
|
||||
$the_query = new WP_Query( $query_vars );
|
||||
|
||||
$global_name = 'wp_query';
|
||||
|
||||
$GLOBALS[ $global_name ] = $the_query;
|
||||
|
||||
sight_portfolio_load_more_query_data( 'init', $response['query_data'] );
|
||||
|
||||
if ( $the_query->have_posts() ) :
|
||||
|
||||
// Set query vars, so that we can get them across all templates.
|
||||
set_query_var( 'sight_query', $response['query_data'] );
|
||||
|
||||
// Get total number of posts.
|
||||
$total = $the_query->post_count;
|
||||
|
||||
while ( $the_query->have_posts() ) :
|
||||
$the_query->the_post();
|
||||
|
||||
// Start counting posts.
|
||||
$current = $the_query->current_post + 1 + $query_vars['posts_per_page'] * $query_vars['paged'] - $query_vars['posts_per_page'];
|
||||
|
||||
// Check End of posts.
|
||||
if ( $the_query->found_posts - $current <= 0 ) {
|
||||
$posts_end = true;
|
||||
}
|
||||
|
||||
$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 );
|
||||
|
||||
endwhile;
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$content = ob_get_clean();
|
||||
|
||||
if ( ! $content ) {
|
||||
$posts_end = true;
|
||||
}
|
||||
|
||||
// Return Result.
|
||||
$result = array(
|
||||
'posts_end' => $posts_end,
|
||||
'content' => $content,
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX Load More
|
||||
*/
|
||||
function sight_portfolio_ajax_load_more() {
|
||||
|
||||
// Check Nonce.
|
||||
check_ajax_referer();
|
||||
|
||||
// Get Posts.
|
||||
$data = sight_portfolio_load_more_posts();
|
||||
|
||||
// Return Result.
|
||||
wp_send_json_success( $data );
|
||||
|
||||
}
|
||||
add_action( 'wp_ajax_sight_portfolio_ajax_load_more', 'sight_portfolio_ajax_load_more' );
|
||||
add_action( 'wp_ajax_nopriv_sight_portfolio_ajax_load_more', 'sight_portfolio_ajax_load_more' );
|
||||
|
||||
|
||||
/**
|
||||
* More Posts API Response
|
||||
*
|
||||
* @param array $request REST API Request.
|
||||
*/
|
||||
function sight_portfolio_more_posts_restapi( $request ) {
|
||||
|
||||
// Get Data.
|
||||
$data = array(
|
||||
'success' => true,
|
||||
'data' => sight_portfolio_load_more_posts(),
|
||||
);
|
||||
|
||||
// Return Result.
|
||||
return rest_ensure_response( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register REST More Posts Routes
|
||||
*/
|
||||
function sight_portfolio_register_more_posts_route() {
|
||||
|
||||
register_rest_route(
|
||||
'sight/v1',
|
||||
'/portfolio-more-posts',
|
||||
array(
|
||||
'methods' => WP_REST_Server::CREATABLE,
|
||||
'callback' => 'sight_portfolio_more_posts_restapi',
|
||||
'permission_callback' => function() {
|
||||
return true;
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'rest_api_init', 'sight_portfolio_register_more_posts_route' );
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* Render Front End.
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
/**
|
||||
* The initialize block.
|
||||
*/
|
||||
class Sight_Frontend_Render {
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
add_filter( 'powerkit_pinit_exclude_selectors', array( $this, 'sight_pinit_exclude_selector' ) );
|
||||
add_filter( 'powerkit_lightbox_exclude_selectors', array( $this, 'sight_lightbox_exclude_selector' ) );
|
||||
add_filter( 'pk_toc_exclude', array( $this, 'sight_toc_exclude_selectors' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue the block's assets for the editor.
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
|
||||
// Scripts.
|
||||
wp_register_script(
|
||||
'magnific-popup',
|
||||
SIGHT_URL . 'render/js/jquery.magnific-popup.min.js',
|
||||
array( 'jquery', 'imagesloaded' ),
|
||||
filemtime( SIGHT_PATH . 'render/js/jquery.magnific-popup.min.js' ),
|
||||
true
|
||||
);
|
||||
|
||||
wp_register_script(
|
||||
'sight-block-script',
|
||||
SIGHT_URL . 'render/js/sight.js',
|
||||
array( 'jquery', 'imagesloaded', 'magnific-popup' ),
|
||||
filemtime( SIGHT_PATH . 'render/js/sight.js' ),
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_script( 'sight-block-script' );
|
||||
|
||||
wp_localize_script( 'sight-block-script', 'sight_lightbox_localize', array(
|
||||
'text_previous' => esc_html__( 'Previous', 'sight' ),
|
||||
'text_next' => esc_html__( 'Next', 'sight' ),
|
||||
'text_close' => esc_html__( 'Close', 'sight' ),
|
||||
'text_loading' => esc_html__( 'Loading', 'sight' ),
|
||||
'text_counter' => esc_html__( 'of', 'sight' ),
|
||||
) );
|
||||
|
||||
// Styles.
|
||||
wp_enqueue_style(
|
||||
'magnific-popup',
|
||||
SIGHT_URL . 'render/css/magnific-popup.css',
|
||||
array(),
|
||||
filemtime( SIGHT_PATH . 'render/css/magnific-popup.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'sight',
|
||||
SIGHT_URL . 'render/css/sight.css',
|
||||
array(),
|
||||
filemtime( SIGHT_PATH . 'render/css/sight.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'sight-common',
|
||||
SIGHT_URL . 'render/css/sight-common.css',
|
||||
array(),
|
||||
filemtime( SIGHT_PATH . 'render/css/sight-common.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'sight-lightbox',
|
||||
SIGHT_URL . 'render/css/sight-lightbox.css',
|
||||
array(),
|
||||
filemtime( SIGHT_PATH . 'render/css/sight-lightbox.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'sight-layout-standard',
|
||||
SIGHT_URL . 'render/css/sight-layout-standard.css',
|
||||
array(),
|
||||
filemtime( SIGHT_PATH . 'render/css/sight-layout-standard.css' )
|
||||
);
|
||||
|
||||
wp_style_add_data( 'sight', 'rtl', 'replace' );
|
||||
wp_style_add_data( 'sight-common', 'rtl', 'replace' );
|
||||
wp_style_add_data( 'sight-layout-standard', 'rtl', 'replace' );
|
||||
}
|
||||
|
||||
/**
|
||||
* PinIt exclude selectors
|
||||
*
|
||||
* @param string $selectors List selectors.
|
||||
*/
|
||||
public function sight_pinit_exclude_selector( $selectors ) {
|
||||
$selectors[] = '.sight-portfolio-entry-link-page';
|
||||
|
||||
return $selectors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Powerkit Lightbox exclude selector
|
||||
*
|
||||
* @param string $selectors List selectors.
|
||||
*/
|
||||
public function sight_lightbox_exclude_selector( $selectors ) {
|
||||
$selectors[] = '.sight-portfolio-area';
|
||||
|
||||
return $selectors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add exclude selectors of TOC
|
||||
*
|
||||
* @param string $list List selectors.
|
||||
*/
|
||||
public function sight_toc_exclude_selectors( $list ) {
|
||||
$list .= '|.sight-portfolio-entry__heading';
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new Sight_Frontend_Render();
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Sight – Professional Image Gallery and Portfolio
|
||||
* Description: Beautiful responsive galleries and portfolio of your work.
|
||||
* Version: 1.0.8
|
||||
* Author: Code Supply Co.
|
||||
* Author URI: https://codesupply.co
|
||||
* License: GPL-2.0+
|
||||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
* Text Domain: sight
|
||||
* Domain Path: /languages
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
// If this file is called directly, abort.
|
||||
if ( ! defined( 'WPINC' ) ) {
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*/
|
||||
define( 'SIGHT_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'SIGHT_PATH', plugin_dir_path( __FILE__ ) );
|
||||
|
||||
/**
|
||||
* The code that runs during plugin activation.
|
||||
* This action is documented in includes/class-sight-activator.php
|
||||
*/
|
||||
function sight_activate() {
|
||||
do_action( 'sight_plugin_activation' );
|
||||
}
|
||||
register_activation_hook( __FILE__, 'sight_activate' );
|
||||
|
||||
/**
|
||||
* The code that runs during plugin deactivation.
|
||||
* This action is documented in includes/class-sight-deactivator.php
|
||||
*/
|
||||
function sight_deactivate() {
|
||||
do_action( 'sight_plugin_deactivation' );
|
||||
}
|
||||
register_deactivation_hook( __FILE__, 'sight_deactivate' );
|
||||
|
||||
/**
|
||||
* Language
|
||||
*/
|
||||
load_plugin_textdomain( 'sight', false, plugin_basename( SIGHT_PATH ) . '/languages' );
|
||||
|
||||
/**
|
||||
* The core plugin class that is used to define internationalization,
|
||||
* admin-specific hooks, and public-facing site hooks.
|
||||
*/
|
||||
require plugin_dir_path( __FILE__ ) . 'core/class-sight.php';
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Fired when the plugin is uninstalled.
|
||||
*
|
||||
* When populating this file, consider the following flow
|
||||
* of control:
|
||||
*
|
||||
* - This method should be static
|
||||
* - Check if the $_REQUEST content actually is the plugin name
|
||||
* - Run an admin referrer check to make sure it goes through authentication
|
||||
* - Verify the output of $_GET makes sense
|
||||
* - Repeat with other user roles. Best directly by using the links/query string parameters.
|
||||
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
|
||||
*
|
||||
* This file may be updated more in future version of the Boilerplate; however, this is the
|
||||
* general skeleton and outline for how the file should work.
|
||||
*
|
||||
* For more information, see the following discussion:
|
||||
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
|
||||
*
|
||||
* @link https://codesupply.co
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package Sight
|
||||
*/
|
||||
|
||||
// If uninstall not called from WordPress, then exit.
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
exit;
|
||||
}
|
||||
Reference in New Issue
Block a user