Import legacy nurinda.co.id website
This commit is contained in:
1 parent
3f59bb9038
commit
6e21646ac4
13389 files changed
+3246690
No files matched your search
@@ -0,0 +1,78 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* The template for displaying the 404 page
|
||||
*/
|
||||
|
||||
$page_404 = get_post( us_get_option( 'page_404' ) );
|
||||
|
||||
// Output specific page
|
||||
if ( $page_404 ) {
|
||||
if ( class_exists( 'SitePress' ) ) {
|
||||
$page_404 = get_post( apply_filters( 'wpml_object_id', $page_404->ID, 'page', TRUE ) );
|
||||
}
|
||||
|
||||
get_header();
|
||||
?>
|
||||
<main class="l-main"<?php echo ( us_get_option( 'schema_markup' ) ) ? ' itemprop="mainContentOfPage"' : ''; ?>>
|
||||
|
||||
<?php
|
||||
do_action( 'us_before_page' );
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
|
||||
// Titlebar, if it is enabled in Theme Options
|
||||
us_load_template( 'templates/titlebar' );
|
||||
|
||||
// START wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'before' ) );
|
||||
}
|
||||
|
||||
us_open_wp_query_context();
|
||||
|
||||
us_add_page_shortcodes_custom_css( $page_404->ID );
|
||||
|
||||
echo apply_filters( 'the_content', $page_404->post_content );
|
||||
|
||||
us_close_wp_query_context();
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
// AFTER wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'after' ) );
|
||||
}
|
||||
|
||||
do_action( 'us_after_page' );
|
||||
?>
|
||||
|
||||
</main>
|
||||
<?php
|
||||
get_footer();
|
||||
|
||||
// Output predefined layout
|
||||
} else {
|
||||
$us_layout = US_Layout::instance();
|
||||
|
||||
get_header();
|
||||
?>
|
||||
<main class="l-main">
|
||||
<section class="l-section">
|
||||
<div class="l-section-h i-cf">
|
||||
|
||||
<?php do_action( 'us_before_404' ) ?>
|
||||
|
||||
<div class="page-404">
|
||||
<?php
|
||||
$the_content = '<h1>' . us_translate( 'Page not found' ) . '</h1>';
|
||||
$the_content .= '<p>' . __( 'The link you followed may be broken, or the page may have been removed.', 'us' ) . '</p>';
|
||||
echo apply_filters( 'us_404_content', $the_content );
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php do_action( 'us_after_404' ) ?>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<?php
|
||||
get_footer();
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* The template for displaying Archive Pages
|
||||
*/
|
||||
|
||||
$us_layout = US_Layout::instance();
|
||||
|
||||
get_header();
|
||||
|
||||
?>
|
||||
<main class="l-main"<?php echo ( us_get_option( 'schema_markup' ) ) ? ' itemprop="mainContentOfPage"' : ''; ?>>
|
||||
<?php
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
|
||||
// Titlebar, if it is enabled in Theme Options
|
||||
us_load_template( 'templates/titlebar' );
|
||||
|
||||
// START wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'before' ) );
|
||||
}
|
||||
|
||||
$content_area_id = us_get_page_area_id( 'content' );
|
||||
if ( $content_area_id != '' AND get_post_status( $content_area_id ) != FALSE ) {
|
||||
us_load_template( 'templates/content' );
|
||||
} else {
|
||||
?>
|
||||
<section class="l-section<?php echo ( us_get_option( 'row_height' ) == 'small' ) ? ' height_small' : ''; ?>">
|
||||
<div class="l-section-h i-cf">
|
||||
|
||||
<?php
|
||||
do_action( 'us_before_archive' );
|
||||
global $us_grid_loop_running;
|
||||
$us_grid_loop_running = TRUE;
|
||||
|
||||
// Use Grid element with default values and "Regular" pagination
|
||||
us_load_template( 'templates/us_grid/listing', array( 'pagination' => 'regular' ) );
|
||||
|
||||
$us_grid_loop_running = FALSE;
|
||||
do_action( 'us_after_archive' );
|
||||
?>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
}
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
// AFTER wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'after' ) );
|
||||
}
|
||||
?>
|
||||
</main>
|
||||
|
||||
<?php get_footer() ?>
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* List of Post Comments with response form
|
||||
*/
|
||||
|
||||
if ( post_password_required() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( us_get_option( 'optimize_assets' ) AND ! in_array( 'font-awesome', us_get_option( 'assets' ) ) ) {
|
||||
$with_icons = FALSE;
|
||||
} else {
|
||||
$with_icons = TRUE;
|
||||
}
|
||||
|
||||
$comments_number = get_comments_number();
|
||||
?>
|
||||
<div id="comments" class="w-comments">
|
||||
<?php if ( have_comments() ) { ?>
|
||||
<h4 class="w-comments-title">
|
||||
<?php
|
||||
$comments_label = '<span>';
|
||||
$comments_label .= sprintf( us_translate_n( '%s <span class="screen-reader-text">Comment</span>', '%s <span class="screen-reader-text">Comments</span>', $comments_number ), $comments_number );
|
||||
$comments_label .= '.</span> ';
|
||||
$comments_label .= '<a href="#respond">' . __( 'Leave new', 'us' ) . '</a>';
|
||||
comments_number( us_translate( 'No Comments' ), $comments_label, $comments_label );
|
||||
?>
|
||||
</h4>
|
||||
|
||||
<div class="w-comments-list">
|
||||
<?php wp_list_comments(
|
||||
array(
|
||||
'callback' => 'us_comment_start',
|
||||
'end-callback' => 'us_comment_end',
|
||||
)
|
||||
); ?>
|
||||
</div>
|
||||
|
||||
<div class="w-comments-pagination">
|
||||
<?php previous_comments_link() ?>
|
||||
<?php next_comments_link() ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if ( comments_open() ) : ?>
|
||||
<?php if ( get_option( 'comment_registration' ) AND ! is_user_logged_in() ) { ?>
|
||||
<div class="w-comments-form-text"><?php printf( us_translate( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( get_permalink() ) ); ?></div>
|
||||
<?php } else {
|
||||
$commenter = wp_get_current_commenter();
|
||||
|
||||
$fields = array(
|
||||
'comment' => array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'comment',
|
||||
'placeholder' => us_translate_x( 'Comment', 'noun' ),
|
||||
'required' => TRUE,
|
||||
'icon' => $with_icons ? 'far|edit' : '',
|
||||
),
|
||||
'author' => array(
|
||||
'type' => 'text',
|
||||
'name' => 'author',
|
||||
'placeholder' => us_translate( 'Name' ),
|
||||
'required' => get_option( 'require_name_email' ),
|
||||
'value' => $commenter['comment_author'],
|
||||
'icon' => $with_icons ? 'far|user' : '',
|
||||
),
|
||||
'email' => array(
|
||||
'type' => 'email',
|
||||
'name' => 'email',
|
||||
'placeholder' => us_translate( 'Email' ),
|
||||
'required' => get_option( 'require_name_email' ),
|
||||
'value' => $commenter['comment_author_email'],
|
||||
'icon' => $with_icons ? 'far|envelope' : '',
|
||||
),
|
||||
);
|
||||
|
||||
// Add Cookie Consent field if it's enabled at Settings > Discussion
|
||||
if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) {
|
||||
$fields['cookies'] = array(
|
||||
'type' => 'agreement',
|
||||
'value' => us_translate( 'Save my name and email in this browser for the next time I comment.' ),
|
||||
'name' => 'wp-comment-cookies-consent',
|
||||
'checked' => FALSE,
|
||||
);
|
||||
}
|
||||
|
||||
$fields = apply_filters( 'us_comment_form_fields', $fields );
|
||||
|
||||
$json_data = array(
|
||||
'no_content_msg' => __( 'Fill out this field', 'us' ),
|
||||
'no_name_msg' => __( 'Fill out this field', 'us' ),
|
||||
'no_email_msg' => us_translate( 'Please enter a valid email address.' ),
|
||||
);
|
||||
|
||||
$comment_form_args = array( 'fields' => array() );
|
||||
foreach ( $fields as $field_name => $field ) {
|
||||
if ( $field_name == 'comment' ) {
|
||||
$comment_form_args['comment_field'] = us_get_template( 'templates/form/' . $field['type'], $field );
|
||||
} else {
|
||||
$comment_form_args['fields'][ $field_name ] = us_get_template( 'templates/form/' . $field['type'], $field );
|
||||
}
|
||||
}
|
||||
|
||||
$comment_form_args['fields'] = apply_filters( 'comment_form_default_fields', $comment_form_args['fields'] );
|
||||
$comment_form_args['submit_button'] = '<button type="submit" class="w-btn us-btn-style_1"><span class="w-btn-label">' . us_translate( 'Post Comment' ) . '</span></button>';
|
||||
|
||||
comment_form( $comment_form_args );
|
||||
|
||||
// Echoing json to comments.js to pass admin-ajax.php URL and messages
|
||||
echo '<div class="us-comments-json hidden"' . us_pass_data_to_js( $json_data ) . '></div>';
|
||||
} ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Outputs page's content Page Block (us_page_block)
|
||||
*
|
||||
* (!) Should be called after the current $wp_query is already defined
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/content'
|
||||
* @action After the template: 'us_after_template:templates/content'
|
||||
* @filter Template variables: 'us_template_vars:templates/content'
|
||||
*/
|
||||
|
||||
$page_block_content = '';
|
||||
$page_block_id = us_get_page_area_id( 'content' );
|
||||
|
||||
if ( $page_block_id != '' ) {
|
||||
$page_block = get_post( (int) $page_block_id );
|
||||
|
||||
us_open_wp_query_context();
|
||||
if ( $page_block ) {
|
||||
|
||||
// Some WPML tweaks
|
||||
$translated_page_block_id = apply_filters( 'wpml_object_id', $page_block->ID, 'us_page_block', TRUE );
|
||||
if ( $translated_page_block_id != $page_block->ID ) {
|
||||
$page_block = get_post( $translated_page_block_id );
|
||||
}
|
||||
us_add_to_page_block_ids( $translated_page_block_id );
|
||||
us_add_page_shortcodes_custom_css( $translated_page_block_id );
|
||||
|
||||
$page_block_content = $page_block->post_content;
|
||||
}
|
||||
us_close_wp_query_context();
|
||||
|
||||
// Apply filters to Page Block content and echoing it ouside of us_open_wp_query_context,
|
||||
// so all WP widgets (like WP Nav Menu) would work as they should
|
||||
$page_block_content = apply_filters( 'us_page_block_the_content', $page_block_content );
|
||||
|
||||
// If content has no sections, we'll create them manually
|
||||
if ( strpos( $page_block_content, ' class="l-section' ) === FALSE ) {
|
||||
$page_block_content = '<section class="l-section"><div class="l-section-h">' . $page_block_content . '</div></section>';
|
||||
}
|
||||
|
||||
echo $page_block_content;
|
||||
|
||||
if ( $page_block ) {
|
||||
us_remove_from_page_block_ids();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output elements builder
|
||||
*
|
||||
* @var $titles array Elements titles
|
||||
* @var $body string Body inner HTML
|
||||
*/
|
||||
$titles = ( isset( $titles ) AND is_array( $titles ) ) ? $titles : array();
|
||||
$body = isset( $body ) ? $body : '';
|
||||
|
||||
?>
|
||||
<div class="us-bld-window for_editing">
|
||||
<div class="us-bld-window-h">
|
||||
<div class="us-bld-window-header">
|
||||
<div class="us-bld-window-title"<?php echo us_pass_data_to_js($titles) ?>></div>
|
||||
<div class="us-bld-window-closer" title="<?php echo us_translate( 'Close' ) ?>"></div>
|
||||
</div>
|
||||
<div class="us-bld-window-body usof-container"><?php echo $body ?><span class="usof-preloader"></span></div>
|
||||
<div class="us-bld-window-footer">
|
||||
<div class="us-bld-window-btn for_close"><span><?php echo us_translate( 'Close' ) ?></span></div>
|
||||
<div class="us-bld-window-btn for_save"><span><?php echo us_translate( 'Save Changes' ) ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a single element's editing form
|
||||
*
|
||||
* @var $type string Element type
|
||||
* @var $params array List of config-based params
|
||||
* @var $values array List of param_name => value
|
||||
* @var $context string Context param states which builder is it
|
||||
*/
|
||||
|
||||
// Validating and sanitizing input
|
||||
$values = ( isset( $values ) AND is_array( $values ) ) ? $values : array();
|
||||
$context = isset( $context ) ? $context : 'header';
|
||||
|
||||
// Validating, sanitizing and grouping params
|
||||
$groups = array();
|
||||
foreach ( $params as $param_name => &$param ) {
|
||||
if ( isset( $param['context'] ) AND ! in_array( $context, $param['context'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$param['type'] = isset( $param['type'] ) ? $param['type'] : 'textfield';
|
||||
if ( $param['type'] == 'image' ) {
|
||||
$param['type'] = 'images';
|
||||
$param['multiple'] = FALSE;
|
||||
}
|
||||
if ( $param['type'] == 'html' AND $param_name != 'content' ) {
|
||||
// For VC-compatibility we may have only one wysiwyg field and it should be called content
|
||||
$param['type'] = 'textarea';
|
||||
}
|
||||
$param['classes'] = isset( $param['classes'] ) ? $param['classes'] : '';
|
||||
$param['std'] = isset( $param['std'] ) ? $param['std'] : '';
|
||||
// Filling missing values with standard ones
|
||||
if ( ! isset( $values[ $param_name ] ) ) {
|
||||
$values[ $param_name ] = $param['std'];
|
||||
}
|
||||
$group = isset( $param['group'] ) ? $param['group'] : us_translate( 'General' );
|
||||
if ( ! isset( $groups[ $group ] ) ) {
|
||||
$groups[ $group ] = array();
|
||||
}
|
||||
$groups[ $group ][ $param_name ] = &$param;
|
||||
}
|
||||
|
||||
$output = '<div class="usof-form for_' . $type . '">';
|
||||
if ( count( $groups ) > 1 ) {
|
||||
$group_index = 0;
|
||||
$output .= '<div class="usof-tabs">';
|
||||
$output .= '<div class="usof-tabs-list">';
|
||||
foreach ( $groups as $group => &$group_params ) {
|
||||
$output .= '<div class="usof-tabs-item' . ( $group_index ? '' : ' active' ) . '">' . $group . '</div>';
|
||||
$group_index ++;
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="usof-tabs-sections">';
|
||||
}
|
||||
|
||||
$group_index = 0;
|
||||
foreach ( $groups as &$group_params ) {
|
||||
if ( count( $groups ) > 1 ) {
|
||||
$output .= '<div class="usof-tabs-section" style="display: ' . ( $group_index ? 'none' : 'flex' ) . '">';
|
||||
}
|
||||
$attributes_with_prefixes = array(
|
||||
'title',
|
||||
'description',
|
||||
'std',
|
||||
'cols',
|
||||
'classes',
|
||||
'show_if',
|
||||
'states',
|
||||
'with_position',
|
||||
);
|
||||
foreach ( $group_params as $param_name => &$field ) {
|
||||
foreach ( $attributes_with_prefixes as $attribute ) {
|
||||
if ( ! empty( $field[ $context . '_' . $attribute ] ) ) {
|
||||
$field[ $attribute ] = $field[ $context . '_' . $attribute ];
|
||||
}
|
||||
}
|
||||
$output .= us_get_template(
|
||||
'vendor/usof/templates/field', array(
|
||||
'name' => $param_name,
|
||||
'id' => 'hb_elm_' . $type . '_' . $param_name,
|
||||
'field' => $field,
|
||||
'values' => $values,
|
||||
)
|
||||
);
|
||||
}
|
||||
if ( count( $groups ) > 1 ) {
|
||||
$output .= '</div>'; // .usof-tabs-section
|
||||
}
|
||||
$group_index ++;
|
||||
}
|
||||
|
||||
if ( count( $groups ) > 1 ) {
|
||||
$output .= '</div>'; // .usof-tabs-sections
|
||||
$output .= '</div>'; // .usof-tabs
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Add to cart element
|
||||
*/
|
||||
|
||||
global $product;
|
||||
if ( ! class_exists( 'woocommerce' ) OR ! $product OR $us_elm_context == 'grid_term' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Output WooCommerce Add to cart
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
|
||||
// Prepare inline CSS for shortcode
|
||||
if ( ! isset( $font_size ) OR trim( $font_size ) == us_get_option( 'body_fontsize', '16px' ) ) {
|
||||
$font_size = '';
|
||||
}
|
||||
$inline_css = us_prepare_inline_css( array( 'font-size' => $font_size ) );
|
||||
|
||||
echo '<div class="w-post-elm add_to_cart' . $classes . '"' . $el_id . $inline_css . '>';
|
||||
if ( is_object( $product ) AND method_exists( $product, 'get_type' ) ) {
|
||||
woocommerce_template_single_add_to_cart();
|
||||
if ( function_exists( 'wc_print_notices' ) ) {
|
||||
woocommerce_output_all_notices();
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
} else {
|
||||
add_filter( 'woocommerce_product_add_to_cart_text', 'us_add_to_cart_text', 99, 2 );
|
||||
add_filter( 'woocommerce_loop_add_to_cart_link', 'us_add_to_cart_text_replace', 99, 3 );
|
||||
|
||||
if ( empty( $view_cart_link ) ) {
|
||||
$classes .= ' no_view_cart_link';
|
||||
}
|
||||
echo '<div class="w-btn-wrapper woocommerce' . $classes . '">';
|
||||
woocommerce_template_loop_add_to_cart();
|
||||
echo '</div>';
|
||||
|
||||
remove_filter( 'woocommerce_product_add_to_cart_text', 'us_add_to_cart_text', 99 );
|
||||
remove_filter( 'woocommerce_loop_add_to_cart_link', 'us_add_to_cart_text_replace', 99 );
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output links menu element
|
||||
*/
|
||||
|
||||
if ( empty( $source ) OR ! is_nav_menu( $source ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'container' => 'div',
|
||||
'container_class' => 'w-menu ' . $classes,
|
||||
'menu' => $source,
|
||||
'walker' => new US_Walker_Simplenav_Menu,
|
||||
'items_wrap' => '<div class="w-menu-list">%3$s</div>',
|
||||
'depth' => 1,
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_breadcrumbs
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $home string Homepage Label
|
||||
* @param $font_size string Font Size
|
||||
* @param $align string Alignment
|
||||
* @param $separator_type string Separator Type: 'icon' / 'custom'
|
||||
* @param $separator_icon string Separator Icon
|
||||
* @param $separator_symbol string Separator Symbol
|
||||
* @param $show_current bool Show current page?
|
||||
* @param $el_class string Extra class name
|
||||
*/
|
||||
|
||||
|
||||
// Don't show the element on the homepage
|
||||
if ( is_home() OR is_front_page() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = '';
|
||||
$classes .= ' separator_' . $separator_type;
|
||||
$classes .= ' align_' . $align;
|
||||
if ( ! $show_current ) {
|
||||
$classes .= ' hide_current';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Generate inline styles
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $font_size,
|
||||
)
|
||||
);
|
||||
|
||||
// Generate separator between crumbs
|
||||
$delimiter = '';
|
||||
if ( $separator_type == 'icon' ) {
|
||||
$delimiter = us_prepare_icon_tag( $separator_icon );
|
||||
} elseif ( $separator_type == 'custom' ) {
|
||||
$delimiter = strip_tags( $separator_symbol );
|
||||
}
|
||||
if ( $delimiter != '' ) {
|
||||
$delimiter = '<li class="g-breadcrumbs-separator">' . $delimiter . '</li>';
|
||||
}
|
||||
|
||||
// Generate microdata markup
|
||||
$microdata_list = $microdata_item = $link_attr = $name_attr = $position_attr = '';
|
||||
if ( us_get_option( 'schema_markup' ) ) {
|
||||
$microdata_list = ' itemscope itemtype="http://schema.org/BreadcrumbList"';
|
||||
$microdata_item = ' itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"';
|
||||
$link_attr = ' itemprop="item"';
|
||||
$name_attr = ' itemprop="name"';
|
||||
$position_attr = ' itemprop="position"';
|
||||
}
|
||||
|
||||
if ( function_exists( 'woocommerce_breadcrumb' ) AND is_woocommerce() ) {
|
||||
// Remove markup from WooCommerce Breadcrumbs
|
||||
$microdata_list = $microdata_item = '';
|
||||
}
|
||||
|
||||
// Homepage Label
|
||||
$home = strip_tags( $home );
|
||||
|
||||
// The breadcrumb’s container starting code
|
||||
$list_before = '<ol class="g-breadcrumbs' . $classes . '"' . $el_id . $inline_css . $microdata_list . '>';
|
||||
|
||||
// The breadcrumb’s container ending code
|
||||
$list_after = '</ol>';
|
||||
|
||||
// Code before single crumb
|
||||
$item_before = '<li class="g-breadcrumbs-item"' . $microdata_item . '>';
|
||||
|
||||
// Code after single crumb
|
||||
$item_after = '</li>';
|
||||
|
||||
// Return default WooCommerce breadcrumbs
|
||||
if ( function_exists( 'woocommerce_breadcrumb' ) AND is_woocommerce() ) {
|
||||
|
||||
return woocommerce_breadcrumb(
|
||||
array(
|
||||
'wrap_before' => $list_before,
|
||||
'wrap_after' => $list_after,
|
||||
'delimiter' => $delimiter,
|
||||
'before' => $item_before,
|
||||
'after' => $item_after,
|
||||
'home' => $home,
|
||||
)
|
||||
);
|
||||
|
||||
// Return default bbPress breadcrumbs
|
||||
} elseif ( function_exists( 'bbp_get_breadcrumb' ) AND is_singular( array( 'topic', 'forum', 'reply' ) ) ) {
|
||||
echo bbp_get_breadcrumb(
|
||||
array(
|
||||
'before' => $list_before,
|
||||
'after' => $list_after,
|
||||
'sep' => $delimiter,
|
||||
'crumb_before' => $item_before,
|
||||
'crumb_after' => $item_after,
|
||||
)
|
||||
);
|
||||
|
||||
// Output theme breadcrumbs
|
||||
} else {
|
||||
$us_breadcrumbs = new US_Breadcrumbs( $delimiter, $home, $item_before, $item_after, $link_attr, $name_attr, $position_attr );
|
||||
echo $list_before . $us_breadcrumbs->render() . $list_after;
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Button element
|
||||
*/
|
||||
|
||||
// Default variables
|
||||
$output = $wrapper_classes = $wrapper_inline_css = $btn_inline_css = $responsive_css = '';
|
||||
|
||||
// Button classes & inline styles
|
||||
$btn_classes = 'w-btn us-btn-style_' . $style;
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
|
||||
$wrapper_classes .= ' width_' . $width_type;
|
||||
if ( $width_type != 'full' ) {
|
||||
$wrapper_classes .= ' align_' . $align;
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$wrapper_classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
|
||||
$wrapper_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'width' => ( $width_type == 'custom' AND $align != 'center' ) ? $custom_width : NULL,
|
||||
'max-width' => ( $width_type == 'max' AND $align != 'center' ) ? $custom_width : NULL,
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! isset( $font_size ) OR trim( $font_size ) == us_get_option( 'body_fontsize', '16px' ) ) {
|
||||
$font_size = '';
|
||||
}
|
||||
$btn_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $font_size,
|
||||
'width' => ( $width_type == 'custom' AND $align == 'center' ) ? $custom_width : NULL,
|
||||
'max-width' => ( $width_type == 'max' AND $align == 'center' ) ? $custom_width : NULL,
|
||||
)
|
||||
);
|
||||
if ( ! empty( $font_size_mobiles ) ) {
|
||||
global $us_btn_index;
|
||||
$us_btn_index = isset( $us_btn_index ) ? ( $us_btn_index + 1 ) : 1;
|
||||
$btn_classes .= ' us_btn_' . $us_btn_index;
|
||||
$responsive_css = '<style>@media(max-width:600px){.us_btn_' . $us_btn_index . '{font-size:' . $font_size_mobiles . '!important}}</style>';
|
||||
}
|
||||
$btn_classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
} else {
|
||||
$btn_classes .= isset( $classes ) ? $classes : '';
|
||||
}
|
||||
|
||||
// Icon
|
||||
$icon_html = '';
|
||||
if ( ! empty( $icon ) ) {
|
||||
$icon_html = us_prepare_icon_tag( $icon );
|
||||
$btn_classes .= ' icon_at' . $iconpos;
|
||||
}
|
||||
if ( is_rtl() ) { // swap icon position for RTL
|
||||
$iconpos = ( $iconpos == 'left' ) ? 'right' : 'left';
|
||||
}
|
||||
|
||||
// Text
|
||||
$text = trim( strip_tags( $label, '<br>' ) );
|
||||
if ( $text == '' ) {
|
||||
$btn_classes .= ' text_none';
|
||||
}
|
||||
|
||||
// Link
|
||||
if ( in_array( $us_elm_context, array( 'shortcode', 'header' ) ) ) {
|
||||
$link_type = 'custom';
|
||||
}
|
||||
if ( $link_type === 'post' ) {
|
||||
// Terms of selected taxonomy in Grid
|
||||
if ( $us_elm_context == 'grid_term' ) {
|
||||
global $us_grid_term;
|
||||
$link_atts = ' href="' . get_term_link( $us_grid_term ) . '"';
|
||||
} else {
|
||||
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
|
||||
}
|
||||
} elseif ( $link_type === 'custom' ) {
|
||||
$link_atts = us_generate_link_atts( $link );
|
||||
} else {
|
||||
$link_atts = '';
|
||||
}
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$btn_tag = 'a';
|
||||
} else {
|
||||
$btn_tag = 'div';
|
||||
}
|
||||
|
||||
// Output the element
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$output .= '<div class="w-btn-wrapper' . $wrapper_classes . '"' . $wrapper_inline_css . '>';
|
||||
$output .= $responsive_css;
|
||||
}
|
||||
$output .= '<' . $btn_tag . ' class="' . $btn_classes . '"';
|
||||
$output .= $link_atts . $btn_inline_css . $el_id;
|
||||
$output .= '>';
|
||||
|
||||
if ( $iconpos == 'left' ) {
|
||||
$output .= $icon_html;
|
||||
}
|
||||
if ( $text != '' ) {
|
||||
$output .= '<span class="w-btn-label">' . $text . '</span>';
|
||||
}
|
||||
if ( $iconpos == 'right' ) {
|
||||
$output .= $icon_html;
|
||||
}
|
||||
$output .= '</' . $btn_tag . '>';
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output cart element
|
||||
*
|
||||
* @var $icon int
|
||||
* @var $dropdown_effect string Dropdown Effect
|
||||
* @var $icon_size int
|
||||
* @var $design_options array
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'woocommerce' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $cache_enabled;
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$classes .= ' dropdown_' . $dropdown_effect;
|
||||
if ( $vstretch ) {
|
||||
$classes .= ' height_full';
|
||||
}
|
||||
|
||||
$quantity_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'background' => $quantity_color_bg,
|
||||
'color' => $quantity_color_text,
|
||||
)
|
||||
);
|
||||
|
||||
echo '<div class="w-cart' . $classes . ' empty">';
|
||||
echo '<div class="w-cart-h">';
|
||||
echo '<a class="w-cart-link" href="' . esc_attr( wc_get_cart_url() ) . '" aria-label="' . __( 'Cart', 'us' ) . '">';
|
||||
echo '<span class="w-cart-icon">';
|
||||
|
||||
if ( ! empty( $icon ) ) {
|
||||
echo us_prepare_icon_tag( $icon );
|
||||
}
|
||||
|
||||
echo '<span class="w-cart-quantity"' . $quantity_inline_css . '></span></span></a>';
|
||||
echo '<div class="w-cart-notification"><div><span class="product-name">' . us_translate( 'Product', 'woocommerce' ) . '</span> ' . __( 'was added to your cart', 'us' ) . '</div></div>';
|
||||
echo '<div class="w-cart-dropdown">';
|
||||
the_widget( 'WC_Widget_Cart' ); // This widget being always filled with products via AJAX
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_cform
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
*
|
||||
* @param $receiver_email string Receiver Email
|
||||
* @param $name_field string Name field state: 'required' / 'shown' / 'hidden'
|
||||
* @param $email_field string Email field state: 'required' / 'shown' / 'hidden'
|
||||
* @param $phone_field string Phone field state: 'required' / 'shown' / 'hidden'
|
||||
* @param $message_field string Message field state: 'required' / 'shown' / 'hidden'
|
||||
* @param $captcha_field string Message field state: 'hidden' / 'required'
|
||||
* @param $checkbox_field string Checkbox field state: 'hidden' / 'required'
|
||||
* @param $button_color string Button color: 'primary' / 'secondary' / 'light' / 'contrast' / 'black' / 'white'
|
||||
* @param $button_bg_color string Button background color
|
||||
* @param $button_text_color string Button text color
|
||||
* @param $button_style string Button style: 'raised' / 'flat'
|
||||
* @param $button_size string Button size
|
||||
* @param $button_align string Button alignment: 'left' / 'center' / 'right'
|
||||
* @param $button_text string Button text
|
||||
* @param $icon string Icon name
|
||||
* @param $iconpos string Icon Position: 'left' / 'right'
|
||||
* @param $el_class string Extra class name
|
||||
*/
|
||||
|
||||
global $us_cform_index, $us_cform_prev_post_id, $us_page_block_ids;
|
||||
|
||||
if ( isset( $us_page_block_ids ) AND ! empty( $us_page_block_ids ) ) {
|
||||
$post_id = $us_page_block_ids[0];
|
||||
} else {
|
||||
$post_id = get_the_ID();
|
||||
}
|
||||
|
||||
if ( ! empty( $us_cform_prev_post_id ) AND $us_cform_prev_post_id != $post_id ) {
|
||||
$us_cform_index = 0;
|
||||
}
|
||||
|
||||
// Form indexes start from 1
|
||||
$us_cform_index = ! empty( $us_cform_index ) ? ( $us_cform_index + 1 ) : 1;
|
||||
$us_cform_prev_post_id = $post_id;
|
||||
$us_form_index = $us_cform_index;
|
||||
|
||||
if ( isset( $button_fullwidth ) AND $button_fullwidth ) {
|
||||
$submit_classes = 'width_full';
|
||||
} else {
|
||||
$submit_classes = 'align_' . $button_align;
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes = ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Generate fields params
|
||||
if ( empty( $items ) ) {
|
||||
$fields = array();
|
||||
} else {
|
||||
$fields = json_decode( urldecode( $items ), TRUE );
|
||||
if ( ! is_array( $fields ) ) {
|
||||
$fields = array();
|
||||
}
|
||||
}
|
||||
$fields[] = array(
|
||||
'type' => 'hidden',
|
||||
'label' => 'action',
|
||||
'value' => 'us_ajax_cform',
|
||||
);
|
||||
$fields[] = array(
|
||||
'type' => 'hidden',
|
||||
'label' => 'post_id',
|
||||
'value' => $post_id,
|
||||
);
|
||||
$fields[] = array(
|
||||
'type' => 'hidden',
|
||||
'label' => 'form_index',
|
||||
'value' => $us_cform_index,
|
||||
);
|
||||
$submit_params = array(
|
||||
'type' => 'submit',
|
||||
'classes' => $submit_classes,
|
||||
'icon' => ( ! empty( $icon ) ) ? $icon : '',
|
||||
'icon_pos' => ( ! empty( $iconpos ) ) ? $iconpos : 'left',
|
||||
'btn_classes' => ( ! empty( $iconpos ) AND ! empty( $icon ) ) ? 'icon_at' . $iconpos : '',
|
||||
'btn_inner_css' => ( ! empty( $button_size ) ) ? 'font-size:' . $button_size . ';' : '',
|
||||
'btn_size_mobiles' => ( ! empty( $button_size_mobiles ) ) ? $button_size_mobiles : '',
|
||||
'title' => ( ! empty( $button_text ) ) ? $button_text : us_config( 'elements/cform.params.button_text.std' ),
|
||||
);
|
||||
|
||||
if ( ! empty( $button_color ) ) {
|
||||
$submit_params['btn_classes'] .= ' color_' . $button_color;
|
||||
if ( $button_color == 'custom' ) {
|
||||
if ( $button_bg_color != '' ) {
|
||||
$submit_params['btn_inner_css'] .= 'background:' . $button_bg_color . ';';
|
||||
}
|
||||
if ( $button_text_color != '' ) {
|
||||
$submit_params['btn_inner_css'] .= 'color:' . $button_text_color . ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
$submit_params['btn_classes'] .= ' us-btn-style_' . $button_style;
|
||||
$fields[] = $submit_params;
|
||||
|
||||
// Load form template
|
||||
us_load_template(
|
||||
'templates/form/form', array(
|
||||
'type' => 'cform',
|
||||
'fields' => $fields,
|
||||
'classes' => $classes,
|
||||
'el_id' => $el_id,
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_contacts
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $address string Addresss
|
||||
* @param $phone string Phone
|
||||
* @param $fax string Fax
|
||||
* @param $email string Email
|
||||
* @param $el_class string Extra class name
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$classes = '';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-contacts' . $classes . '"' . $el_id . '><div class="w-contacts-list">';
|
||||
if ( ! empty( $address ) ) {
|
||||
$output .= '<div class="w-contacts-item for_address"><span class="w-contacts-item-value">' . $address . '</span></div>';
|
||||
}
|
||||
if ( ! empty( $phone ) ) {
|
||||
$output .= '<div class="w-contacts-item for_phone"><span class="w-contacts-item-value">' . $phone . '</span></div>';
|
||||
}
|
||||
if ( ! empty( $fax ) ) {
|
||||
$output .= '<div class="w-contacts-item for_fax"><span class="w-contacts-item-value">' . $fax . '</span></div>';
|
||||
}
|
||||
if ( ! empty( $email ) ) {
|
||||
$output .= '<div class="w-contacts-item for_email"><span class="w-contacts-item-value">';
|
||||
$output .= '<a href="mailto:' . $email . '">' . $email . '</a></span></div>';
|
||||
}
|
||||
$output .= '</div></div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Counter
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$classes = $value_inline_css = '';
|
||||
|
||||
$classes .= ' color_' . $color;
|
||||
$classes .= ' align_' . $align;
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Generate inline styles for Value
|
||||
$value_inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $size,
|
||||
'color' => $custom_color,
|
||||
)
|
||||
);
|
||||
|
||||
// Generate inline styles for Title
|
||||
$title_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $title_size,
|
||||
'color' => $title_color,
|
||||
)
|
||||
);
|
||||
|
||||
// Finding numbers positions in both initial and final strings
|
||||
$pos = array();
|
||||
foreach ( array( 'initial', 'final' ) as $key ) {
|
||||
$pos[ $key ] = array();
|
||||
// In this array we'll store the string's character number, where primitive changes from letter to number or back
|
||||
preg_match_all( '~(\(\-?\d+([\.,\'· ]\d+)*\))|(\-?\d+([\.,\'· ]\d+)*)~u', $$key, $matches, PREG_OFFSET_CAPTURE );
|
||||
foreach ( $matches[0] as $match ) {
|
||||
$pos[ $key ][] = $match[1];
|
||||
$pos[ $key ][] = $match[1] + strlen( $match[0] );
|
||||
}
|
||||
};
|
||||
|
||||
// Making sure we have the equal number of numbers in both strings
|
||||
if ( count( $pos['initial'] ) != count( $pos['final'] ) ) {
|
||||
// Not-paired numbers will be treated as letters
|
||||
if ( count( $pos['initial'] ) > count( $pos['final'] ) ) {
|
||||
$pos['initial'] = array_slice( $pos['initial'], 0, count( $pos['final'] ) );
|
||||
} else/*if ( count( $positions['initial'] ) < count( $positions['final'] ) )*/ {
|
||||
$pos['final'] = array_slice( $pos['final'], 0, count( $pos['initial'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Position boundaries
|
||||
foreach ( array( 'initial', 'final' ) as $key ) {
|
||||
array_unshift( $pos[ $key ], 0 );
|
||||
$pos[ $key ][] = strlen( $$key );
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-counter' . $classes . '" data-duration="' . intval( $duration ) * 1000 . '"' . $el_id . '>';
|
||||
$output .= '<div class="w-counter-value"' . $value_inline_css . '>';
|
||||
|
||||
// Determining if we treat each part as a number or as a letter combination
|
||||
for ( $index = 0, $length = count( $pos['initial'] ) - 1; $index < $length; $index++ ) {
|
||||
$part_type = ( $index % 2 ) ? 'number' : 'text';
|
||||
$part_initial = substr( $initial, $pos['initial'][ $index ], $pos['initial'][ $index + 1 ] - $pos['initial'][ $index ] );
|
||||
$part_final = substr( $final, $pos['final'][ $index ], $pos['final'][ $index + 1 ] - $pos['final'][ $index ] );
|
||||
$output .= '<span class="w-counter-value-part type_' . $part_type . '" data-final="' . esc_attr( $part_final ) . '">' . $part_initial . '</span>';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
if ( ! empty ( $title ) ) {
|
||||
$output .= '<' . $title_tag .' class="w-counter-title"' . $title_inline_css . '>';
|
||||
$output .= $title;
|
||||
$output .= '</' . $title_tag . '>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
// If we are in front end editor mode, apply JS to logos
|
||||
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
|
||||
$output .= '<script>
|
||||
jQuery(function($){
|
||||
if (typeof $.fn.wCounter === "function") {
|
||||
jQuery(".w-counter").wCounter();
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_cta
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $title string ActionBox title
|
||||
* @param $title_tag string Title HTML tag: 'div' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'p'
|
||||
* @param $title_size string Title Size
|
||||
* @param $color string ActionBox color style: 'primary' / 'secondary' / 'light' / 'custom'
|
||||
* @param $bg_color string Background color
|
||||
* @param $text_color string Text color
|
||||
* @param $controls string Button(s) location: 'right' / 'bottom'
|
||||
* @param $btn_label string Button 1 label
|
||||
* @param $btn_link string Button 1 link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
|
||||
* @param $btn_style string Button 2 Style: 'primary' / 'secondary' / 'light' / 'contrast' / 'black' / 'white'
|
||||
* @param $btn_size string Button 1 size
|
||||
* @param $btn_icon string Button 1 icon
|
||||
* @param $btn_iconpos string Button 1 icon position: 'left' / 'right'
|
||||
* @param $second_button bool Has second button?
|
||||
* @param $btn2_label string Button 2 label
|
||||
* @param $btn2_link string Button 2 link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
|
||||
* @param $btn2_style string Button 2 Style: 'primary' / 'secondary' / 'light' / 'contrast' / 'black' / 'white'
|
||||
* @param $btn2_size string Button 2 size
|
||||
* @param $btn2_icon string Button 2 icon
|
||||
* @param $btn2_iconpos string Button 2 icon position: 'left' / 'right'
|
||||
* @param $el_class string Extra class name
|
||||
* @param $el_id string Element ID
|
||||
* @param $css string CSS box
|
||||
*/
|
||||
|
||||
$classes = ' color_' . $color;
|
||||
$classes .= ' controls_' . $controls;
|
||||
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'background' => $bg_color,
|
||||
'color' => $text_color,
|
||||
)
|
||||
);
|
||||
|
||||
// Button keys that will be parsed
|
||||
$btn_prefixes = array( 'btn' );
|
||||
if ( $second_button ) {
|
||||
$btn_prefixes[] = 'btn2';
|
||||
}
|
||||
|
||||
// Preparing buttons
|
||||
$buttons = array();
|
||||
foreach ( $btn_prefixes as $prefix ) {
|
||||
if ( empty( ${$prefix . '_label'} ) ) {
|
||||
continue;
|
||||
}
|
||||
$icon_html = '';
|
||||
$btn_classes = ' us-btn-style_' . ${$prefix . '_style'};
|
||||
|
||||
if ( ! isset( ${$prefix . '_size'} ) OR trim( ${$prefix . '_size'} ) == ( us_get_option( 'body_fontsize' ) ) ) {
|
||||
${$prefix . '_size'} = '';
|
||||
}
|
||||
$btn_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => ${$prefix . '_size'},
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! empty( ${$prefix . '_icon'} ) ) {
|
||||
$btn_classes .= ' icon_at' . ${$prefix . '_iconpos'};
|
||||
$icon_html = us_prepare_icon_tag( ${$prefix . '_icon'} );
|
||||
}
|
||||
|
||||
$btn_link_atts = us_generate_link_atts( ${$prefix . '_link'} );
|
||||
|
||||
$buttons[ $prefix ] = '<a class="w-btn' . $btn_classes . '"' . $btn_link_atts . $btn_inline_css . '>';
|
||||
$buttons[ $prefix ] .= ( ${$prefix . '_iconpos'} == 'left' ) ? $icon_html : '';
|
||||
$buttons[ $prefix ] .= '<span class="w-btn-label">' . strip_tags( ${$prefix . '_label'}, '<br>' ) . '</span>';
|
||||
$buttons[ $prefix ] .= ( ${$prefix . '_iconpos'} == 'right' ) ? $icon_html : '';
|
||||
$buttons[ $prefix ] .= '</a>';
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-actionbox' . $classes . '"' . $inline_css . $el_id . '><div class="w-actionbox-text">';
|
||||
if ( ! empty( $title ) ) {
|
||||
$title_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $title_size,
|
||||
)
|
||||
);
|
||||
$output .= '<' . $title_tag . $title_inline_css . '>' . html_entity_decode( $title ) . '</' . $title_tag . '>';
|
||||
}
|
||||
if ( ! empty( $content ) ) {
|
||||
$output .= '<p>' . do_shortcode( $content ) . '</p>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
if ( ! empty( $buttons ) ) {
|
||||
$output .= '<div class="w-actionbox-controls">' . implode( '', $buttons ) . '</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output dropdown element
|
||||
*
|
||||
* @var $source string Source: 'own' / 'sidebar' / 'wpml' / 'polylang'
|
||||
* @var $link_title string
|
||||
* @var $link_icon string
|
||||
* @var $sidebar_id string
|
||||
* @var $links array
|
||||
* @var $wpml_switcher array
|
||||
* @var $dropdown_open string 'click' / 'hover'
|
||||
* @var $dropdown_dir string 'left' / 'right'
|
||||
* @var $dropdown_effect string
|
||||
* @var $size int
|
||||
* @var $size_tablets int
|
||||
* @var $size_mobiles int
|
||||
* @var $design_options array
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$classes .= ' source_' . $source;
|
||||
$classes .= ' dropdown_' . $dropdown_effect;
|
||||
$classes .= ' drop_to_' . $dropdown_dir;
|
||||
$classes .= ' open_on_' . $dropdown_open;
|
||||
|
||||
$data = array(
|
||||
'current' => array(),
|
||||
'list' => array(),
|
||||
);
|
||||
|
||||
if ( $source == 'wpml' AND ! function_exists( 'icl_get_languages' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( $source == 'polylang' AND ! function_exists( 'pll_the_languages' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Custom Links
|
||||
if ( $source == 'own' ) {
|
||||
foreach ( $links as $link ) {
|
||||
$link_atts = usof_get_link_atts( $link['url'] ); // TODO: change it to us_generate_link_atts
|
||||
if ( ! isset( $link_atts['href'] ) ) {
|
||||
$link_atts['href'] = '';
|
||||
}
|
||||
$icon = ( ! empty( $link['icon'] ) ) ? us_prepare_icon_tag( $link['icon'] ) : '';
|
||||
$data['list'][] = array(
|
||||
'icon' => $icon,
|
||||
'title' => $link['label'],
|
||||
'url' => ( substr( $link_atts['href'], 0, 4 ) == 'http' OR substr( $link_atts['href'], 0, 1 ) == '/' OR strpos( $link_atts['href'], '#' ) !== FALSE OR strpos( $link_atts['href'], '?' ) !== FALSE ) ? $link_atts['href'] : ( '//' . $link_atts['href'] ),
|
||||
'target' => ( isset( $link_atts['target'] ) ) ? $link_atts['target'] : NULL,
|
||||
);
|
||||
}
|
||||
// WPML Language Switcher
|
||||
} elseif ( $source == 'wpml' AND function_exists( 'icl_get_languages' ) ) {
|
||||
$languages = apply_filters( 'wpml_active_languages', NULL, array( 'skip_missing' => 0 ) );
|
||||
foreach ( $languages as $language ) {
|
||||
$data_language = array();
|
||||
$data_language['title'] = $data_language['icon'] = '';
|
||||
if ( in_array( 'native_lang', $wpml_switcher ) ) {
|
||||
$data_language['title'] = $language['native_name'];
|
||||
if ( in_array( 'display_lang', $wpml_switcher ) AND ( $language['native_name'] != $language['translated_name'] ) ) {
|
||||
$data_language['title'] .= ' (' . $language['translated_name'] . ')';
|
||||
}
|
||||
} elseif ( in_array( 'display_lang', $wpml_switcher ) ) {
|
||||
$data_language['title'] = $language['translated_name'];
|
||||
}
|
||||
if ( in_array( 'flag', $wpml_switcher ) ) {
|
||||
$data_language['flag'] = $language['country_flag_url'];
|
||||
$data_language['code'] = $language['language_code'];
|
||||
}
|
||||
if ( $language['active'] ) {
|
||||
$data['current'] = $data_language;
|
||||
} else {
|
||||
$data_language['url'] = $language['url'];
|
||||
$data['list'][] = $data_language;
|
||||
}
|
||||
}
|
||||
// Polylang Language Switcher
|
||||
} elseif ( $source == 'polylang' AND function_exists( 'pll_the_languages' ) ) {
|
||||
$pll_langs = pll_the_languages( array( 'raw' => 1 ) );
|
||||
foreach ( $pll_langs as $pll_lang ) {
|
||||
$data_language = array(
|
||||
'title' => $pll_lang['name'],
|
||||
'flag' => $pll_lang['flag'],
|
||||
'code' => $pll_lang['slug'],
|
||||
'icon' => '', // set empty icon
|
||||
);
|
||||
if ( $pll_lang['current_lang'] ) {
|
||||
$data['current'] = $data_language;
|
||||
} else {
|
||||
$data_language['url'] = $pll_lang['url'];
|
||||
$data['list'][] = $data_language;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( in_array( $source, array( 'sidebar', 'own' ) ) ) {
|
||||
$data['current']['title'] = $link_title;
|
||||
$data['current']['icon'] = us_prepare_icon_tag( $link_icon );
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-dropdown' . $classes . '"><div class="w-dropdown-h">';
|
||||
if ( isset( $data['current'] ) AND ! empty( $data['current'] ) ) {
|
||||
$output .= '<div class="w-dropdown-current"><a class="w-dropdown-item" href="javascript:void(0)">';
|
||||
if ( isset( $data['current']['flag'] ) AND ! empty( $data['current']['flag'] ) ) {
|
||||
$output .= '<img src="' . $data['current']['flag'] . '" alt="' . $data['current']['code'] . '" />';
|
||||
}
|
||||
$output .= $data['current']['icon'];
|
||||
$output .= '<span class="w-dropdown-item-title';
|
||||
if ( isset( $data['current']['title_class'] ) AND ! empty( $data['current']['title_class'] ) ) {
|
||||
$output .= ' ' . esc_attr( $data['current']['title_class'] );
|
||||
}
|
||||
$output .= '">' . strip_tags( $data['current']['title'] ) . '</span>';
|
||||
$output .= '</a></div>';
|
||||
}
|
||||
$output .= '<div class="w-dropdown-list"><div class="w-dropdown-list-h">';
|
||||
if ( $source == 'sidebar' ) {
|
||||
ob_start();
|
||||
dynamic_sidebar( $sidebar_id );
|
||||
$output .= ob_get_clean();
|
||||
} else {
|
||||
foreach ( $data['list'] as $link ) {
|
||||
$output .= '<a class="w-dropdown-item smooth-scroll" href="' . esc_url( $link['url'] ) . '"';
|
||||
$output .= ( ! empty( $link['target'] ) ) ? ' target="' . esc_attr( $link['target'] ) . '"' : '';
|
||||
$output .= '>';
|
||||
if ( isset( $link['flag'] ) AND ! empty( $link['flag'] ) ) {
|
||||
$output .= '<img src="' . $link['flag'] . '" alt="' . $link['code'] . '" />';
|
||||
}
|
||||
$output .= $link['icon'];
|
||||
$output .= '<span class="w-dropdown-item-title';
|
||||
if ( isset( $link['title_class'] ) AND ! empty( $link['title_class'] ) ) {
|
||||
$output .= ' ' . esc_attr( $link['title_class'] );
|
||||
}
|
||||
$output .= '">' . strip_tags( $link['title'] ) . '</span>';
|
||||
$output .= '</a>';
|
||||
}
|
||||
}
|
||||
$output .= '</div></div>';
|
||||
$output .= '</div></div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Flipbox
|
||||
*/
|
||||
|
||||
$front_inline_css = $back_inline_css = array();
|
||||
|
||||
// When rotating cubetilt in diagonal direction, we're actually doing a cube flip animation instead
|
||||
if ( in_array( $direction, array( 'ne', 'se', 'sw', 'nw' ) ) ) {
|
||||
if ( $animation == 'cubetilt' ) {
|
||||
$animation = 'cubeflip';
|
||||
}
|
||||
if ( $animation == 'cubeflip' AND $link_type == 'btn' ) {
|
||||
$direction = 'n'; // disable diagonal directions, when back side has a button
|
||||
}
|
||||
}
|
||||
|
||||
// Main element classes
|
||||
$classes = ' animation_' . $animation;
|
||||
$classes .= ' direction_' . $direction;
|
||||
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
|
||||
// Extract "padding" properties from "css" attribute to use them inside flipbox
|
||||
if ( ! empty( $css ) AND preg_match( '~\{([^\}]+?)\;?\}~', $css, $matches ) ) {
|
||||
$css_rules = array_map( 'trim', explode( ';', $matches[1] ) );
|
||||
$padding_params = array(
|
||||
'border',
|
||||
'border-radius',
|
||||
'padding',
|
||||
'padding-top',
|
||||
'padding-left',
|
||||
'padding-right',
|
||||
'padding-bottom',
|
||||
);
|
||||
foreach ( $css_rules as $css_rule ) {
|
||||
$css_rule = explode( ':', $css_rule );
|
||||
if ( count( $css_rule ) == 2 AND in_array( $css_rule[0], $padding_params ) ) {
|
||||
$front_inline_css[ $css_rule[0] ] = $css_rule[1];
|
||||
$back_inline_css[ $css_rule[0] ] = $css_rule[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Link
|
||||
$tag = 'div';
|
||||
$btn_html = '';
|
||||
$link_atts = us_generate_link_atts( $link );
|
||||
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
if ( $link_type == 'container' ) {
|
||||
$tag = 'a';
|
||||
} elseif ( $link_type == 'btn' ) {
|
||||
$btn_html .= '<a class="w-btn us-btn-style_' . $btn_style . '"';
|
||||
$btn_html .= $link_atts;
|
||||
$btn_html .= us_prepare_inline_css( array( 'font-size' => $btn_size ) );
|
||||
$btn_html .= '>';
|
||||
$btn_html .= '<span>' . strip_tags( $btn_label ) . '</span>';
|
||||
$btn_html .= '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'width' => $custom_width,
|
||||
)
|
||||
);
|
||||
|
||||
// Output the element
|
||||
$output = '<' . $tag . ' class="w-flipbox' . $classes . '"' . $inline_css . $el_id . $link_atts . '>';
|
||||
$helper_classes = ' easing_' . $easing;
|
||||
$helper_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'transition-duration' => floatval( $duration ) . 's',
|
||||
)
|
||||
);
|
||||
$output .= '<div class="w-flipbox-h' . $helper_classes . '"' . $helper_inline_css . '>';
|
||||
$output .= '<div class="w-flipbox-hh">';
|
||||
|
||||
if ( $animation == 'cubeflip' AND in_array( $direction, array( 'ne', 'se', 'sw', 'nw' ) ) ) {
|
||||
$output .= '<div class="w-flipbox-hhh">';
|
||||
}
|
||||
|
||||
// Front Side
|
||||
$front_inline_css['height'] = $custom_height;
|
||||
$front_inline_css['background'] = $front_bgcolor;
|
||||
$front_inline_css['color'] = $front_textcolor;
|
||||
|
||||
if ( $front_bgimage_src = wp_get_attachment_image_src( $front_bgimage, $front_bgimage_size ) ) {
|
||||
$front_inline_css['background-image'] = $front_bgimage_src[0];
|
||||
}
|
||||
|
||||
$output .= '<div class="w-flipbox-front"' . us_prepare_inline_css( $front_inline_css ) . '><div class="w-flipbox-front-h">';
|
||||
$output_front_icon = '';
|
||||
if ( $front_icon_type == 'font' ) {
|
||||
$icon_inline_css = array(
|
||||
'font-size' => $front_icon_size,
|
||||
'background' => $front_icon_bgcolor,
|
||||
'color' => $front_icon_color,
|
||||
);
|
||||
$output_front_icon .= '<div class="w-flipbox-front-icon style_' . $front_icon_style . '"' . us_prepare_inline_css( $icon_inline_css ) . '>';
|
||||
$output_front_icon .= us_prepare_icon_tag( $front_icon_name );
|
||||
$output_front_icon .= '</div>';
|
||||
} elseif ( $front_icon_type == 'image' ) {
|
||||
$icon_inline_css = array(
|
||||
'width' => $front_icon_image_width,
|
||||
);
|
||||
$output_front_icon .= '<div class="w-flipbox-front-icon type_image"' . us_prepare_inline_css( $icon_inline_css ) . '>';
|
||||
$output_front_icon .= wp_get_attachment_image( $front_icon_image, 'medium' );
|
||||
$output_front_icon .= '</div>';
|
||||
}
|
||||
$output_front_title = '';
|
||||
if ( ! empty( $front_title ) ) {
|
||||
$output_front_title .= '<' . $front_title_tag . ' class="w-flipbox-front-title"';
|
||||
$output_front_title .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $front_title_size,
|
||||
'color' => $front_textcolor,
|
||||
)
|
||||
);
|
||||
$output_front_title .= '>' . esc_html( $front_title ) . '</' . $front_title_tag . '>';
|
||||
}
|
||||
$output_front_desc = '';
|
||||
if ( ! empty( $front_desc ) ) {
|
||||
$output_front_desc .= '<div class="w-flipbox-front-desc">' . wpautop( $front_desc ) . '</div>';
|
||||
}
|
||||
if ( $front_icon_pos == 'below_title' ) {
|
||||
$output .= $output_front_title . $output_front_icon . $output_front_desc;
|
||||
} elseif ( $front_icon_pos == 'below_desc' ) {
|
||||
$output .= $output_front_title . $output_front_desc . $output_front_icon;
|
||||
} else/*if ( $front_icon_pos == 'above_title' )*/ {
|
||||
$output .= $output_front_icon . $output_front_title . $output_front_desc;
|
||||
}
|
||||
$output .= '</div></div>';
|
||||
|
||||
// Back Side
|
||||
$back_inline_css['display'] = 'none';
|
||||
$back_inline_css['background'] = $back_bgcolor;
|
||||
$back_inline_css['color'] = $back_textcolor;
|
||||
|
||||
if ( $back_bgimage_src = wp_get_attachment_image_src( $back_bgimage, $back_bgimage_size ) ) {
|
||||
$back_inline_css['background-image'] = $back_bgimage_src[0];
|
||||
}
|
||||
|
||||
$output .= '<div class="w-flipbox-back"' . us_prepare_inline_css( $back_inline_css ) . '><div class="w-flipbox-back-h">';
|
||||
if ( ! empty( $back_title ) ) {
|
||||
$output .= '<' . $back_title_tag . ' class="w-flipbox-back-title"';
|
||||
$output .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $back_title_size,
|
||||
'color' => $back_textcolor,
|
||||
)
|
||||
);
|
||||
$output .= '>' . esc_html( $back_title ) . '</' . $back_title_tag . '>';
|
||||
}
|
||||
if ( ! empty( $back_desc ) ) {
|
||||
$output .= '<div class="w-flipbox-back-desc">' . wpautop( $back_desc ) . '</div>';
|
||||
}
|
||||
$output .= $btn_html;
|
||||
$output .= '</div></div>';
|
||||
|
||||
// We need additional dom-elements for 'cubeflip' animations (:before / :after won't suit)
|
||||
if ( $animation == 'cubeflip' ) {
|
||||
|
||||
$front_bgcolor = ( ! empty( $front_bgcolor ) ) ? $front_bgcolor : us_get_color( 'color_content_bg_alt', TRUE );
|
||||
|
||||
// Top & bottom flank with shaded color
|
||||
if ( in_array( $direction, array( 'ne', 'e', 'se', 'sw', 'w', 'nw' ) ) ) {
|
||||
$shaded_color = us_shade_color( $front_bgcolor );
|
||||
$output .= '<div class="w-flipbox-yflank"' . us_prepare_inline_css( array( 'background' => $shaded_color ) ) . '></div>';
|
||||
}
|
||||
|
||||
// Left & right flank with shaded color
|
||||
if ( in_array( $direction, array( 'n', 'ne', 'se', 's', 'sw', 'nw' ) ) ) {
|
||||
$shaded_color = us_shade_color( $front_bgcolor, 0.1 );
|
||||
$output .= '<div class="w-flipbox-xflank"' . us_prepare_inline_css( array( 'background' => $shaded_color ) ) . '></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $animation == 'cubeflip' AND in_array( $direction, array( 'ne', 'se', 'sw', 'nw' ) ) ) {
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
$output .= '</div></div>';
|
||||
$output .= '</' . $tag . '>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: Gallery
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
*/
|
||||
|
||||
if ( empty( $ids ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = '';
|
||||
|
||||
// Columns
|
||||
$columns = intval( $columns );
|
||||
if ( $columns != 1 ) {
|
||||
$classes .= ' cols_' . $columns;
|
||||
}
|
||||
|
||||
// Link type
|
||||
if ( $link == 'none' ) {
|
||||
$link_type = 'none';
|
||||
} elseif ( $link == 'file' ) {
|
||||
$link_type = 'file';
|
||||
} else {
|
||||
$link_type = 'attachment';
|
||||
}
|
||||
$classes .= ' link_' . $link_type;
|
||||
|
||||
// Masonry layout
|
||||
if ( isset( $masonry ) AND $masonry == 'true' ) {
|
||||
$classes .= ' type_masonry';
|
||||
if ( $columns > 1 AND us_get_option( 'ajax_load_js', FALSE ) == FALSE ) {
|
||||
wp_enqueue_script( 'us-isotope' );
|
||||
}
|
||||
}
|
||||
|
||||
// With titles
|
||||
$with_titles = FALSE;
|
||||
if ( isset( $meta ) AND $meta == 'true' ) {
|
||||
$with_titles = TRUE;
|
||||
$classes .= ' with_meta';
|
||||
}
|
||||
|
||||
// With indents
|
||||
if ( isset( $indents ) AND $indents == 'true' ) {
|
||||
$classes .= ' with_indents';
|
||||
}
|
||||
|
||||
// Filter classes
|
||||
$classes = apply_filters( 'us_gallery_listing_classes', $classes );
|
||||
|
||||
// Get images
|
||||
$query_args = array(
|
||||
'include' => $ids,
|
||||
'post_status' => 'inherit',
|
||||
'post_type' => 'attachment',
|
||||
'post_mime_type' => 'image',
|
||||
'orderby' => 'post__in',
|
||||
);
|
||||
if ( $orderby == 'rand' ) {
|
||||
$query_args['orderby'] = 'rand';
|
||||
}
|
||||
$attachments = get_posts( $query_args );
|
||||
if ( ! is_array( $attachments ) OR empty( $attachments ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Gallery shortcode usage in feeds
|
||||
if ( is_feed() ) {
|
||||
$output = "\n";
|
||||
foreach ( $attachments as $attachment ) {
|
||||
$output .= wp_get_attachment_link( $attachment->ID, 'thumbnail', TRUE ) . "\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-gallery' . $classes . '"><div class="w-gallery-list">';
|
||||
|
||||
$item_tag_name = ( $link_type == 'none' ) ? 'div' : 'a';
|
||||
|
||||
foreach ( $attachments as $index => $attachment ) {
|
||||
|
||||
// Use the Caption as title
|
||||
$title = trim( strip_tags( $attachment->post_excerpt ) );
|
||||
if ( empty( $title ) ) {
|
||||
// If no Caption, use the Alt
|
||||
$title = trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', TRUE ) ) );
|
||||
}
|
||||
if ( empty( $title ) ) {
|
||||
// If no Alt, use the Title
|
||||
$title = trim( strip_tags( $attachment->post_title ) );
|
||||
}
|
||||
|
||||
$output .= '<' . $item_tag_name . ' class="w-gallery-item order_' . ( $index + 1 );
|
||||
$output .= apply_filters( 'us_gallery_listing_item_classes', '' );
|
||||
$output .= '"';
|
||||
if ( $link_type == 'file' ) {
|
||||
$output .= ' href="' . wp_get_attachment_url( $attachment->ID ) . '" title="' . esc_attr( $title ) . '"';
|
||||
} elseif ( $link_type == 'attachment' ) {
|
||||
$output .= ' href="' . get_attachment_link( $attachment->ID ) . '" title="' . esc_attr( $title ) . '"';
|
||||
}
|
||||
$output .= '>';
|
||||
$output .= '<div class="w-gallery-item-img">';
|
||||
$output .= us_get_attachment_image( $attachment->ID, $size );
|
||||
$output .= '</div>';
|
||||
if ( $with_titles ) {
|
||||
$output .= '<div class="w-gallery-item-meta">';
|
||||
if ( $title != '' ) {
|
||||
$output .= '<div class="w-gallery-item-title">' . $title . '</div>';
|
||||
}
|
||||
$output .= ( ! empty( $attachment->post_content ) ) ? '<div class="w-gallery-item-description">' . $attachment->post_content . '</div>' : '';
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '</' . $item_tag_name . '>';
|
||||
}
|
||||
|
||||
$output .= "</div></div>";
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,213 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_gmaps
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $marker_address string Marker 1 address
|
||||
* @param $marker_text string Marker 1 text
|
||||
* @param $show_infowindow bool Show Marker's InfoWindow
|
||||
* @param $custom_marker_img int Custom marker image (from WordPress media)
|
||||
* @param $custom_marker_size int Custom marker size
|
||||
* @param $markers array Additional Markers
|
||||
* @param $provider string Map Provider: 'google' / 'osm'
|
||||
* @param $type string Map type: 'roadmap' / 'satellite' / 'hybrid' / 'terrain'
|
||||
* @param $height int Map height
|
||||
* @param $zoom int Map zoom
|
||||
* @param $hide_controls bool Hide all map controls
|
||||
* @param $disable_dragging bool Disable dragging on touch screens
|
||||
* @param $disable_zoom bool Disable map zoom on mouse wheel scroll
|
||||
* @param $map_bg_color string Map Background Color
|
||||
* @param $el_class string Extra class name
|
||||
* @param $map_style_json string Map Style
|
||||
* @param $layer_style string Leaflet Map TileLayer
|
||||
*
|
||||
* @filter 'us_maps_js_options' Allows to filter options, passed to JavaScript
|
||||
*/
|
||||
|
||||
global $us_maps_index;
|
||||
$us_maps_index = isset( $us_maps_index ) ? $us_maps_index + 1 : 1;
|
||||
|
||||
$classes = ' provider_' . $provider;
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ' id="' . esc_attr( $el_id ) . '"' : ' id="us_map_' . esc_attr( $us_maps_index ) . '"';
|
||||
|
||||
$classes .= ' us_map_' . $us_maps_index;
|
||||
|
||||
// Decoding base64-encoded HTML attributes
|
||||
if ( ! empty( $marker_text ) ) {
|
||||
$marker_text = rawurldecode( base64_decode( $marker_text ) );
|
||||
}
|
||||
|
||||
if ( ! in_array( $zoom, array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ) ) ) {
|
||||
$zoom = 14;
|
||||
}
|
||||
|
||||
// Form all options needed for JS
|
||||
$script_options = array();
|
||||
if ( ! empty( $marker_address ) ) {
|
||||
$script_options['address'] = $marker_address;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
$script_options['markers'] = array(
|
||||
array_merge(
|
||||
$script_options, array(
|
||||
'html' => ( ! empty( $marker_text ) ) ? $marker_text : $marker_address,
|
||||
'infowindow' => $show_infowindow,
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
if ( empty( $markers ) ) {
|
||||
$markers = array();
|
||||
} else {
|
||||
$markers = json_decode( urldecode( $markers ), TRUE );
|
||||
if ( ! is_array( $markers ) ) {
|
||||
$markers = array();
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $markers as $index => $marker ) {
|
||||
/**
|
||||
* Filtering the included markers
|
||||
*
|
||||
* @param $marker ['marker_address'] string Address
|
||||
* @param $marker ['marker_text'] string Marker Text
|
||||
* @param $marker ['marker_img'] string Marker Image
|
||||
* @param $marker ['marker_size'] string Marker Size
|
||||
*/
|
||||
if ( ! empty( $marker['marker_address'] ) ) {
|
||||
$script_options['markers'][] = array(
|
||||
'html' => ( ! empty( $marker['marker_text'] ) ) ? $marker['marker_text'] : $marker['marker_address'],
|
||||
'address' => $marker['marker_address'],
|
||||
'marker_img' => ( ! empty( $marker['marker_img'] ) ) ? wp_get_attachment_image_src( intval( $marker['marker_img'] ), 'thumbnail' ) : NULL,
|
||||
'marker_size' => ( ! empty( $marker['marker_size'] ) ) ? array(
|
||||
$marker['marker_size'],
|
||||
$marker['marker_size'],
|
||||
) : NULL,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $zoom ) ) {
|
||||
$script_options['zoom'] = intval( $zoom );
|
||||
}
|
||||
|
||||
if ( ! empty( $type ) AND $provider == 'google' ) {
|
||||
$type = strtoupper( $type );
|
||||
if ( in_array( $type, array( 'ROADMAP', 'SATELLITE', 'HYBRID', 'TERRAIN' ) ) ) {
|
||||
$script_options['maptype'] = $type;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $map_bg_color ) ) {
|
||||
$script_options['mapBgColor'] = $map_bg_color;
|
||||
}
|
||||
|
||||
if ( $custom_marker_img != '' ) {
|
||||
if ( is_numeric( $custom_marker_img ) ) {
|
||||
$custom_marker_img = wp_get_attachment_image_url( intval( $custom_marker_img ), 'thumbnail' );
|
||||
}
|
||||
$custom_marker_size = intval( $custom_marker_size );
|
||||
$script_options['icon'] = array(
|
||||
'url' => $custom_marker_img,
|
||||
'size' => array( $custom_marker_size, $custom_marker_size ),
|
||||
);
|
||||
}
|
||||
|
||||
if ( empty( $height ) ) {
|
||||
$height = 400;
|
||||
}
|
||||
$script_options['height'] = $height;
|
||||
|
||||
if ( $provider == 'osm' ) {
|
||||
if ( ! empty( $layer_style ) ) {
|
||||
$script_options['style'] = $layer_style;
|
||||
} else {
|
||||
$script_options['style'] = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; // default value for empty case
|
||||
}
|
||||
}
|
||||
|
||||
if ( $hide_controls ) {
|
||||
$script_options['hideControls'] = TRUE;
|
||||
}
|
||||
|
||||
if ( $disable_zoom ) {
|
||||
$script_options['disableZoom'] = TRUE;
|
||||
}
|
||||
|
||||
if ( $disable_dragging ) {
|
||||
$script_options['disableDragging'] = TRUE;
|
||||
}
|
||||
|
||||
$script_options = apply_filters( 'us_maps_js_options', $script_options, get_the_ID(), $us_maps_index );
|
||||
|
||||
// Enqueue relevant scripts
|
||||
if ( $provider == 'osm' ) {
|
||||
if ( us_get_option( 'ajax_load_js', 0 ) == 0 ) {
|
||||
wp_enqueue_script( 'us-lmap' );
|
||||
}
|
||||
} elseif ( $provider == 'google' ) {
|
||||
wp_enqueue_script( 'us-google-maps' );
|
||||
if ( us_get_option( 'ajax_load_js', 0 ) == 0 ) {
|
||||
wp_enqueue_script( 'us-gmap' );
|
||||
}
|
||||
}
|
||||
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'background' => $map_bg_color,
|
||||
'height' => $height . 'px',
|
||||
)
|
||||
);
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-map' . $classes . '"' . $el_id . $inline_css . '>';
|
||||
$output .= '<div class="w-map-json"' . us_pass_data_to_js( $script_options ) . '></div>';
|
||||
if ( $provider == 'google' AND $map_style_json != '' ) {
|
||||
$output .= '<div class="w-map-style-json" onclick=\'return ' . str_replace( "'", ''', rawurldecode( base64_decode( $map_style_json ) ) ) . '\'></div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
// If we are in front end editor mode, apply JS to maps
|
||||
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
|
||||
if ( $provider == 'osm' ) {
|
||||
$output .= '<script>
|
||||
jQuery(function($){
|
||||
if (typeof $us !== "undefined" && typeof $us.WMaps === "function") {
|
||||
var $wLmap = $(".w-map.provider_osm");
|
||||
if ($wLmap.length){
|
||||
$us.getScript($us.templateDirectoryUri+"/framework/js/vendor/leaflet.js", function(){
|
||||
$wLmap.WLmaps();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
} else {
|
||||
$output .= '<script>
|
||||
jQuery(function($){
|
||||
if (typeof $us !== "undefined" && typeof $us.WMaps === "function") {
|
||||
var $wMap = $(".w-map.provider_google");
|
||||
if ($wMap.length){
|
||||
$us.getScript($us.templateDirectoryUri+"/framework/js/vendor/gmaps.js", function(){
|
||||
$wMap.wMaps();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,390 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_grid
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the element config.
|
||||
*
|
||||
*/
|
||||
|
||||
// If we are running US Grid loop already, return nothing
|
||||
global $us_grid_loop_running;
|
||||
if ( isset( $us_grid_loop_running ) AND $us_grid_loop_running ) {
|
||||
return;
|
||||
}
|
||||
$us_grid_loop_running = TRUE;
|
||||
|
||||
$classes = ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
|
||||
// Grid indexes for CSS, start from 1
|
||||
global $us_grid_index;
|
||||
$us_grid_index = isset( $us_grid_index ) ? ( $us_grid_index + 1 ) : 1;
|
||||
|
||||
// Get the page we are on for AJAX calls
|
||||
global $us_page_block_ids;
|
||||
if ( isset( $us_page_block_ids ) AND ! empty( $us_page_block_ids ) ) {
|
||||
$post_id = $us_page_block_ids[0];
|
||||
} else {
|
||||
$post_id = get_the_ID();
|
||||
}
|
||||
$current_post_id = get_the_ID();
|
||||
|
||||
// Grid indexes for ajax, start from 1
|
||||
if ( $shortcode_base != 'us_carousel' ) {
|
||||
global $us_grid_ajax_indexes;
|
||||
$us_grid_ajax_indexes[ $post_id ] = isset( $us_grid_ajax_indexes[ $post_id ] ) ? ( $us_grid_ajax_indexes[ $post_id ] + 1 ) : 1;
|
||||
} else {
|
||||
$us_grid_ajax_indexes = NULL;
|
||||
}
|
||||
|
||||
// Preparing the query
|
||||
$query_args = $terms = $filter_taxonomies = array();
|
||||
$filter_taxonomy_name = $filter_default_taxonomies = '';
|
||||
|
||||
/*
|
||||
* THINGS TO OUTPUT
|
||||
*/
|
||||
|
||||
// Singulars
|
||||
if ( in_array( $post_type, array_keys( us_grid_available_post_types( TRUE ) ) ) ) {
|
||||
|
||||
$query_args['post_type'] = explode( ',', $post_type );
|
||||
|
||||
// Posts from selected taxonomies
|
||||
$known_post_type_taxonomies = us_grid_available_taxonomies();
|
||||
if ( ! empty( $known_post_type_taxonomies[ $post_type ] ) ) {
|
||||
foreach ( $known_post_type_taxonomies[ $post_type ] as $taxonomy ) {
|
||||
if ( ! empty( ${'taxonomy_' . $taxonomy} ) ) {
|
||||
if ( ! isset( $query_args['tax_query'] ) ) {
|
||||
$query_args['tax_query'] = array();
|
||||
}
|
||||
$query_args['tax_query'][] = array(
|
||||
'taxonomy' => $taxonomy,
|
||||
'field' => 'slug',
|
||||
'terms' => explode( ',', ${'taxonomy_' . $taxonomy} ),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Media attachments should have some differ arguments
|
||||
if ( $post_type == 'attachment' ) {
|
||||
if ( ! empty( $images ) ) {
|
||||
$ids = explode( ',', $images );
|
||||
$query_args['post__in'] = $ids;
|
||||
} else {
|
||||
$attached_images = get_attached_media( 'image', $current_post_id );
|
||||
if ( ! empty( $attached_images ) ) {
|
||||
foreach ( $attached_images as $attached_image ) {
|
||||
$query_args['post__in'][] = $attached_image->ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
$query_args['post_status'] = 'inherit';
|
||||
$query_args['post_mime_type'] = 'image';
|
||||
} else {
|
||||
// Proper post statuses
|
||||
$query_args['post_status'] = array( 'publish' => 'publish' );
|
||||
$query_args['post_status'] += (array) get_post_stati( array( 'public' => TRUE ) );
|
||||
// Add private states if user is capable to view them
|
||||
if ( is_user_logged_in() AND current_user_can( 'read_private_posts' ) ) {
|
||||
$query_args['post_status'] += (array) get_post_stati( array( 'private' => TRUE ) );
|
||||
}
|
||||
$query_args['post_status'] = array_values( $query_args['post_status'] );
|
||||
}
|
||||
|
||||
// Data for filter
|
||||
if ( ! empty( ${'filter_' . $post_type} ) ) {
|
||||
$filter_taxonomy_name = ${'filter_' . $post_type};
|
||||
$terms_args = array(
|
||||
'hierarchical' => FALSE,
|
||||
'taxonomy' => $filter_taxonomy_name,
|
||||
'number' => 100,
|
||||
);
|
||||
if ( ! empty( ${'taxonomy_' . $filter_taxonomy_name} ) ) {
|
||||
$terms_args['slug'] = explode( ',', ${'taxonomy_' . $filter_taxonomy_name} );
|
||||
if ( is_user_logged_in() ) {
|
||||
$terms_args['hide_empty'] = FALSE;
|
||||
}
|
||||
$filter_default_taxonomies = ${'taxonomy_' . $filter_taxonomy_name};
|
||||
}
|
||||
$filter_taxonomies = get_terms( $terms_args );
|
||||
if ( isset( $filter_show_all ) AND ! $filter_show_all AND ! empty( $filter_taxonomies[0] ) ) {
|
||||
$query_args['tax_query'] = array(
|
||||
array(
|
||||
'taxonomy' => $filter_taxonomy_name,
|
||||
'field' => 'slug',
|
||||
'terms' => $filter_taxonomies[0],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Specific items by IDs
|
||||
} elseif ( $post_type == 'ids' AND ! empty( $ids ) ) {
|
||||
$ids = explode( ',', $ids );
|
||||
$query_args['ignore_sticky_posts'] = 1;
|
||||
$query_args['post_type'] = 'any';
|
||||
$query_args['post__in'] = $ids;
|
||||
|
||||
// Items with the same taxonomy of current post
|
||||
} elseif ( $post_type == 'related' AND is_singular() AND ! empty( $related_taxonomy ) ) {
|
||||
$query_args['ignore_sticky_posts'] = 1;
|
||||
$query_args['post_type'] = get_post_type();
|
||||
$query_args['tax_query'] = array(
|
||||
array(
|
||||
'taxonomy' => $related_taxonomy,
|
||||
'terms' => wp_get_object_terms( $current_post_id, $related_taxonomy, array( 'fields' => 'ids' ) ),
|
||||
),
|
||||
);
|
||||
|
||||
// Product upsells (WooCommerce only)
|
||||
} elseif ( $post_type == 'product_upsells' AND is_singular() ) {
|
||||
$upsells_ids = get_post_meta( $current_post_id, '_upsell_ids', TRUE );
|
||||
$query_args['post_type'] = 'product';
|
||||
$query_args['post__in'] = (array) $upsells_ids;
|
||||
|
||||
// Terms of selected (or current) taxonomy
|
||||
} elseif ( in_array( $post_type, array( 'taxonomy_terms', 'current_child_terms' ) ) ) {
|
||||
$current_term_id = $parent = 0;
|
||||
$hide_empty = TRUE;
|
||||
|
||||
if ( strpos( $terms_include, 'children' ) !== FALSE ) {
|
||||
$parent = '';
|
||||
}
|
||||
if ( strpos( $terms_include, 'empty' ) !== FALSE ) {
|
||||
$hide_empty = FALSE;
|
||||
}
|
||||
|
||||
// If the current page is archive, we will output its children terms only
|
||||
if ( $post_type == 'current_child_terms' AND is_archive() ) {
|
||||
$current_term = get_queried_object();
|
||||
$related_taxonomy = $current_term->taxonomy;
|
||||
if ( strpos( $terms_include, 'children' ) !== FALSE ) {
|
||||
$current_term_id = $current_term->term_id;
|
||||
} else {
|
||||
$parent = $current_term->term_id;
|
||||
}
|
||||
}
|
||||
|
||||
$terms = get_terms(
|
||||
array(
|
||||
'taxonomy' => $related_taxonomy,
|
||||
'orderby' => $terms_orderby,
|
||||
'order' => ( $terms_orderby == 'count' ) ? 'DESC' : 'ASC',
|
||||
'number' => $items_quantity,
|
||||
'hide_empty' => $hide_empty,
|
||||
'child_of' => $current_term_id,
|
||||
'parent' => $parent,
|
||||
)
|
||||
);
|
||||
|
||||
// When taxonomy doesn't exist, it returns WP_Error object, so we need to use empty array for further work
|
||||
if ( is_wp_error( $terms ) ) {
|
||||
$terms = array();
|
||||
}
|
||||
|
||||
// Imitate random ordering for terms
|
||||
if ( $terms_orderby == 'rand' ) {
|
||||
shuffle( $terms );
|
||||
}
|
||||
|
||||
// Generate query for "Gallery" and "Post Object" types from ACF PRO plugin
|
||||
} elseif ( strpos( $post_type, 'acf_' ) !== FALSE AND is_singular() ) {
|
||||
|
||||
// ACF Galleries
|
||||
if ( strpos( $post_type, 'acf_gallery_' ) !== FALSE ) {
|
||||
$key = str_replace( 'acf_gallery_', '', $post_type );
|
||||
|
||||
$query_args['post_type'] = 'attachment';
|
||||
$query_args['post_status'] = 'inherit';
|
||||
$query_args['post__in'] = get_post_meta( $current_post_id, $key, TRUE );
|
||||
}
|
||||
|
||||
// ACF Post objects
|
||||
if ( strpos( $post_type, 'acf_posts_' ) !== FALSE ) {
|
||||
$key = str_replace( 'acf_posts_', '', $post_type );
|
||||
$ids = get_post_meta( $current_post_id, $key, TRUE );
|
||||
|
||||
$query_args['post_type'] = 'any';
|
||||
$query_args['ignore_sticky_posts'] = 1;
|
||||
$query_args['post__in'] = is_array( $ids ) ? $ids : array( $ids );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Always exclude the current post from the query
|
||||
if ( is_singular() ) {
|
||||
$query_args['post__not_in'] = array( $current_post_id );
|
||||
}
|
||||
|
||||
// Exclude sticky posts
|
||||
if ( ! empty( $ignore_sticky ) ) {
|
||||
$query_args['ignore_sticky_posts'] = 1;
|
||||
}
|
||||
|
||||
// Set ordering arguments
|
||||
switch ( $orderby ) {
|
||||
case 'date':
|
||||
$query_args['orderby'] = array( 'date' => 'DESC' );
|
||||
break;
|
||||
case 'date_asc':
|
||||
$query_args['orderby'] = array( 'date' => 'ASC' );
|
||||
break;
|
||||
case 'modified':
|
||||
$query_args['orderby'] = array( 'modified' => 'DESC' );
|
||||
break;
|
||||
case 'modified_asc':
|
||||
$query_args['orderby'] = array( 'modified' => 'ASC' );
|
||||
break;
|
||||
case 'alpha':
|
||||
$query_args['orderby'] = array( 'title' => 'ASC' );
|
||||
break;
|
||||
case 'menu_order':
|
||||
$query_args['orderby'] = array( 'menu_order' => 'ASC' );
|
||||
break;
|
||||
case 'rand':
|
||||
$query_args['orderby'] = 'RAND(' . rand() . ')';
|
||||
break;
|
||||
case 'price_desc':
|
||||
$query_args['orderby'] = 'meta_value_num';
|
||||
$query_args['meta_key'] = '_price';
|
||||
$query_args['order'] = 'DESC';
|
||||
break;
|
||||
case 'price_asc':
|
||||
$query_args['orderby'] = 'meta_value_num';
|
||||
$query_args['meta_key'] = '_price';
|
||||
$query_args['order'] = 'ASC';
|
||||
break;
|
||||
case 'popularity':
|
||||
$query_args['orderby'] = 'meta_value_num';
|
||||
$query_args['meta_key'] = 'total_sales';
|
||||
$query_args['order'] = 'DESC';
|
||||
break;
|
||||
case 'rating':
|
||||
$query_args['orderby'] = 'meta_value_num';
|
||||
$query_args['meta_key'] = '_wc_average_rating';
|
||||
$query_args['order'] = 'DESC';
|
||||
break;
|
||||
default:
|
||||
$query_args['orderby'] = $orderby;
|
||||
}
|
||||
|
||||
// Pagination
|
||||
if ( $pagination == 'regular' ) {
|
||||
$request_paged = is_front_page() ? 'page' : 'paged';
|
||||
if ( get_query_var( $request_paged ) ) {
|
||||
$query_args['paged'] = get_query_var( $request_paged );
|
||||
}
|
||||
}
|
||||
|
||||
// Extra arguments for WooCommerce products
|
||||
if ( class_exists( 'woocommerce' ) AND in_array( $post_type, array( 'product', 'product_upsells' ) ) ) {
|
||||
$query_args['meta_query'] = array();
|
||||
|
||||
// Exclude out of stock products
|
||||
if ( $exclude_items == 'out_of_stock' ) {
|
||||
$query_args['meta_query'][] = array(
|
||||
'key' => '_stock_status',
|
||||
'value' => 'outofstock',
|
||||
'compare' => '!=',
|
||||
);
|
||||
}
|
||||
|
||||
// Show Sale products
|
||||
if ( strpos( $products_include, 'sale' ) !== FALSE ) {
|
||||
$query_args['meta_query'][] = array(
|
||||
'key' => '_sale_price',
|
||||
'value' => '',
|
||||
'compare' => '!=',
|
||||
);
|
||||
}
|
||||
|
||||
// Show Featured products
|
||||
if ( strpos( $products_include, 'featured' ) !== FALSE ) {
|
||||
$tax_query_featured = array(
|
||||
'taxonomy' => 'product_visibility',
|
||||
'field' => 'name',
|
||||
'terms' => 'featured',
|
||||
'operator' => 'IN',
|
||||
);
|
||||
$query_args['tax_query'][] = $tax_query_featured;
|
||||
}
|
||||
}
|
||||
|
||||
// Exclude posts of previous grids on the same page
|
||||
if ( $exclude_items == 'prev' ) {
|
||||
global $us_grid_skip_ids;
|
||||
if ( ! empty( $us_grid_skip_ids ) AND is_array( $us_grid_skip_ids ) ) {
|
||||
if ( empty( $query_args['post__not_in'] ) OR ! is_array( $query_args['post__not_in'] ) ) {
|
||||
$query_args['post__not_in'] = array();
|
||||
}
|
||||
$query_args['post__not_in'] = array_merge( $query_args['post__not_in'], $us_grid_skip_ids );
|
||||
}
|
||||
}
|
||||
|
||||
// Items per page
|
||||
if ( $items_quantity < 1 ) {
|
||||
$items_quantity = 999;
|
||||
}
|
||||
$query_args['posts_per_page'] = $items_quantity;
|
||||
|
||||
// Reset query for using on archives
|
||||
if ( $post_type == 'current_query' ) {
|
||||
if ( is_tax( 'tribe_events_cat' ) OR is_post_type_archive( 'tribe_events' ) ) {
|
||||
$the_content = apply_filters( 'the_content', get_the_content() );
|
||||
|
||||
// The page may be paginated itself via <!--nextpage--> tags
|
||||
$the_pagination = wp_link_pages(
|
||||
array(
|
||||
'before' => '<nav class="post-pagination"><span class="title">' . us_translate( 'Pages:' ) . '</span>',
|
||||
'after' => '</nav>',
|
||||
'link_before' => '<span>',
|
||||
'link_after' => '</span>',
|
||||
'echo' => 0,
|
||||
)
|
||||
);
|
||||
|
||||
echo $the_content . $the_pagination;
|
||||
return;
|
||||
} elseif ( is_archive() OR is_search() OR is_home() ) {
|
||||
$query_args = NULL;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Load Grid Listing template with given params
|
||||
$template_vars = array(
|
||||
'query_args' => $query_args,
|
||||
'terms' => $terms,
|
||||
'us_grid_index' => $us_grid_index,
|
||||
'us_grid_ajax_indexes' => $us_grid_ajax_indexes,
|
||||
'classes' => $classes,
|
||||
'post_id' => $post_id,
|
||||
'filter_taxonomy_name' => $filter_taxonomy_name,
|
||||
'filter_default_taxonomies' => $filter_default_taxonomies,
|
||||
'filter_taxonomies' => $filter_taxonomies,
|
||||
);
|
||||
|
||||
// Add default values for unset variables from Grid config
|
||||
$default_grid_params = us_shortcode_atts( array(), 'us_grid' );
|
||||
foreach ( $default_grid_params as $param => $value ) {
|
||||
$template_vars[ $param ] = isset( $$param ) ? $$param : $value;
|
||||
}
|
||||
|
||||
// Add default values for unset variables from Carousel config
|
||||
if ( $shortcode_base == 'us_carousel' ) {
|
||||
$default_carousel_params = us_shortcode_atts( array(), 'us_carousel' );
|
||||
foreach ( $default_carousel_params as $param => $value ) {
|
||||
$template_vars[ $param ] = isset( $$param ) ? $$param : $value;
|
||||
}
|
||||
$template_vars['type'] = 'carousel'; // force 'carousel' type for us_carousel shortcode
|
||||
}
|
||||
|
||||
us_load_template( 'templates/us_grid/listing', $template_vars );
|
||||
|
||||
$us_grid_loop_running = FALSE;
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output html element
|
||||
*
|
||||
* @var $content string
|
||||
* @var $design_options array
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
|
||||
echo '<div class="w-html' . $classes . '">';
|
||||
echo do_shortcode( rawurldecode( base64_decode( $content ) ) );
|
||||
echo '</div>';
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Horizontal Wrapper
|
||||
*/
|
||||
|
||||
$classes = ' align_' . $alignment;
|
||||
$classes .= ' valign_' . $valign;
|
||||
$classes .= ( $wrap ) ? ' wrap' : '';
|
||||
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-hwrapper' . $classes . '"' . $el_id . '>';
|
||||
$output .= do_shortcode( $content );
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_iconbox
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $icon string Icon
|
||||
* @param $style string Icon style: 'default' / 'circle' / 'outlined'
|
||||
* @param $color string Icon color: 'primary' / 'secondary' / 'light' / 'contrast' / 'custom'
|
||||
* @param $icon_color string Icon color value
|
||||
* @param $bg_color string Icon circle color
|
||||
* @param $iconpos string Icon position: 'top' / 'left'
|
||||
* @param $size string Icon size in pixels
|
||||
* @param $img int Icon image (from WordPress media)
|
||||
* @param $title string Title
|
||||
* @param $title_tag string Title HTML tag: 'div' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'p'
|
||||
* @param $title_size string Title Size
|
||||
* @param $link string Link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
|
||||
* @param $alignment string Alignment of the whole element
|
||||
* @param $el_class string Extra class name
|
||||
*/
|
||||
|
||||
$classes = $icon_html = $link_opener = $link_closer = '';
|
||||
|
||||
$classes .= ' iconpos_' . $iconpos;
|
||||
$classes .= ' style_' . $style;
|
||||
$classes .= ' color_' . $color;
|
||||
$classes .= ' align_' . $alignment;
|
||||
if ( $title == '' ) {
|
||||
$classes .= ' no_title';
|
||||
}
|
||||
if ( $content == '' ) {
|
||||
$classes .= ' no_text';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Use image instead icon, if set
|
||||
if ( $img != '' ) {
|
||||
$classes .= ' icontype_img';
|
||||
if ( is_numeric( $img ) ) {
|
||||
$icon_html = us_get_attachment_image( intval( $img ), 'full' );
|
||||
} else {
|
||||
// Direct link to image is set in the shortcode attribute
|
||||
$icon_html = '<img src="' . $img . '" alt="' . $title . '">';
|
||||
}
|
||||
} elseif ( $icon != '' ) {
|
||||
$icon_html = us_prepare_icon_tag( $icon );
|
||||
}
|
||||
|
||||
// Link
|
||||
$link_atts = us_generate_link_atts( $link );
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
if ( $title != '' ) {
|
||||
$link_atts .= ' aria-label="' . esc_attr( $title ) . '"';
|
||||
} else {
|
||||
$link_atts .= ' aria-hidden="true"';
|
||||
}
|
||||
$link_opener = '<a class="w-iconbox-link"' . $link_atts . '>';
|
||||
$link_closer = '</a>';
|
||||
}
|
||||
|
||||
$icon_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => ( $size == '36px' ) ? '' : $size,
|
||||
'box-shadow' => empty( $circle_color ) ? '' : '0 0 0 2px ' . $circle_color . ' inset',
|
||||
'background' => $circle_color,
|
||||
'color' => $icon_color,
|
||||
)
|
||||
);
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-iconbox' . $classes . '"' . $el_id . '>';
|
||||
if ( in_array( $iconpos, array( 'top', 'left' ) ) ) {
|
||||
$output .= $link_opener;
|
||||
$output .= '<div class="w-iconbox-icon"' . $icon_inline_css . '>' . $icon_html . '</div>';
|
||||
$output .= $link_closer;
|
||||
$output .= '<div class="w-iconbox-meta">';
|
||||
} elseif ( $iconpos == 'right' ) {
|
||||
$output .= '<div class="w-iconbox-meta">';
|
||||
}
|
||||
if ( $title != '' ) {
|
||||
$output .= $link_opener;
|
||||
$title_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $title_size,
|
||||
)
|
||||
);
|
||||
$output .= '<' . $title_tag . ' class="w-iconbox-title"' . $title_inline_css . '>' . $title . '</' . $title_tag . '>';
|
||||
$output .= $link_closer;
|
||||
}
|
||||
if ( $content != '' ) {
|
||||
$output .= '<div class="w-iconbox-text">' . do_shortcode( wpautop( $content ) ) . '</div>';
|
||||
}
|
||||
if ( in_array( $iconpos, array( 'top', 'left' ) ) ) {
|
||||
$output .= '</div>';
|
||||
} elseif ( $iconpos == 'right' ) {
|
||||
$output .= '</div>';
|
||||
$output .= $link_opener;
|
||||
$output .= '<div class="w-iconbox-icon"' . $icon_inline_css . '>' . $icon_html . '</div>';
|
||||
$output .= $link_closer;
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Image element
|
||||
*/
|
||||
|
||||
$img_html = $img_shadow = $inline_css = '';
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
$css = ! empty( $css ) ? $css : '';
|
||||
|
||||
if ( class_exists( 'SitePress' ) ) {
|
||||
$image = apply_filters( 'wpml_object_id', $image );
|
||||
}
|
||||
|
||||
// Classes & inline styles
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
|
||||
$img = $image;
|
||||
|
||||
$classes .= ' align_' . $align;
|
||||
$classes .= ( ! empty( $style ) ) ? ' style_' . $style : '';
|
||||
$classes .= ( $meta ) ? ' meta_' . $meta_style : '';
|
||||
if ( ! empty( $animate ) ) {
|
||||
$classes .= ' animate_' . $animate;
|
||||
if ( ! empty( $animate_delay ) ) {
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'animation-delay' => floatval( $animate_delay ) . 's',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
}
|
||||
|
||||
// Get the image
|
||||
$img_arr = explode( '|', $img );
|
||||
$img_html .= us_get_attachment_image( $img_arr[0], $size );
|
||||
|
||||
// Get the image for transparent header if set
|
||||
if ( ! empty( $img_transparent ) ) {
|
||||
$classes .= ' with_transparent';
|
||||
$img_arr = explode( '|', $img_transparent );
|
||||
$img_html .= us_get_attachment_image( $img_arr[0], $size );
|
||||
}
|
||||
|
||||
if ( $us_elm_context == 'shortcode' AND $img_html ) {
|
||||
if ( $meta ) {
|
||||
$attachment = get_post( $img );
|
||||
|
||||
// Use the Caption as a Title
|
||||
$title = trim( strip_tags( $attachment->post_excerpt ) );
|
||||
if ( empty( $title ) ) {
|
||||
// If not, Use the Alt
|
||||
$title = trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', TRUE ) ) );
|
||||
}
|
||||
if ( empty( $title ) ) {
|
||||
// If no Alt, use the Title
|
||||
$title = trim( strip_tags( $attachment->post_title ) );
|
||||
}
|
||||
|
||||
$img_html .= '<div class="w-image-meta">';
|
||||
$img_html .= ( ! empty( $title ) ) ? '<div class="w-image-title">' . $title . '</div>' : '';
|
||||
$img_html .= ( ! empty( $attachment->post_content ) ) ? '<div class="w-image-description">' . $attachment->post_content . '</div>' : '';
|
||||
$img_html .= '</div>';
|
||||
}
|
||||
|
||||
// Get url to the image to immitate shadow
|
||||
$img_src = wp_get_attachment_image_url( $img, $size );
|
||||
if ( $style == 'shadow-2' ) {
|
||||
$img_shadow = '<div class="w-image-shadow" style="background-image:url(' . $img_src . ');"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Link
|
||||
if ( $onclick == 'lightbox' ) {
|
||||
$link_atts = ' href="' . wp_get_attachment_image_url( $img, 'full' ) . '" ref="magnificPopup"';
|
||||
} else {
|
||||
$link_atts = us_generate_link_atts( $link );
|
||||
}
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$tag = 'a';
|
||||
} else {
|
||||
$tag = 'div';
|
||||
}
|
||||
|
||||
if ( empty( $img_html ) ) {
|
||||
// Check if image ID is URL
|
||||
if ( strpos( $img, 'http' ) !== FALSE ) {
|
||||
$img_html = '<img src="' . esc_attr( $img ) . '" alt="image" />';
|
||||
} else {
|
||||
$classes .= ' no_image';
|
||||
$img_html = '<div class="g-placeholder"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-image' . $classes . '"' . $el_id . $inline_css . '>';
|
||||
$output .= '<' . $tag . ' class="w-image-h"' . $link_atts . '>';
|
||||
$output .= $img_shadow;
|
||||
$output .= $img_html;
|
||||
$output .= '</' . $tag . '>';
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,182 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_image_slider
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*/
|
||||
|
||||
if ( empty( $ids ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = ' style_' . $style;
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Royal Slider options
|
||||
$js_options = array(
|
||||
'loopRewind' => TRUE,
|
||||
'slidesSpacing' => 0,
|
||||
'imageScalePadding' => 0,
|
||||
'numImagesToPreload' => 2,
|
||||
'arrowsNav' => ( $arrows != 'hide' ),
|
||||
'arrowsNavAutoHide' => ( $arrows == 'hover' ),
|
||||
'transitionType' => ( $transition == 'crossfade' ) ? 'fade' : 'move',
|
||||
'transitionSpeed' => intval( $transition_speed ),
|
||||
'block' => array(
|
||||
'moveEffect' => 'none',
|
||||
'speed' => 300,
|
||||
),
|
||||
);
|
||||
if ( $nav == 'dots' ) {
|
||||
$js_options['controlNavigation'] = 'bullets';
|
||||
} elseif ( $nav == 'thumbs' ) {
|
||||
$js_options['controlNavigation'] = 'thumbnails';
|
||||
} else {
|
||||
$js_options['controlNavigation'] = 'none';
|
||||
}
|
||||
if ( $autoplay AND $autoplay_period ) {
|
||||
$js_options['autoplay'] = array(
|
||||
'enabled' => TRUE,
|
||||
'pauseOnHover' => $pause_on_hover ? TRUE : FALSE,
|
||||
'delay' => intval( $autoplay_period * 1000 ),
|
||||
);
|
||||
}
|
||||
if ( $fullscreen ) {
|
||||
$js_options['fullscreen'] = array( 'enabled' => TRUE );
|
||||
}
|
||||
if ( $img_fit == 'contain' ) {
|
||||
$js_options['imageScaleMode'] = 'fit';
|
||||
} elseif ( $img_fit == 'cover' ) {
|
||||
$js_options['imageScaleMode'] = 'fill';
|
||||
} else/*if ( $img_fit == 'scaledown' )*/ {
|
||||
$js_options['imageScaleMode'] = 'fit-if-smaller';
|
||||
}
|
||||
|
||||
if ( ! in_array( $img_size, get_intermediate_image_sizes() ) ) {
|
||||
$img_size = 'full';
|
||||
}
|
||||
|
||||
// Getting images
|
||||
$query_args = array(
|
||||
'include' => $ids,
|
||||
'post_status' => 'inherit',
|
||||
'post_type' => 'attachment',
|
||||
'post_mime_type' => 'image',
|
||||
'orderby' => 'post__in',
|
||||
'numberposts' => - 1,
|
||||
);
|
||||
if ( $orderby == 'rand' ) {
|
||||
$query_args['orderby'] = 'rand';
|
||||
}
|
||||
$attachments = get_posts( $query_args );
|
||||
if ( ! is_array( $attachments ) OR empty( $attachments ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
$first_image = array( '0' => '' );
|
||||
$data_ratio = NULL;
|
||||
$images_html = '';
|
||||
$images_alts = array();
|
||||
foreach ( $attachments as $index => $attachment ) {
|
||||
$image = wp_get_attachment_image_src( $attachment->ID, $img_size );
|
||||
if ( ! $image ) {
|
||||
continue;
|
||||
}
|
||||
// Correct width and height for SVG files
|
||||
if ( preg_match( '~\.svg$~', $image[0] ) ) {
|
||||
|
||||
$size_array = us_get_intermediate_image_size( $img_size );
|
||||
if ( $size_array['width'] ) {
|
||||
$image[1] = $image[2] = $size_array['width'];
|
||||
} elseif ( $size_array['height'] ) {
|
||||
$image[1] = $image[2] = $size_array['height'];
|
||||
} else {
|
||||
$image[1] = $image[2] = '2000'; // fallback for non-numeric values
|
||||
}
|
||||
}
|
||||
if ( ! isset( $js_options['autoScaleSlider'] ) ) {
|
||||
$js_options['autoScaleSlider'] = TRUE;
|
||||
$js_options['autoScaleSliderWidth'] = $image[1];
|
||||
$js_options['autoScaleSliderHeight'] = $image[2];
|
||||
$js_options['fitInViewport'] = FALSE;
|
||||
}
|
||||
$full_image_attr = '';
|
||||
if ( $fullscreen ) {
|
||||
$full_image = wp_get_attachment_image_url( $attachment->ID, 'full' );
|
||||
if ( ! $full_image ) {
|
||||
$full_image = $image[0];
|
||||
}
|
||||
$full_image_attr = ' data-rsBigImg="' . $full_image . '"';
|
||||
}
|
||||
|
||||
// Use the Caption as a Title
|
||||
$image_title = trim( strip_tags( $attachment->post_excerpt ) );
|
||||
if ( empty( $image_title ) ) {
|
||||
// If not, Use the Alt
|
||||
$image_title = trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', TRUE ) ) );
|
||||
}
|
||||
if ( empty( $image_title ) ) {
|
||||
// If no Alt, use the Title
|
||||
$image_title = trim( strip_tags( $attachment->post_title ) );
|
||||
}
|
||||
|
||||
$img_alt = us_get_image_alt( $attachment->ID );
|
||||
|
||||
$images_html .= '<div class="rsContent">';
|
||||
if ( $i == 1 ) {
|
||||
$first_image = $image;
|
||||
$first_image_alt = ' alt="' . $img_alt . '"';
|
||||
}
|
||||
$images_html .= '<a class="rsImg" data-rsw="' . $image[1] . '" data-rsh="' . $image[2] . '"' . $full_image_attr . ' href="' . $image[0] . '"><span data-alt="' . $img_alt . '"></span></a>';
|
||||
|
||||
if ( $nav == 'thumbs' ) {
|
||||
$images_html .= wp_get_attachment_image( $attachment->ID, 'thumbnail', FALSE, array( 'class' => 'rsTmb' ) );
|
||||
}
|
||||
if ( $meta ) {
|
||||
$images_html .= '<div class="rsABlock" data-fadeEffect="false" data-moveEffect="none">';
|
||||
if ( $image_title != '' ) {
|
||||
$images_html .= '<div class="w-slider-item-title">' . $image_title . '</div>';
|
||||
}
|
||||
if ( $attachment->post_content != '' ) {
|
||||
$images_html .= '<div class="w-slider-item-description">' . $attachment->post_content . '</div>';
|
||||
}
|
||||
$images_html .= '</div>';
|
||||
}
|
||||
$images_html .= '</div>';
|
||||
$i ++;
|
||||
}
|
||||
|
||||
// We need Royal Slider script for this
|
||||
if ( us_get_option( 'ajax_load_js', 0 ) == 0 ) {
|
||||
wp_enqueue_script( 'us-royalslider' );
|
||||
}
|
||||
|
||||
$output = '<div class="w-slider' . $classes . '"' . $el_id . '>';
|
||||
$output .= '<div class="w-slider-h">';
|
||||
$output .= '<div class="royalSlider">' . $images_html . '</div>';
|
||||
$output .= '<img src="' . $first_image[0] . '"' . $first_image_alt . '></div>';
|
||||
$output .= '<div class="w-slider-json"' . us_pass_data_to_js( $js_options ) . '></div>';
|
||||
$output .= '</div>';
|
||||
|
||||
// If we are in front end editor mode, apply JS to logos
|
||||
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
|
||||
$output .= '<script>
|
||||
jQuery(function($){
|
||||
if (typeof $.fn.wSlider === "function") {
|
||||
jQuery(".w-slider").wSlider();
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,186 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Interactive Text
|
||||
*/
|
||||
|
||||
$classes = ' type_' . $animation_type . ' align_' . $align;
|
||||
if ( $dynamic_bold ) {
|
||||
$classes .= ' dynamic_bold';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Allows to use nbsps and other entities
|
||||
$texts = html_entity_decode( $texts );
|
||||
|
||||
$texts_arr = explode( "\n", strip_tags( $texts ) );
|
||||
|
||||
$js_data = array(
|
||||
'duration' => intval( $duration ) * 1000,
|
||||
'delay' => intval( floatval( $delay ) * 1000 ),
|
||||
);
|
||||
if ( ! empty( $dynamic_color ) ) {
|
||||
$js_data['dynamicColor'] = $dynamic_color;
|
||||
}
|
||||
|
||||
// Getting words and their delimiters to work on this level of abstraction
|
||||
$_parts = array();
|
||||
foreach ( $texts_arr as $index => $text ) {
|
||||
preg_match_all( '~[\w\-]+|[^\w\-]+~u', $text, $matches );
|
||||
$_parts[ $index ] = $matches[0];
|
||||
}
|
||||
|
||||
// Getting the whole set of parts with all the intermediate values (part_index => part_states)
|
||||
$groups = array();
|
||||
foreach ( $_parts[0] as $part ) {
|
||||
$groups[] = array( $part );
|
||||
}
|
||||
|
||||
for ( $i_index = count( $_parts ) - 1; $i_index > 0; $i_index -- ) {
|
||||
$f_index = isset( $_parts[ $i_index + 1 ] ) ? ( $i_index + 1 ) : 0;
|
||||
$initial = &$_parts[ $i_index ];
|
||||
$final = &$_parts[ $f_index ];
|
||||
// Counting arrays edit distance for the strings parts to find the common parts
|
||||
$dist = array();
|
||||
for ( $i = 0; $i <= count( $initial ); $i ++ ) {
|
||||
$dist[ $i ] = array( $i );
|
||||
}
|
||||
for ( $j = 1; $j <= count( $final ); $j ++ ) {
|
||||
$dist[0][ $j ] = $j;
|
||||
for ( $i = 1; $i <= count( $initial ); $i ++ ) {
|
||||
if ( $initial[ $i - 1 ] == $final[ $j - 1 ] ) {
|
||||
$dist[ $i ][ $j ] = $dist[ $i - 1 ][ $j - 1 ];
|
||||
} else {
|
||||
$dist[ $i ][ $j ] = min( $dist[ $i - 1 ][ $j ], $dist[ $i ][ $j - 1 ], $dist[ $i - 1 ][ $j - 1 ] ) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( $i = count( $initial ), $j = count( $final ); $i > 0 OR $j > 0; $i --, $j -- ) {
|
||||
$min = $dist[ $i ][ $j ];
|
||||
if ( $i > 0 ) {
|
||||
$min = min( $min, $dist[ $i - 1 ][ $j ], ( $j > 0 ) ? $dist[ $i - 1 ][ $j - 1 ] : $min );
|
||||
}
|
||||
if ( $j > 0 ) {
|
||||
$min = min( $min, $dist[ $i ][ $j - 1 ] );
|
||||
}
|
||||
if ( $min >= $dist[ $i ][ $j ] ) {
|
||||
$groups[ $j - 1 ][ $i_index ] = $initial[ $i - 1 ];
|
||||
continue;
|
||||
}
|
||||
if ( $i > 0 AND $j > 0 AND $min == $dist[ $i - 1 ][ $j - 1 ] ) {
|
||||
// Modify
|
||||
$groups[ $j - 1 ][ $i_index ] = $initial[ $i - 1 ];
|
||||
} elseif ( $j > 0 AND $min == $dist[ $i ][ $j - 1 ] ) {
|
||||
// Remove
|
||||
$groups[ $j - 1 ][ $i_index ] = '';
|
||||
$i ++;
|
||||
} elseif ( $min == $dist[ $i - 1 ][ $j ] ) {
|
||||
// Insert
|
||||
if ( $j == 0 ) {
|
||||
array_unshift( $groups, '' );
|
||||
} else {
|
||||
array_splice( $groups, $j, 0, '' );
|
||||
}
|
||||
$groups[ $j ] = array_fill( 0, count( $_parts ), '' );
|
||||
$groups[ $j ][ $i_index ] = $initial[ $i - 1 ];
|
||||
$j ++;
|
||||
}
|
||||
}
|
||||
// Updating final parts
|
||||
$_parts[ $i_index ] = array();
|
||||
foreach ( $groups as $parts_group ) {
|
||||
$_parts[ $i_index ][] = $parts_group[ $i_index ];
|
||||
}
|
||||
}
|
||||
|
||||
// Finding the dynamic parts and their animation indexes
|
||||
$group_changes = array();
|
||||
$nbsp_char = html_entity_decode( ' ' );
|
||||
foreach ( $groups as $index => $group ) {
|
||||
$group_changes[ $index ] = array();
|
||||
for ( $i = 0; $i < count( $_parts ); $i ++ ) {
|
||||
if ( $group[ $i ] != $group[ isset( $group[ $i + 1 ] ) ? ( $i + 1 ) : 0 ] OR $group[ $i ] === '' ) {
|
||||
$group_changes[ $index ][] = $i;
|
||||
}
|
||||
// HTML won't show spans with spaces at all, so replacing them with nbsps
|
||||
// A bit sophisticated check to speed up this frequent action
|
||||
if ( strlen( $group[ $i ] ) AND $group[ $i ][0] == ' ' AND preg_match( '~^ +$~u', $group[ $i ][0] ) ) {
|
||||
$groups[ $index ][ $i ] = str_replace( ' ', $nbsp_char, $group[ $i ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Combining groups that are either static, or are changed at the same time
|
||||
for ( $i = 1; $i < count( $group_changes ); $i ++ ) {
|
||||
if ( $group_changes[ $i - 1 ] == $group_changes[ $i ] ) {
|
||||
// Combining with the previous element
|
||||
foreach ( $groups[ $i - 1 ] AS $index => $part ) {
|
||||
$groups[ $i - 1 ][ $index ] .= $groups[ $i ][ $index ];
|
||||
}
|
||||
array_splice( $groups, $i, 1 );
|
||||
array_splice( $group_changes, $i, 1 );
|
||||
$i --;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate inline styles
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
'color' => $color,
|
||||
), TRUE, $tag
|
||||
);
|
||||
|
||||
$responsive_css = '';
|
||||
if ( ! empty( $font_size_mobiles ) OR ! empty( $line_height_mobiles ) ) {
|
||||
global $us_itext_id;
|
||||
$us_itext_id = isset( $us_itext_id ) ? ( $us_itext_id + 1 ) : 1;
|
||||
$classes .= ' us_itext_' . $us_itext_id;
|
||||
|
||||
$responsive_css .= '<style>';
|
||||
$responsive_css .= '@media (max-width: 600px) {.us_itext_' . $us_itext_id . '{';
|
||||
$responsive_css .= ! empty( $font_size_mobiles ) ? ( 'font-size:' . $font_size_mobiles . '!important;' ) : '';
|
||||
$responsive_css .= ! empty( $line_height_mobiles ) ? ( 'line-height:' . $line_height_mobiles . '!important;' ) : '';
|
||||
$responsive_css .= '}}';
|
||||
$responsive_css .= '</style>';
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<' . $tag . ' class="w-itext' . $classes . '"';
|
||||
$output .= $el_id . $inline_css;
|
||||
$output .= us_pass_data_to_js( $js_data );
|
||||
$output .= '>';
|
||||
|
||||
foreach ( $groups as $index => $group ) {
|
||||
ksort( $group );
|
||||
if ( empty( $group_changes[ $index ] ) ) {
|
||||
// Static part
|
||||
$output .= $group[0];
|
||||
} else {
|
||||
$output .= '<span class="w-itext-part';
|
||||
// Animation classes (just in case site editor wants some custom styling for them)
|
||||
foreach ( $group_changes[ $index ] as $changesat ) {
|
||||
$output .= ' changesat_' . $changesat;
|
||||
}
|
||||
if ( in_array( '0', $group_changes[ $index ] ) ) {
|
||||
// Highlighting dynamic parts at start
|
||||
$output .= ' dynamic"' . us_prepare_inline_css( array( 'color' => $dynamic_color ) );
|
||||
} else {
|
||||
$output .= '"';
|
||||
}
|
||||
$output .= us_pass_data_to_js( $group ) . '>' . preg_replace( '/\s/', ' ', htmlentities( $group[0] ) ) . '</span>';
|
||||
}
|
||||
}
|
||||
$output .= '</' . $tag . '>';
|
||||
$output .= $responsive_css;
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output menu element
|
||||
*
|
||||
* @var $hover_effect string Hover Effect: 'simple' / 'underline'
|
||||
* @var $dropdown_effect string Dropdown Effect
|
||||
* @var $vstretch boolean Stretch menu items vertically to fit the available height
|
||||
* @var $indents int Items Indents
|
||||
* @var $mobile_width int On which screen width menu becomes mobile
|
||||
* @var $mobile_behavior boolean Mobile behavior
|
||||
* @var $design_options array
|
||||
* @var $id string
|
||||
* @var $classes string
|
||||
* @var $source string WP Menu source
|
||||
*/
|
||||
|
||||
if ( substr( $source, 0, 9 ) == 'location:' ) {
|
||||
$location = substr( $source, 9 );
|
||||
$theme_locations = get_nav_menu_locations();
|
||||
if ( isset( $theme_locations[$location] ) ) {
|
||||
$menu_obj = get_term( $theme_locations[$location], 'nav_menu' );
|
||||
if ( $menu_obj ) {
|
||||
$source = $menu_obj->slug;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$location = NULL;
|
||||
}
|
||||
|
||||
if ( empty( $location ) AND ( empty( $source ) OR ! is_nav_menu( $source ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
|
||||
$list_classes = ' level_1 hide_for_mobiles';
|
||||
$list_classes .= ( isset( $hover_effect ) ) ? ' hover_' . $hover_effect : '';
|
||||
if ( $vstretch ) {
|
||||
$classes .= ' height_full';
|
||||
}
|
||||
$classes .= ' type_desktop dropdown_' . $dropdown_effect;
|
||||
$classes .= ( isset( $mobile_align ) ) ? ' m_align_' . $mobile_align : '';
|
||||
if ( isset( $mobile_layout ) ) {
|
||||
$classes .= ' m_layout_' . $mobile_layout;
|
||||
if ( $mobile_layout == 'panel' ) {
|
||||
$classes .= ( isset( $mobile_effect_p ) ) ? ' m_effect_' . $mobile_effect_p : '';
|
||||
}
|
||||
if ( $mobile_layout == 'fullscreen' ) {
|
||||
$classes .= ( isset( $mobile_effect_f ) ) ? ' m_effect_' . $mobile_effect_f : '';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<nav class="w-nav' . $classes . '"';
|
||||
if ( us_get_option( 'schema_markup' ) ) {
|
||||
echo ' itemscope itemtype="https://schema.org/SiteNavigationElement"';
|
||||
}
|
||||
echo '>';
|
||||
echo '<a class="w-nav-control" href="javascript:void(0);" aria-label="' . us_translate( 'Menu' ) . '">';
|
||||
echo '<div class="w-nav-icon"><i></i></div>';
|
||||
echo '<span>' . us_translate( 'Menu' ) . '</span>';
|
||||
echo '</a>';
|
||||
echo '<ul class="w-nav-list' . $list_classes . '">';
|
||||
if ( $location ) {
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'theme_location' => $location,
|
||||
'container' => FALSE,
|
||||
'walker' => new US_Walker_Nav_Menu,
|
||||
'items_wrap' => '%3$s',
|
||||
'fallback_cb' => FALSE,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'menu' => $source,
|
||||
'container' => FALSE,
|
||||
'walker' => new US_Walker_Nav_Menu,
|
||||
'items_wrap' => '%3$s',
|
||||
'fallback_cb' => FALSE,
|
||||
)
|
||||
);
|
||||
}
|
||||
echo '<li class="w-nav-close"></li>';
|
||||
echo '</ul>';
|
||||
echo '<div class="w-nav-options hidden"';
|
||||
echo us_pass_data_to_js(
|
||||
array(
|
||||
'mobileWidth' => intval( $mobile_width ),
|
||||
'mobileBehavior' => intval( $mobile_behavior ),
|
||||
)
|
||||
);
|
||||
echo '></div>';
|
||||
echo '</nav>';
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_message
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $color string Message box color: 'info' / 'attention' / 'success' / 'error' / 'custom'
|
||||
* @param $bg_color string Background color
|
||||
* @param $text_color string Text color
|
||||
* @param $icon string Icon
|
||||
* @param $closing bool Enable closing?
|
||||
* @param $el_class string Extra class name
|
||||
*/
|
||||
|
||||
$classes = $icon_html = $closer_html = '';
|
||||
|
||||
$classes .= ' color_' . $color;
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
if ( ! empty( $icon ) ) {
|
||||
$icon_html = '<div class="w-message-icon">' . us_prepare_icon_tag( $icon ) . '</div>';
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
|
||||
if ( $closing ) {
|
||||
$classes .= ' with_close';
|
||||
$closer_html = '<a class="w-message-close" href="javascript:void(0)" aria-label="' . us_translate( 'Close' ) . '"></a>';
|
||||
}
|
||||
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'background' => $bg_color,
|
||||
'color' => $text_color,
|
||||
)
|
||||
);
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-message' . $classes . '"' . $el_id . $inline_css . '>' . $icon_html;
|
||||
$output .= '<div class="w-message-body"><p>' . do_shortcode( $content ) . '</p></div>' . $closer_html . '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Page Block element
|
||||
*/
|
||||
|
||||
if ( is_numeric( $id ) ) {
|
||||
$page_block = get_post( $id );
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $page_block AND $page_block->post_type == 'us_page_block' ) {
|
||||
us_add_to_page_block_ids( $page_block->ID );
|
||||
|
||||
$page_block_content = $page_block->post_content;
|
||||
us_open_wp_query_context();
|
||||
|
||||
us_add_page_shortcodes_custom_css( $id );
|
||||
|
||||
us_close_wp_query_context();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove [vc_row] and [vc_column] if set
|
||||
if ( $remove_rows ) {
|
||||
$page_block_content = str_replace( array( '[vc_row]', '[/vc_row]', '[vc_column]', '[/vc_column]' ), '', $page_block_content );
|
||||
$page_block_content = preg_replace( '~\[vc_row (.+?)]~', '', $page_block_content );
|
||||
$page_block_content = preg_replace( '~\[vc_column (.+?)]~', '', $page_block_content );
|
||||
}
|
||||
|
||||
// Force fullwidth for all [vc_row] if set
|
||||
if ( ! $remove_rows AND $force_fullwidth_rows ) {
|
||||
$page_block_content = str_replace( '[vc_row]', '[vc_row width="full"]', $page_block_content );
|
||||
$page_block_content = str_replace( '[vc_row ', '[vc_row width="full" ', $page_block_content );
|
||||
}
|
||||
|
||||
// Apply filters to Page Block content and echoing it ouside of us_open_wp_query_context
|
||||
echo apply_filters( 'us_page_block_the_content', $page_block_content );
|
||||
|
||||
us_remove_from_page_block_ids();
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_page_title
|
||||
*/
|
||||
|
||||
$classes = $schema_heading = $output = '';
|
||||
|
||||
$classes .= ' align_' . $align;
|
||||
if ( $inline AND $align != 'center' ) {
|
||||
$classes .= ' type_inline';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Generate inline styles
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
'color' => $color,
|
||||
), TRUE, $tag
|
||||
);
|
||||
|
||||
// Add microdata depending on the relevant Theme Option
|
||||
if ( us_get_option( 'schema_markup' ) ) {
|
||||
$schema_heading = ' itemprop="headline"';
|
||||
}
|
||||
|
||||
// Get title based on page type
|
||||
if ( is_home() ) {
|
||||
$title = us_translate( 'All Posts' );
|
||||
} elseif ( is_search() ) {
|
||||
$title = sprintf( us_translate( 'Search results for “%s”' ), esc_attr( get_search_query() ) );
|
||||
} elseif ( is_author() ) {
|
||||
$title = sprintf( us_translate( 'Posts by %s' ), get_the_author() );
|
||||
} elseif ( is_tag() ) {
|
||||
$title = single_tag_title( '', FALSE );
|
||||
} elseif ( is_category() ) {
|
||||
$title = single_cat_title( '', FALSE );
|
||||
} elseif ( is_tax() ) {
|
||||
$title = single_term_title( '', FALSE );
|
||||
} elseif ( function_exists( 'is_shop' ) AND is_shop() ) {
|
||||
$title = woocommerce_page_title( '', FALSE );
|
||||
} elseif ( is_archive() ) {
|
||||
$post_type = get_post_type_object( get_post_type() );
|
||||
if ( isset( $post_type->labels->name ) ) {
|
||||
$title = $post_type->labels->name;
|
||||
}
|
||||
} elseif ( is_404() ) {
|
||||
$title = us_translate( 'Page not found' );
|
||||
} else {
|
||||
$title = get_the_title();
|
||||
}
|
||||
// Output the element
|
||||
if ( $title != '' ) {
|
||||
$output .= '<' . $tag . ' class="w-page-title' . $classes . '"';
|
||||
$output .= $el_id . $schema_heading . $inline_css;
|
||||
$output .= '>';
|
||||
$output .= $title;
|
||||
$output .= '</' . $tag . '>';
|
||||
}
|
||||
if ( $description AND term_description() ) {
|
||||
$output .= '<div class="w-term-description">' . term_description() . '</div>';
|
||||
}
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_person
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $image int Photo (from WP Media Library)
|
||||
* @param $image_hover int Photo on hover (from WP Media Library)
|
||||
* @param $name string Name
|
||||
* @param $role string Role
|
||||
* @param $link string Link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
|
||||
* @param $layout string Layout: 'simple' / 'simple_circle' / 'circle' / 'square' / 'card' / 'modern' / 'trendy'
|
||||
* @param $effect string Photo Effect: 'none' / 'sepia' / 'bw' / 'faded' / 'colored'
|
||||
* @param $email string Email
|
||||
* @param $facebook string Facebook link
|
||||
* @param $twitter string Twitter link
|
||||
* @param $google_plus string Google link
|
||||
* @param $linkedin string LinkedIn link
|
||||
* @param $skype string Skype link
|
||||
* @param $custom_icon string Custom icon
|
||||
* @param $custom_link string Custom link
|
||||
* @param $el_class string Extra class name
|
||||
*/
|
||||
|
||||
$classes = $img_html = $links_html = $link_opener = $link_closer = '';
|
||||
|
||||
// Generate schema.org markup
|
||||
$schema_base = $schema_image = $schema_name = $schema_job = $schema_desc = '';
|
||||
if ( us_get_option( 'schema_markup' ) ) {
|
||||
$schema_base = ' itemscope itemtype="https://schema.org/Person"';
|
||||
$schema_image = ' itemprop="image"';
|
||||
$schema_name = ' itemprop="name"';
|
||||
$schema_job = ' itemprop="jobTitle"';
|
||||
$schema_desc = ' itemprop="description"';
|
||||
}
|
||||
|
||||
$classes .= ' layout_' . $layout;
|
||||
if ( $effect != 'none' ) {
|
||||
$classes .= ' effect_' . $effect;
|
||||
}
|
||||
if ( ! empty( $content ) ) {
|
||||
$classes .= ' with_desc';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
if ( is_numeric( $image ) ) {
|
||||
$img_html = us_get_attachment_image( intval( $image ), $img_size );
|
||||
} elseif ( ! empty( $image ) ) {
|
||||
// Direct link to image is set in the shortcode attribute
|
||||
$img_html = '<img src="' . $image . '" alt="' . esc_attr( $name ) . '">';
|
||||
}
|
||||
|
||||
if ( is_numeric( $image_hover ) ) {
|
||||
$img_hover = wp_get_attachment_image_url( intval( $image_hover ), $img_size );
|
||||
if ( $img_hover !== FALSE ) {
|
||||
$img_html .= '<div class="img_hover" style="background-image:url(' . $img_hover . ')"></div>';
|
||||
}
|
||||
} elseif ( ! empty( $image_hover ) ) {
|
||||
// Direct link to image is set in the shortcode attribute
|
||||
$img_html .= '<div class="img_hover" style="background-image:url(' . $image_hover . ')"></div>';
|
||||
}
|
||||
|
||||
if ( ! empty( $email ) ) {
|
||||
$links_html .= '<a class="w-person-links-item type_email" href="mailto:' . esc_attr( $email ) . '"><i></i></a>';
|
||||
}
|
||||
if ( ! empty( $facebook ) ) {
|
||||
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $facebook ) . '" target="_blank"><i class="fab fa-facebook-f"></i></a>';
|
||||
}
|
||||
if ( ! empty( $twitter ) ) {
|
||||
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $twitter ) . '" target="_blank"><i class="fab fa-twitter"></i></a>';
|
||||
}
|
||||
if ( ! empty( $google_plus ) ) {
|
||||
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $google_plus ) . '" target="_blank"><i class="fab fa-google-plus-g"></i></a>';
|
||||
}
|
||||
if ( ! empty( $linkedin ) ) {
|
||||
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $linkedin ) . '" target="_blank"><i class="fab fa-linkedin-in"></i></a>';
|
||||
}
|
||||
if ( ! empty( $skype ) ) {
|
||||
// Skype link may be some http(s): or skype: link. If protocol is not set, adding "skype:"
|
||||
$skype_url = $skype;
|
||||
if ( strpos( $skype_url, ':' ) === FALSE ) {
|
||||
$skype_url = 'skype:' . esc_attr( $skype_url );
|
||||
}
|
||||
$links_html .= '<a class="w-person-links-item" href="' . $skype_url . '"><i class="fab fa-skype"></i></a>';
|
||||
}
|
||||
if ( ! empty( $custom_icon ) AND ! empty( $custom_link ) ) {
|
||||
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $custom_link ) . '" target="_blank">' . us_prepare_icon_tag( $custom_icon ) . '</a>';
|
||||
}
|
||||
if ( ! empty( $links_html ) ) {
|
||||
$classes .= ' with_socials';
|
||||
$links_html = '<div class="w-person-links"><div class="w-person-links-list">' . $links_html . '</div></div>';
|
||||
}
|
||||
|
||||
// Link
|
||||
$link_atts = us_generate_link_atts( $link );
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$link_opener = '<a class="w-person-link"' . $link_atts . '>';
|
||||
$link_closer = '</a>';
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-person' . $classes . '"' . $el_id . $schema_base . '>';
|
||||
$output .= '<div class="w-person-image">';
|
||||
$output .= $link_opener . $img_html . $link_closer;
|
||||
if ( in_array( $layout, array( 'square', 'circle' ) ) ) {
|
||||
$output .= $links_html;
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="w-person-content">';
|
||||
if ( ! empty( $name ) ) {
|
||||
$output .= $link_opener . '<h4 class="w-person-name"' . $schema_name . '><span>' . $name . '</span></h4>' . $link_closer;
|
||||
}
|
||||
if ( ! empty( $role ) ) {
|
||||
$output .= '<div class="w-person-role"' . $schema_job . '>' . $role . '</div>';
|
||||
}
|
||||
if ( $layout == 'trendy' AND ( ! empty( $content ) OR ! empty( $links_html ) ) ) {
|
||||
$output .= '</div><div class="w-person-content-alt">' . $link_opener . $link_closer;
|
||||
}
|
||||
if ( ! in_array( $layout, array( 'square', 'circle' ) ) ) {
|
||||
$output .= $links_html;
|
||||
}
|
||||
if ( ! empty( $content ) ) {
|
||||
$output .= '<div class="w-person-description"' . $schema_desc . '>' . do_shortcode( $content ) . '</div>';
|
||||
}
|
||||
$output .= '</div></div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Popup
|
||||
*/
|
||||
|
||||
$popup_classes = ' animation_' . $animation;
|
||||
|
||||
$classes = ' align_' . $align;
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
|
||||
// Output the trigger
|
||||
$output = '<div class="w-popup' . $classes . '" ' . $el_id . '>';
|
||||
|
||||
// Trigger
|
||||
if ( $show_on == 'image' AND ! empty( $image ) AND ( $image_html = wp_get_attachment_image( $image, $image_size ) ) ) {
|
||||
$output .= '<a href="javascript:void(0)" class="w-popup-trigger type_image">' . $image_html . '</a>';
|
||||
} elseif ( $show_on == 'load' ) {
|
||||
$output .= '<span class="w-popup-trigger type_load" data-delay="' . intval( $show_delay ) . '"></span>';
|
||||
} elseif ( $show_on == 'selector' ) {
|
||||
$output .= '<span class="w-popup-trigger type_selector" data-selector="' . esc_attr( $trigger_selector ) . '"></span>';
|
||||
} else/*if ( $show_on == 'btn' )*/ {
|
||||
|
||||
if ( ! isset( $btn_size ) OR trim( $btn_size ) == ( us_get_option( 'body_fontsize' ) ) ) {
|
||||
$btn_size = '';
|
||||
}
|
||||
$btn_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $btn_size,
|
||||
)
|
||||
);
|
||||
|
||||
// Icon
|
||||
$icon_html = $btn_classes = '';
|
||||
if ( ! empty( $btn_icon ) ) {
|
||||
$icon_html = us_prepare_icon_tag( $btn_icon );
|
||||
$btn_classes = ' icon_at' . $btn_iconpos;
|
||||
}
|
||||
$output .= '<div class="w-btn-wrapper">';
|
||||
$output .= '<a href="javascript:void(0)" class="w-popup-trigger type_btn w-btn us-btn-style_' . $btn_style . $btn_classes . '"' . $btn_inline_css . '>';
|
||||
if ( is_rtl() ) {
|
||||
$btn_iconpos = ( $btn_iconpos == 'left' ) ? 'right' : 'left';
|
||||
}
|
||||
if ( $btn_iconpos == 'left' ) {
|
||||
$output .= $icon_html;
|
||||
}
|
||||
$output .= '<span class="w-btn-label">' . trim( strip_tags( $btn_label, '<br>' ) ) . '</span>';
|
||||
if ( $btn_iconpos == 'right' ) {
|
||||
$output .= $icon_html;
|
||||
}
|
||||
$output .= '</a>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
// Overlay
|
||||
$output .= '<div class="w-popup-overlay"';
|
||||
$output .= us_prepare_inline_css(
|
||||
array(
|
||||
'background' => $overlay_bgcolor,
|
||||
)
|
||||
);
|
||||
$output .= '></div>';
|
||||
|
||||
// Popup title
|
||||
$output_title = '';
|
||||
if ( ! empty( $title ) ) {
|
||||
$popup_classes .= ' with_title';
|
||||
|
||||
$output_title .= '<div class="w-popup-box-title"';
|
||||
$output_title .= us_prepare_inline_css(
|
||||
array(
|
||||
'color' => $title_textcolor,
|
||||
'background' => $title_bgcolor,
|
||||
)
|
||||
);
|
||||
$output_title .= '>' . esc_html( $title ) . '</div>';
|
||||
} else {
|
||||
$popup_classes .= ' without_title';
|
||||
}
|
||||
|
||||
// The Popup itself
|
||||
$output .= '<div class="w-popup-wrap">';
|
||||
$output .= '<div class="w-popup-box' . $popup_classes . '"';
|
||||
$output .= us_prepare_inline_css(
|
||||
array(
|
||||
'border-radius' => $popup_border_radius,
|
||||
'width' => $popup_width,
|
||||
)
|
||||
);
|
||||
$output .= '><div class="w-popup-box-h">';
|
||||
$output .= $output_title;
|
||||
|
||||
// Popup content
|
||||
$output .= '<div class="w-popup-box-content"';
|
||||
$output .= us_prepare_inline_css(
|
||||
array(
|
||||
'padding' => $popup_padding,
|
||||
'background' => $content_bgcolor,
|
||||
'color' => $content_textcolor,
|
||||
)
|
||||
);
|
||||
$output .= '>';
|
||||
$output .= do_shortcode( wpautop( $content ) );
|
||||
$output .= '</div>';
|
||||
$output .= '</div></div>'; // .w-popup-box
|
||||
|
||||
// Popup closer
|
||||
$output .= '<div class="w-popup-closer"';
|
||||
$output .= us_prepare_inline_css(
|
||||
array(
|
||||
'background' => $content_bgcolor,
|
||||
'color' => $content_textcolor,
|
||||
)
|
||||
);
|
||||
$output .= '></div>';
|
||||
|
||||
$output .= '</div>'; // .w-popup-wrap
|
||||
$output .= '</div>'; // .w-popup
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Post Author element
|
||||
*
|
||||
* @var $link string Link type: 'post' / 'author' / 'custom' / 'none'
|
||||
* @var $custom_link array
|
||||
* @var $color string Custom color
|
||||
* @var $icon string Icon name
|
||||
* @var $design_options array
|
||||
*
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
if ( $us_elm_context == 'grid_term' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
if ( $color_link ) {
|
||||
$classes .= ' color_link_inherit';
|
||||
}
|
||||
$classes .= ' vcard author'; // needed for Google structured data
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
$author_id = get_the_author_meta( 'ID' );
|
||||
|
||||
// Prepare inline CSS for shortcode
|
||||
$inline_css = '';
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Generate anchor semantics
|
||||
$link_start_tag = $link_end_tag = '';
|
||||
if ( $link === 'author_page' ) {
|
||||
$link_atts = ' href="' . get_author_posts_url( $author_id, get_the_author_meta( 'user_nicename' ) ) . '"';
|
||||
} elseif ( $link === 'author_website' ) {
|
||||
$link_atts = ' href="' . get_the_author_meta('url') . '" target="_blank" rel="nofollow"';
|
||||
} elseif ( $link === 'post' ) {
|
||||
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
|
||||
} elseif ( $link === 'custom' ) {
|
||||
$link_atts = us_generate_link_atts( $custom_link );
|
||||
} else {
|
||||
$link_atts = '';
|
||||
}
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$link_start_tag = '<a class="fn"' . $link_atts . '>';
|
||||
$link_end_tag = '</a>';
|
||||
}
|
||||
|
||||
if ( $avatar ) {
|
||||
$classes .= ' with_ava avapos_' . $avatar_pos;
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-post-elm post_author' . $classes . '"' . $inline_css . $el_id . '>';
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
|
||||
// Avatar
|
||||
if ( $avatar ) {
|
||||
$args = array(
|
||||
'force_display' => TRUE, // always show avatar
|
||||
);
|
||||
$output .= $link_start_tag;
|
||||
$output .= '<div class="post-author-ava"' . us_prepare_inline_css( array( 'font-size' => $avatar_width ) ) . '>';
|
||||
$avatar_width = intval( $avatar_width );
|
||||
$output .= get_avatar( $author_id, $avatar_width, NULL, '', $args );
|
||||
$output .= '</div>';
|
||||
$output .= $link_end_tag;
|
||||
}
|
||||
|
||||
$output .= '<div class="post-author-meta">';
|
||||
|
||||
// Name
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '<a class="post-author-name fn"' . $link_atts . '>' . get_the_author() . '</a>';
|
||||
} else {
|
||||
$output .= '<div class="post-author-name">' . get_the_author() . '</div>';
|
||||
}
|
||||
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '</a>';
|
||||
}
|
||||
|
||||
// Posts count
|
||||
if ( $posts_count ) {
|
||||
$author_posts_amount = count_user_posts( $author_id, 'post', TRUE );
|
||||
$output .= '<div class="post-author-posts">';
|
||||
$output .= sprintf( _n( '%s post', '%s posts', $author_posts_amount, 'us' ), $author_posts_amount );
|
||||
$output .= '</div>';
|
||||
}
|
||||
// Website
|
||||
if ( $website AND $website_url = get_the_author_meta( 'url' ) ) {
|
||||
$output .= '<a class="post-author-website" href="' . $website_url . '" target="_blank" rel="nofollow">';
|
||||
$output .= $website_url;
|
||||
$output .= '</a>';
|
||||
}
|
||||
// Bio Info
|
||||
if ( $info AND $info_text = get_the_author_meta( 'description' ) ) {
|
||||
$output .= '<div class="post-author-info">' . $info_text . '</div>';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Post Comments
|
||||
*/
|
||||
|
||||
if ( get_post_format() == 'link' OR ( is_admin() AND ( ! defined( 'DOING_AJAX' ) OR ! DOING_AJAX ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Exclude 'comments_template' layout for Grid context
|
||||
if ( $us_elm_context != 'shortcode' ) {
|
||||
$layout = 'amount';
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$classes .= ' layout_' . $layout;
|
||||
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Prepare inline CSS for shortcode
|
||||
$inline_css = '';
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( $layout == 'amount' ) {
|
||||
|
||||
// Link
|
||||
if ( $link === 'post' ) {
|
||||
if ( get_post_type() == 'product' ) {
|
||||
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '#reviews"';
|
||||
} else {
|
||||
$link_atts = ' href="' . get_comments_link() . '"';
|
||||
}
|
||||
} elseif ( $link === 'custom' ) {
|
||||
$link_atts = us_generate_link_atts( $custom_link );
|
||||
} else {
|
||||
$link_atts = '';
|
||||
}
|
||||
if ( $color_link ) {
|
||||
$classes .= ' color_link_inherit';
|
||||
}
|
||||
|
||||
// Define no comments indication
|
||||
$comments_none = '0';
|
||||
if ( ! $number ) {
|
||||
$classes .= ' with_word';
|
||||
$comments_none = us_translate( 'No Comments' );
|
||||
}
|
||||
|
||||
$comments_number = get_comments_number();
|
||||
|
||||
// "Hide this element if no comments"
|
||||
if ( $hide_zero AND empty( $comments_number ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-post-elm post_comments' . $classes . '"' . $inline_css . $el_id . '>';
|
||||
|
||||
if ( $layout == 'comments_template' ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
|
||||
ob_start();
|
||||
comments_template();
|
||||
$output .= ob_get_clean();
|
||||
|
||||
} else {
|
||||
if ( ! empty( $icon ) ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '<a class="smooth-scroll"' . $link_atts . '>';
|
||||
}
|
||||
|
||||
if ( class_exists( 'woocommerce' ) AND get_post_type() == 'product' ) {
|
||||
$output .= sprintf( us_translate_n( '%s customer review', '%s customer reviews', $comments_number, 'woocommerce' ), '<span class="count">' . esc_html( $comments_number ) . '</span>' );
|
||||
} else {
|
||||
ob_start();
|
||||
$comments_label = sprintf( us_translate_n( '%s <span class="screen-reader-text">Comment</span>', '%s <span class="screen-reader-text">Comments</span>', $comments_number ), $comments_number );
|
||||
comments_number( $comments_none, $comments_label, $comments_label );
|
||||
$output .= ob_get_clean();
|
||||
}
|
||||
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Post Content element
|
||||
*
|
||||
* @var $type string Show: 'excerpt_only' / 'excerpt_content' / 'part_content' / 'full_content'
|
||||
* @var $length int Amount of words
|
||||
* @var $design_options array
|
||||
*
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
if ( get_post_format() == 'link' OR ( is_admin() AND ( ! defined( 'DOING_AJAX' ) OR ! DOING_AJAX ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate amount of usage the element with full content to avoid infinite recursion
|
||||
global $us_full_content_stack;
|
||||
if ( isset( $us_full_content_stack ) AND $us_full_content_stack > 10 AND $type == 'full_content' ) {
|
||||
die( '<h5 style="text-align:center; margin-top:20vh; padding:5%;">Post Content outputs itself infinitely. Fix layout of this page.</h5>' );
|
||||
}
|
||||
|
||||
// Find Post Image element with media preview in Page Block
|
||||
global $us_page_block_ids;
|
||||
$strip_from_the_content = FALSE;
|
||||
if ( ! empty( $us_page_block_ids ) ) {
|
||||
$page_block = get_post( $us_page_block_ids[0] );
|
||||
|
||||
// Find Post Image element
|
||||
if ( preg_match( '~\[us_post_image.+media_preview="1".+?\]~', $page_block->post_content ) ) {
|
||||
$strip_from_the_content = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
us_add_to_page_block_ids( get_the_ID() );
|
||||
|
||||
if ( $type == 'full_content' ) {
|
||||
$us_full_content_stack = ( empty( $us_full_content_stack ) ) ? 1 : $us_full_content_stack + 1;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Prepare inline CSS for shortcode
|
||||
$inline_css = '';
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Default case
|
||||
$the_content = '';
|
||||
|
||||
// Get term description as "Excerpt" for Grid terms
|
||||
if ( $us_elm_context == 'grid_term' ) {
|
||||
global $us_grid_term;
|
||||
$the_content = $us_grid_term->description;
|
||||
|
||||
// Get term description as "Excerpt" for archive pages
|
||||
} elseif ( $us_elm_context == 'shortcode' AND ( is_category() OR is_tag() OR is_tax() ) ) {
|
||||
if ( $type == 'excerpt_only' ) { // for "Excerpt only" case
|
||||
$the_content = term_description();
|
||||
}
|
||||
|
||||
// Post excerpt is not empty
|
||||
} elseif ( in_array( $type, array( 'excerpt_content', 'excerpt_only' ) ) AND has_excerpt() ) {
|
||||
$the_content = apply_filters( 'the_excerpt', get_the_excerpt() );
|
||||
|
||||
// Either the excerpt is empty and we show the content instead or we show the content only
|
||||
} elseif ( in_array( $type, array( 'excerpt_content', 'part_content', 'full_content' ) ) ) {
|
||||
global $us_is_search_page_block;
|
||||
|
||||
if ( get_post_type() == 'attachment' ) {
|
||||
$the_content = get_the_content();
|
||||
} else {
|
||||
|
||||
// Get WooCommerce Shop Page content
|
||||
if ( function_exists( 'is_shop' ) AND is_shop() ) {
|
||||
if ( is_search() ) {
|
||||
$the_content = '';
|
||||
} else {
|
||||
$shop_page = get_post( wc_get_page_id( 'shop' ) );
|
||||
if ( $shop_page ) {
|
||||
$the_content = $shop_page->post_content;
|
||||
}
|
||||
}
|
||||
|
||||
} elseif ( isset( $us_is_search_page_block ) AND $us_is_search_page_block AND $us_elm_context == 'shortcode' ) {
|
||||
$us_page = get_post( us_get_option( 'search_page' ) );
|
||||
if ( $us_page ) {
|
||||
$us_page = get_post( apply_filters( 'wpml_object_id', $us_page->ID, 'page', TRUE ) );
|
||||
$the_content = $us_page->post_content;
|
||||
}
|
||||
$us_is_search_page_block = FALSE;
|
||||
|
||||
} else {
|
||||
$the_content = get_the_content();
|
||||
}
|
||||
|
||||
// Force fullwidth for all [vc_row] if set
|
||||
if ( $force_fullwidth_rows ) {
|
||||
$the_content = str_replace( '[vc_row]', '[vc_row width="full"]', $the_content );
|
||||
$the_content = str_replace( '[vc_row ', '[vc_row width="full" ', $the_content );
|
||||
}
|
||||
|
||||
// Remove video, audio, gallery from the content for relevant post formats
|
||||
us_get_post_preview( $the_content, $strip_from_the_content );
|
||||
|
||||
$the_content = apply_filters( 'the_content', $the_content );
|
||||
|
||||
// Limit the amount of words for the corresponding types
|
||||
if ( in_array( $type, array( 'excerpt_content', 'part_content' ) ) AND intval( $length ) > 0 ) {
|
||||
$the_content = wp_trim_words( $the_content, intval( $length ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Schema.org markup
|
||||
$schema_markup = '';
|
||||
if ( us_get_option( 'schema_markup' ) AND $us_elm_context == 'shortcode' ) {
|
||||
$schema_markup = ' itemprop="text"';
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-post-elm post_content' . $classes . '"' . $inline_css . $el_id . $schema_markup . '>';
|
||||
$output .= $the_content;
|
||||
$output .= '</div>';
|
||||
|
||||
if ( $type == 'full_content' ) {
|
||||
$us_full_content_stack --;
|
||||
}
|
||||
us_remove_from_page_block_ids();
|
||||
|
||||
// Output empty string for "Link" post format OR when no content
|
||||
// Do not remove to avoid bug https://github.com/upsolution/wp/issues/407
|
||||
if ( $the_content == '' ) {
|
||||
return;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Post Custom Field element
|
||||
*
|
||||
* @var $key string custom field key
|
||||
* @var $link string Link type: 'post' / 'custom' / 'none'
|
||||
* @var $custom_link array
|
||||
* @var $type string 'text' / 'image'
|
||||
* @var $thumbnail_size string Image WordPress size
|
||||
* @var $icon string Icon name
|
||||
* @var $design_options array
|
||||
*
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
$postID = get_the_ID();
|
||||
if ( ! $postID ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
if ( $color_link ) {
|
||||
$classes .= ' color_link_inherit';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
$tag = 'div';
|
||||
$type = 'text';
|
||||
|
||||
// Force "image" type for relevant meta keys
|
||||
if ( $key == 'us_tile_additional_image' ) {
|
||||
$type = 'image';
|
||||
}
|
||||
|
||||
// Force "image" type for ACF images fields
|
||||
if ( function_exists( 'acf_get_fields' ) ) {
|
||||
$fields = acf_get_fields( '' ); // empty string to get all fields
|
||||
foreach ( $fields as $field ) {
|
||||
if ( $field['name'] == $key AND $field['type'] == 'image' ) {
|
||||
$type = 'image';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$classes .= ' type_' . $type;
|
||||
|
||||
// Prepare inline CSS for shortcode
|
||||
$inline_css = '';
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
), TRUE, $tag
|
||||
);
|
||||
}
|
||||
|
||||
// Retrieve meta key value
|
||||
if ( $key != 'custom' ) {
|
||||
$value = get_post_meta( $postID, $key, TRUE );
|
||||
} elseif ( ! empty( $custom_key ) ) {
|
||||
$value = get_post_meta( $postID, $custom_key, TRUE );
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
|
||||
// Don't output the element, when its value is empty
|
||||
if ( ( $hide_empty AND $value == '' ) OR is_object( $value ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate image semantics
|
||||
if ( $type == 'image' ) {
|
||||
$value = intval( $value );
|
||||
|
||||
if ( $value ) {
|
||||
global $us_grid_img_size;
|
||||
if ( ! empty( $us_grid_img_size ) AND $us_grid_img_size != 'default' ) {
|
||||
$thumbnail_size = $us_grid_img_size;
|
||||
}
|
||||
|
||||
$image = wp_get_attachment_image_src( $value, $thumbnail_size );
|
||||
|
||||
if ( is_array( $image ) ) {
|
||||
$value = us_get_attachment_image( $value, $thumbnail_size );
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
} elseif ( is_array( $value ) ) {
|
||||
$value = implode( ' ', $value );
|
||||
} else {
|
||||
$value = wpautop( $value ); // add <p> and <br> if custom field has WYSIWYG
|
||||
}
|
||||
|
||||
// Link
|
||||
if ( $link === 'post' ) {
|
||||
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
|
||||
} elseif ( $link === 'custom' ) {
|
||||
$link_atts = us_generate_link_atts( $custom_link );
|
||||
} else {
|
||||
$link_atts = '';
|
||||
}
|
||||
|
||||
// Generate semantics for Testimonial Rating
|
||||
if ( $key == 'us_testimonial_rating' ) {
|
||||
$rating_value = (int) strip_tags( $value );
|
||||
|
||||
if ( $rating_value == 0 ) {
|
||||
return;
|
||||
} else {
|
||||
$value = '<div class="w-testimonial-rating">';
|
||||
for ( $i = 1; $i <= $rating_value; $i ++ ) {
|
||||
$value .= '<i></i>';
|
||||
}
|
||||
$value .= '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
$text_before = ( trim( $text_before ) != '' ) ? '<span class="w-post-elm-before">' . trim( $text_before ) . ' </span>' : '';
|
||||
|
||||
// Output the element
|
||||
$output = '<' . $tag . ' class="w-post-elm post_custom_field' . $classes . '"' . $inline_css . $el_id . '>';
|
||||
if ( ! empty( $icon ) ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
$output .= $text_before;
|
||||
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '<a' . $link_atts . '>';
|
||||
}
|
||||
$output .= $value;
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '</a>';
|
||||
}
|
||||
$output .= '</' . $tag . '>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Post Date element
|
||||
*
|
||||
* @var $type string Date type: 'published' / 'modified'
|
||||
* @var $format string Date format selected from preset
|
||||
* @var $format_custom string Date custom format
|
||||
* @var $icon string Icon name
|
||||
* @var $tag string 'h1' / 'h2' / 'h3' / 'h4' / 'h5' / 'h6' / 'p' / 'div'
|
||||
* @var $color string Custom color
|
||||
* @var $design_options array
|
||||
*
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
if ( $us_elm_context == 'grid_term' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
|
||||
// Classes for Google structured data
|
||||
$classes .= ' entry-date';
|
||||
if ( $type == 'modified' ) {
|
||||
$classes .= ' updated';
|
||||
} else {
|
||||
$classes .= ' published';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
$tag = 'time';
|
||||
$elm_attr = '';
|
||||
|
||||
// Prepare inline CSS for shortcode
|
||||
$inline_css = '';
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
),
|
||||
$style_attr = TRUE,
|
||||
$tag
|
||||
);
|
||||
}
|
||||
|
||||
$smart_date = FALSE;
|
||||
// Generate date format
|
||||
if ( $format == 'default' ) {
|
||||
$format = get_option( 'date_format' );
|
||||
} elseif ( $format == 'custom' ) {
|
||||
$format = $format_custom;
|
||||
} elseif ( $format == 'smart' ) {
|
||||
$format = 'U';
|
||||
$smart_date = TRUE;
|
||||
}
|
||||
|
||||
if ( $type == 'modified' ) {
|
||||
$date = get_the_modified_date( $format );
|
||||
|
||||
$elm_attr .= ' datetime="' . get_the_modified_date( 'c' ) . '"'; // needed datetime attribute for <time> tag
|
||||
if ( $smart_date ) {
|
||||
$elm_attr .= ' title="' . sprintf( us_translate( '%1$s at %2$s' ), get_the_modified_date( 'j F Y' ), get_the_modified_date( 'H:i:s e' ) ) . '"';
|
||||
}
|
||||
} else {
|
||||
$date = get_the_date( $format );
|
||||
|
||||
$elm_attr .= ' datetime="' . get_the_date( 'c' ) . '"'; // needed datetime attribute for <time> tag
|
||||
if ( $smart_date ) {
|
||||
$elm_attr .= ' title="' . sprintf( us_translate( '%1$s at %2$s' ), get_the_date( 'j F Y' ), get_the_date( 'H:i:s e' ) ) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
// Generate date in smart format
|
||||
if ( $smart_date ) {
|
||||
$date = us_get_smart_date( $date );
|
||||
}
|
||||
|
||||
// Schema.org markup
|
||||
if ( us_get_option( 'schema_markup' ) AND $us_elm_context == 'shortcode' ) {
|
||||
$elm_attr .= ( $type == 'modified' ) ? ' itemprop="dateModified"' : ' itemprop="datePublished"';
|
||||
}
|
||||
|
||||
$text_before = ( trim( $text_before ) != '' ) ? '<span class="w-post-elm-before">' . trim( $text_before ) . ' </span>' : '';
|
||||
|
||||
// Output the element
|
||||
$output = '<' . $tag . ' class="w-post-elm post_date' . $classes . '"';
|
||||
$output .= $inline_css . $el_id . $elm_attr;
|
||||
$output .= '>';
|
||||
if ( ! empty( $icon ) ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
$output .= $text_before;
|
||||
$output .= $date;
|
||||
$output .= '</' . $tag . '>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Post Image element
|
||||
*
|
||||
* @var $thumbnail_size string Image WordPress size
|
||||
* @var $placeholder bool Use placeholder if post has no thumbnail?
|
||||
* @var $media_preview bool Show media preview for video and gallery posts?
|
||||
* @var $link string Link type: 'post' / 'custom' / 'none'
|
||||
* @var $custom_link array
|
||||
* @var $design_options array
|
||||
*
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
if ( is_admin() AND ( ! defined( 'DOING_AJAX' ) OR ! DOING_AJAX ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $us_grid_img_size, $_wp_additional_image_sizes, $us_post_img_ratio, $us_post_slider_size;
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$classes .= ( isset( $circle ) AND $circle ) ? ' as_circle' : '';
|
||||
$classes .= ( isset( $stretch ) AND $stretch ) ? ' stretched' : '';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Overwrite thumbnail_size from [us_grid] shortcode if set
|
||||
if ( ! empty( $us_grid_img_size ) AND $us_grid_img_size != 'default' ) {
|
||||
$thumbnail_size = $us_grid_img_size;
|
||||
}
|
||||
|
||||
// Calculate aspect ratio for media preview and for placeholder
|
||||
if ( isset( $_wp_additional_image_sizes[ $thumbnail_size ] ) AND $_wp_additional_image_sizes[ $thumbnail_size ]['width'] != 0 AND $_wp_additional_image_sizes[ $thumbnail_size ]['height'] != 0 ) {
|
||||
$us_post_img_ratio = number_format( $_wp_additional_image_sizes[ $thumbnail_size ]['height'] / $_wp_additional_image_sizes[ $thumbnail_size ]['width'] * 100, 4 );
|
||||
}
|
||||
|
||||
// Link
|
||||
if ( $link === 'post' ) {
|
||||
// Terms of selected taxonomy in Grid
|
||||
if ( $us_elm_context == 'grid_term' ) {
|
||||
global $us_grid_term;
|
||||
$link_atts = ' href="' . get_term_link( $us_grid_term ) . '"';
|
||||
} else {
|
||||
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
|
||||
}
|
||||
|
||||
} elseif ( $link === 'custom' ) {
|
||||
$link_atts = us_generate_link_atts( $custom_link );
|
||||
} else {
|
||||
$link_atts = '';
|
||||
}
|
||||
|
||||
$_post_preview = '';
|
||||
|
||||
// Output image of taxonomy term (works for WooCommerce product categories)
|
||||
if ( $us_elm_context == 'grid_term' ) {
|
||||
global $us_grid_term;
|
||||
$term_thumbnail_id = get_term_meta( $us_grid_term->term_id, 'thumbnail_id', TRUE );
|
||||
if ( $term_thumbnail_id ) {
|
||||
$_post_preview = wp_get_attachment_image( $term_thumbnail_id, $thumbnail_size );
|
||||
}
|
||||
}
|
||||
|
||||
// Generate media preview
|
||||
if ( $_post_preview == '' AND $media_preview AND ! post_password_required() ) {
|
||||
if ( get_post_type() == 'product' ) { // for products with gallery
|
||||
$postID = get_the_ID();
|
||||
$product_images = get_post_meta( $postID, '_product_image_gallery', TRUE );
|
||||
if ( $product_images ) {
|
||||
$slider_shortcode = '[us_image_slider ids="' . get_post_thumbnail_id() . ',' . $product_images . '" img_size="' . $thumbnail_size . '" arrows="hover"]';
|
||||
$_post_preview = do_shortcode( $slider_shortcode );
|
||||
}
|
||||
} else { // for posts with Video, Audio, Gallery formats
|
||||
$us_post_slider_size = $thumbnail_size;
|
||||
$the_content = get_the_content();
|
||||
$_post_preview = us_get_post_preview( $the_content );
|
||||
}
|
||||
|
||||
if ( $_post_preview != '' ) {
|
||||
$classes .= ' media_preview'; // add CSS class for media preview
|
||||
$link_atts = ''; // remove link for media preview
|
||||
}
|
||||
}
|
||||
|
||||
// Output image of attachment post type
|
||||
if ( $_post_preview == '' AND get_post_type() == 'attachment' ) {
|
||||
$_post_preview = wp_get_attachment_image( get_the_ID(), $thumbnail_size );
|
||||
}
|
||||
|
||||
// Output Featured image
|
||||
if ( $_post_preview == '' AND has_post_thumbnail() ) {
|
||||
$_post_preview = get_the_post_thumbnail( get_the_ID(), $thumbnail_size );
|
||||
}
|
||||
|
||||
// Output the first image from the content of Gallery format
|
||||
if ( $_post_preview == '' AND get_post_format() == 'gallery' ) {
|
||||
$the_content = get_the_content();
|
||||
if ( preg_match( '~\[us_gallery.+?\]|\[us_image_slider.+?\]|\[gallery.+?\]~', $the_content, $matches ) ) {
|
||||
$gallery = preg_replace( '~(vc_gallery|us_gallery|gallery)~', 'us_image_slider', $matches[0] );
|
||||
preg_match( '~\[us_image_slider(.+?)\]~', $gallery, $matches2 );
|
||||
$shortcode_atts = shortcode_parse_atts( $matches2[1] );
|
||||
if ( ! empty( $shortcode_atts['ids'] ) ) {
|
||||
$ids = explode( ',', $shortcode_atts['ids'] );
|
||||
if ( count( $ids ) > 0 ) {
|
||||
$_post_preview = wp_get_attachment_image( $ids[0], $thumbnail_size );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output placeholder if enabled
|
||||
if ( $_post_preview == '' AND $placeholder ) {
|
||||
$classes .= ' with_placeholder';
|
||||
|
||||
// Use WooCommerce placeholder if enabled
|
||||
if ( ( $us_elm_context == 'grid_term' OR get_post_type() == 'product' ) AND function_exists( 'wc_placeholder_img_src' ) ) {
|
||||
$_post_preview = '<img src="' . wc_placeholder_img_src( $thumbnail_size ) . '" alt=""/>';
|
||||
} else {
|
||||
$_post_preview = '<div class="w-post-elm-placeholder" style="padding-bottom:' . ( empty( $us_post_img_ratio ) ? 100 : $us_post_img_ratio ) . '%;"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Don't output the element without any content
|
||||
if ( $_post_preview == '' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$output = '<div class="w-post-elm post_image' . $classes . '"' . $el_id . '>';
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '<a' . $link_atts . ' aria-label="' . esc_attr( get_the_title() ) . '">';
|
||||
}
|
||||
|
||||
$output .= $_post_preview;
|
||||
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '</a>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Post Prev/Next navigation
|
||||
*/
|
||||
|
||||
$prevnext = us_get_post_prevnext( $invert, $in_same_term, $taxonomy );
|
||||
|
||||
if ( empty( $prevnext ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = ' layout_' . $layout;
|
||||
$classes .= ( $invert ) ? ' inv_true' : ' inv_false';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-post-elm post_navigation' . $classes . '"' . $el_id . '>';
|
||||
|
||||
$item_order = 'first';
|
||||
foreach ( $prevnext as $key => $item ) {
|
||||
if ( ! empty( $prevnext[ $key ] ) ) {
|
||||
$tnail_id = get_post_thumbnail_id( $item['id'] );
|
||||
if ( $tnail_id ) {
|
||||
$image = wp_get_attachment_image( $tnail_id, 'thumbnail' );
|
||||
}
|
||||
if ( ! $tnail_id OR empty( $image ) ) {
|
||||
$image = '<div class="g-placeholder"></div>';
|
||||
}
|
||||
$output .= '<a class="post_navigation-item order_' . $item_order . ' to_' . $key . '" href="' . $item['link'] . '">';
|
||||
if ( $layout == 'sided' ) {
|
||||
$output .= '<div class="post_navigation-item-img">' . $image . '</div>';
|
||||
}
|
||||
$output .= '<div class="post_navigation-item-arrow"></div>';
|
||||
if ( $layout == 'simple' ) {
|
||||
$output .= '<div class="post_navigation-item-meta">' . $item['meta'] . '</div>';
|
||||
}
|
||||
$output .= '<div class="post_navigation-item-title"><span>' . $item['title'] . '</span></div>';
|
||||
$output .= '</a>';
|
||||
} else {
|
||||
$output .= '<div class="post_navigation-item order_' . $item_order . ' to_' . $key . '"></div>';
|
||||
}
|
||||
$item_order = 'second';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Post Taxonomy element
|
||||
*
|
||||
* @var $taxonomy_name string Taxonomy name
|
||||
* @var $link string Link type: 'post' / 'archive' / 'custom' / 'none'
|
||||
* @var $custom_link array
|
||||
* @var $color string Custom color
|
||||
* @var $icon string Icon name
|
||||
* @var $design_options array
|
||||
*
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
if ( empty( $taxonomy_name ) OR ! taxonomy_exists( $taxonomy_name ) OR ! is_object_in_taxonomy( get_post_type(), $taxonomy_name ) ) {
|
||||
return FALSE;
|
||||
}
|
||||
$terms = get_the_terms( get_the_ID(), $taxonomy_name );
|
||||
if ( ! is_array( $terms ) OR count( $terms ) == 0 ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$classes .= ' style_' . $style;
|
||||
if ( $color_link ) {
|
||||
$classes .= ' color_link_inherit';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Prepare inline CSS for shortcode
|
||||
$inline_css = '';
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Link
|
||||
if ( $link === 'post' ) {
|
||||
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
|
||||
} elseif ( $link === 'custom' ) {
|
||||
$link_atts = us_generate_link_atts( $custom_link );
|
||||
} else {
|
||||
$link_atts = '';
|
||||
}
|
||||
|
||||
$text_before = ( trim( $text_before ) != '' ) ? '<span class="w-post-elm-before">' . trim( $text_before ) . ' </span>' : '';
|
||||
|
||||
// Set Button Style class
|
||||
$btn_classes = '';
|
||||
if ( $style == 'badge' ) {
|
||||
$btn_classes = ' class="w-btn us-btn-style_' . $btn_style . '"';
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-post-elm post_taxonomy' . $classes . '"' . $inline_css . $el_id . '>';
|
||||
if ( ! empty( $icon ) ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
$output .= $text_before;
|
||||
if ( $style == 'badge' AND count( $terms ) > 1 ) {
|
||||
$output .= '<div class="w-post-elm-list">';
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
foreach ( $terms as $term ) {
|
||||
if ( $link === 'archive' ) {
|
||||
$link_atts = ' href="' . get_term_link( $term ) . '"';
|
||||
// Output "rel" attribute for Posts tags
|
||||
if ( $taxonomy_name == 'post_tag' ) {
|
||||
$link_atts .= ' rel="tag"';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '<a' . $btn_classes . $link_atts . '>' . $term->name . '</a>';
|
||||
} else {
|
||||
$output .= '<span' . $btn_classes . '>' . $term->name . '</span>';
|
||||
}
|
||||
// Output comma after anchor except the last one
|
||||
if ( $style != 'badge' AND $i != count( $terms ) ) {
|
||||
$output .= $separator;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ( $style == 'badge' AND count( $terms ) > 1 ) {
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Post Title element
|
||||
*
|
||||
* @var $link string Link type: 'post' / 'custom' / 'none'
|
||||
* @var $custom_link array
|
||||
* @var $tag string 'h1' / 'h2' / 'h3' / 'h4' / 'h5' / 'h6' / 'p' / 'div'
|
||||
* @var $color string Custom color
|
||||
* @var $icon string Icon name
|
||||
* @var $design_options array
|
||||
*
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
|
||||
if ( $align != 'none' ) {
|
||||
$classes .= ' align_' . $align;
|
||||
}
|
||||
if ( $us_elm_context == 'grid' AND get_post_type() == 'product' ) {
|
||||
$classes .= ' woocommerce-loop-product__title'; // needed for adding to cart
|
||||
} else {
|
||||
$classes .= ' entry-title'; // needed for Google structured data
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Prepare inline CSS for shortcode
|
||||
$inline_css = '';
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
), TRUE, $tag
|
||||
);
|
||||
}
|
||||
|
||||
// Link
|
||||
if ( $link === 'post' ) {
|
||||
// Terms of selected taxonomy in Grid
|
||||
if ( $us_elm_context == 'grid_term' ) {
|
||||
global $us_grid_term;
|
||||
$link_atts = ' href="' . get_term_link( $us_grid_term ) . '"';
|
||||
} else {
|
||||
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
|
||||
// Force opening in a new tab for "Link" post format
|
||||
if ( get_post_format() == 'link' ) {
|
||||
$link_atts .= ' target="_blank"';
|
||||
}
|
||||
}
|
||||
} elseif ( $link === 'custom' ) {
|
||||
$link_atts = us_generate_link_atts( $custom_link );
|
||||
} else {
|
||||
$link_atts = '';
|
||||
}
|
||||
|
||||
// Extra class for link color
|
||||
if ( ! empty( $link_atts ) AND $color_link ) {
|
||||
$classes .= ' color_link_inherit';
|
||||
}
|
||||
|
||||
// Schema.org markup
|
||||
$schema_markup = '';
|
||||
if ( us_get_option( 'schema_markup' ) AND $us_elm_context == 'shortcode' ) {
|
||||
$schema_markup = ' itemprop="headline"';
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<' . $tag . ' class="w-post-elm post_title' . $classes . '"' . $inline_css . $el_id . $schema_markup . '>';
|
||||
|
||||
if ( ! empty( $icon ) ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '<a' . $link_atts . '>';
|
||||
}
|
||||
|
||||
if ( $us_elm_context == 'grid_term' ) {
|
||||
global $us_grid_term;
|
||||
$output .= $us_grid_term->name;
|
||||
} else {
|
||||
$output .= get_the_title();
|
||||
}
|
||||
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '</a>';
|
||||
}
|
||||
$output .= '</' . $tag . '>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_pricing
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $style string Table style: '1' / '2'
|
||||
* @param $items string Pricing table items
|
||||
* @param $el_class string Extra class name
|
||||
*/
|
||||
|
||||
$classes = $items_html = '';
|
||||
|
||||
if ( empty( $items ) ) {
|
||||
$items = array();
|
||||
} else {
|
||||
$items = json_decode( urldecode( $items ), TRUE );
|
||||
if ( ! is_array( $items ) ) {
|
||||
$items = array();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $style ) ) {
|
||||
$classes .= ' style_' . $style;
|
||||
}
|
||||
if ( count( $items ) > 0 ) {
|
||||
$classes .= ' items_' . count( $items );
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
foreach ( $items as $index => $item ) {
|
||||
/**
|
||||
* Filtering the included items
|
||||
*
|
||||
* @param $item ['title'] string Item title
|
||||
* @param $item ['type'] string Item type: 'default' / 'featured'
|
||||
* @param $item ['price'] string Item price
|
||||
* @param $item ['substring'] string Price substring
|
||||
* @param $item ['features'] string Comma-separated list of features
|
||||
* @param $item ['btn_text'] string Button label
|
||||
* @param $item ['btn_link'] string Button link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
|
||||
* @param $item ['btn_style'] string Button Style
|
||||
* @param $item ['btn_size'] string Button size
|
||||
* @param $item ['btn_icon'] string Button icon
|
||||
* @param $item ['btn_iconpos'] string Icon position: 'left' / 'right'
|
||||
*/
|
||||
$item['type'] = ( isset( $item['type'] ) AND $item['type'] ) ? 'featured' : 'default';
|
||||
$item['btn_icon'] = ( isset( $item['btn_icon'] ) ) ? $item['btn_icon'] : '';
|
||||
$item['btn_link'] = ( isset( $item['btn_link'] ) ) ? $item['btn_link'] : '';
|
||||
$item['btn_iconpos'] = ( isset( $item['btn_iconpos'] ) ) ? $item['btn_iconpos'] : 'left';
|
||||
|
||||
$items_html .= '<div class="w-pricing-item type_' . $item['type'] . '"><div class="w-pricing-item-h"><div class="w-pricing-item-header">';
|
||||
if ( ! empty( $item['title'] ) ) {
|
||||
$items_html .= '<div class="w-pricing-item-title">' . $item['title'] . '</div>';
|
||||
}
|
||||
$items_html .= '<div class="w-pricing-item-price">';
|
||||
if ( ! empty( $item['price'] ) ) {
|
||||
$items_html .= $item['price'];
|
||||
}
|
||||
if ( ! empty( $item['substring'] ) ) {
|
||||
$items_html .= '<small>' . $item['substring'] . '</small>';
|
||||
}
|
||||
$items_html .= '</div></div>';
|
||||
if ( ! empty( $item['features'] ) ) {
|
||||
$items_html .= '<ul class="w-pricing-item-features">';
|
||||
$features = explode( "\n", trim( $item['features'] ) );
|
||||
foreach ( $features as $feature ) {
|
||||
$items_html .= '<li class="w-pricing-item-feature">' . $feature . '</li>';
|
||||
}
|
||||
$items_html .= '</ul>';
|
||||
}
|
||||
if ( ! empty( $item['btn_text'] ) ) {
|
||||
$btn_classes = $icon_html = '';
|
||||
|
||||
$btn_classes .= ' us-btn-style_' . $item['btn_style'];
|
||||
|
||||
if ( ! isset( $item['btn_size'] ) OR trim( $item['btn_size'] ) == ( us_get_option( 'body_fontsize' ) ) ) {
|
||||
$item['btn_size'] = '';
|
||||
}
|
||||
$btn_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $item['btn_size'],
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! empty( $item['btn_icon'] ) ) {
|
||||
$icon_html = us_prepare_icon_tag( $item['btn_icon'] );
|
||||
$btn_classes .= ' icon_at' . $item['btn_iconpos'];
|
||||
}
|
||||
$btn_link_atts = us_generate_link_atts( $item['btn_link'] );
|
||||
|
||||
$items_html .= '<div class="w-pricing-item-footer">';
|
||||
$items_html .= '<a class="w-btn' . $btn_classes . '"' . $btn_link_atts . $btn_inline_css . '>';
|
||||
$items_html .= ( $item['btn_iconpos'] == 'left' ) ? $icon_html : '';
|
||||
$items_html .= '<span class="w-btn-label">' . strip_tags( $item['btn_text'], '<br>' ) . '</span>';
|
||||
$items_html .= ( $item['btn_iconpos'] == 'right' ) ? $icon_html : '';
|
||||
$items_html .= '</a>';
|
||||
$items_html .= '</div>';
|
||||
}
|
||||
$items_html .= '</div></div>';
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-pricing' . $classes . '"' . $el_id . '>' . $items_html . '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* WooCommerce Product data
|
||||
*/
|
||||
|
||||
global $product;
|
||||
if ( ! class_exists( 'woocommerce' ) OR ! $product OR $us_elm_context == 'grid_term' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$classes .= isset( $type ) ? ( ' ' . $type ) : '';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Get product data value
|
||||
$value = '';
|
||||
if ( $type == 'price' ) {
|
||||
$value .= $product->get_price_html();
|
||||
} elseif ( $type == 'sku' AND $product->get_sku() ) {
|
||||
$value .= '<span class="w-post-elm-before">' . us_translate( 'SKU', 'woocommerce' ) . ': </span>';
|
||||
$value .= $product->get_sku();
|
||||
} elseif ( $type == 'rating' AND get_option( 'woocommerce_enable_reviews', 'yes' ) === 'yes' ) {
|
||||
$value .= wc_get_rating_html( $product->get_average_rating() );
|
||||
} elseif ( $type == 'sale_badge' AND $product->is_on_sale() ) {
|
||||
$classes .= ' onsale';
|
||||
$value .= strip_tags( $sale_text );
|
||||
} elseif ( $type == 'weight' AND $product->has_weight() ) {
|
||||
$value .= '<span class="w-post-elm-before">' . us_translate( 'Weight', 'woocommerce' ) . ': </span>';
|
||||
$value .= esc_html( wc_format_weight( $product->get_weight() ) );
|
||||
} elseif ( $type == 'dimensions' AND $product->has_dimensions() ) {
|
||||
$value .= '<span class="w-post-elm-before">' . us_translate( 'Dimensions', 'woocommerce' ) . ': </span>';
|
||||
$value .= esc_html( wc_format_dimensions( $product->get_dimensions( FALSE ) ) );
|
||||
} elseif ( $product_attribute_values = wc_get_product_terms( $product->get_id(), $type, array( 'fields' => 'names' ) ) ) {
|
||||
$value .= '<span class="w-post-elm-before">' . wc_attribute_label( $type ) . ': </span>';
|
||||
$value .= implode( ', ', $product_attribute_values );
|
||||
}
|
||||
|
||||
// Prepare inline CSS for shortcode
|
||||
$inline_css = '';
|
||||
if ( $us_elm_context == 'shortcode' ) {
|
||||
$inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $font,
|
||||
'font-weight' => $font_weight,
|
||||
'text-transform' => $text_transform,
|
||||
'font-style' => $font_style,
|
||||
'font-size' => $font_size,
|
||||
'line-height' => $line_height,
|
||||
), TRUE
|
||||
);
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-post-elm product_field' . $classes . '"';
|
||||
$output .= $el_id . $inline_css;
|
||||
$output .= '>';
|
||||
$output .= $value;
|
||||
$output .= '</div>';
|
||||
|
||||
if ( $value != '' ) {
|
||||
echo $output;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* WooCommerce Product gallery
|
||||
*
|
||||
* $type
|
||||
*
|
||||
*/
|
||||
global $product;
|
||||
if ( ! class_exists( 'woocommerce' ) OR ! $product ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Output the element
|
||||
echo '<div class="w-post-elm product_gallery' . $classes . '"' . $el_id . '>';
|
||||
wc_get_template( 'single-product/product-image.php' );
|
||||
echo '</div>';
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* WooCommerce Product ordering
|
||||
*
|
||||
* $type
|
||||
*
|
||||
*/
|
||||
if ( ! class_exists( 'woocommerce' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Output the element
|
||||
echo '<div class="w-post-elm product_ordering' . $classes . '"' . $el_id . '>';
|
||||
if ( function_exists( 'woocommerce_catalog_ordering' ) ) {
|
||||
woocommerce_catalog_ordering();
|
||||
}
|
||||
echo '</div>';
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_separator
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $title string Progress Bar title
|
||||
* @param $count int Progress Bar length in percents: '0' - '100'
|
||||
* @param $style string Style: '1' / '2' / '3' / '4' / '5'
|
||||
* @param $size string Height
|
||||
* @param $color string Color style: 'primary' / 'secondary' / 'heading' / 'text' / 'custom'
|
||||
* @param $bar_color string
|
||||
* @param $hide_count bool Hide progress value counter?
|
||||
*/
|
||||
|
||||
$classes = '';
|
||||
|
||||
$classes .= ' style_' . $style;
|
||||
$classes .= ' color_' . $color;
|
||||
if ( $hide_count ) {
|
||||
$classes .= ' hide_count';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
if ( $title != '' ) {
|
||||
$title_tag = '<span class="w-progbar-title-text">' . $title . '</span>';
|
||||
} else {
|
||||
$title_tag = '';
|
||||
$classes .= ' title_none';
|
||||
}
|
||||
|
||||
$count = max( 0, min( 100, $count ) );
|
||||
|
||||
$bar_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'height' => $size,
|
||||
'width' => $count . '%',
|
||||
'background' => $bar_color,
|
||||
)
|
||||
);
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-progbar' . $classes . ' initial"' . $el_id . ' data-count="' . $count . '">';
|
||||
$output .= '<h6 class="w-progbar-title">';
|
||||
$output .= $title_tag;
|
||||
$output .= '<span class="w-progbar-title-count">' . $count . '%</span>';
|
||||
$output .= '</h6>';
|
||||
$output .= '<div class="w-progbar-bar"><div class="w-progbar-bar-h"' . $bar_inline_css . '>';
|
||||
$output .= '<span class="w-progbar-bar-count">' . $count . '%</span>';
|
||||
$output .= '</div></div></div>';
|
||||
|
||||
// If we are in front end editor mode, apply JS to logos
|
||||
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
|
||||
$output .= '<script>
|
||||
jQuery(function($){
|
||||
if (typeof $.fn.wProgbar === "function") {
|
||||
jQuery(".w-progbar").wProgbar();
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_scroller
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $speed string Scroll Speed
|
||||
* @param $dots bool Show navigation dots?
|
||||
* @param $dots_pos string Dots Position
|
||||
* @param $dots_size string Dots Size
|
||||
* @param $dots_color string Dots color value
|
||||
* @param $disable_width string Dots color value
|
||||
* @param $el_class string Extra class name
|
||||
*/
|
||||
|
||||
$classes = $data_atts = '';
|
||||
|
||||
$classes .= ' style_' . $dots_style . ' pos_' . $dots_pos;
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
if ( $speed != '' ) {
|
||||
$data_atts = ' data-speed="' . $speed . '"';
|
||||
}
|
||||
if ( $disable_width != '' ) {
|
||||
$data_atts .= ' data-disablewidth="' . intval( $disable_width ) . '"';
|
||||
}
|
||||
|
||||
$dot_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $dots_size,
|
||||
'box-shadow' => empty( $dots_color ) ? '' : '0 0 0 2px ' . $dots_color,
|
||||
'background' => $dots_color,
|
||||
)
|
||||
);
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-scroller' . $classes . '"' . $el_id . $data_atts . ' aria-hidden="true">';
|
||||
if ( $dots ) {
|
||||
$output .= '<div class="w-scroller-dots">';
|
||||
$output .= '<a href="javascript:void(0);" class="w-scroller-dot"><span' . $dot_inline_css . '></span></a>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output search element
|
||||
*
|
||||
* @var $text string Placeholder Text
|
||||
* @var $layout string Layout: 'simple' / 'modern' / 'fulwidth' / 'fullscreen'
|
||||
* @var $width int Field width
|
||||
* @var $design_options array
|
||||
* @var $product_search bool Whether to search for WooCommerce products only
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$classes .= ' layout_' . $layout;
|
||||
|
||||
$output = '<div class="w-search' . $classes . '">';
|
||||
if ( $layout == 'fullscreen' ) {
|
||||
$output .= '<div class="w-search-background"></div>';
|
||||
}
|
||||
$output .= '<a class="w-search-open" href="javascript:void(0);" aria-label="' . us_translate( 'Search' ) . '">';
|
||||
if ( ! empty( $icon ) ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
$output .= '</a>';
|
||||
$output .= '<div class="w-search-form">';
|
||||
$output .= '<form class="w-search-form-h" autocomplete="off" action="' . esc_attr( home_url( '/' ) ) . '" method="get">';
|
||||
$output .= '<div class="w-search-form-field">';
|
||||
$output .= '<input type="text" name="s" id="us_form_search_s" placeholder="' . esc_attr( $text ) . '" aria-label="' . esc_attr( $text ) . '"/>';
|
||||
if ( ! empty( $product_search ) AND $product_search ) {
|
||||
$output .= '<input type="hidden" name="post_type" value="product" />';
|
||||
}
|
||||
$output .= '<span class="w-form-row-field-bar"></span>';
|
||||
$output .= '</div>';
|
||||
if ( $layout == 'simple' ) {
|
||||
$output .= '<button class="w-search-form-btn" type="submit" aria-label="' . us_translate( 'Search' ) . '">';
|
||||
if ( ! empty( $icon ) ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
$output .= '</button>';
|
||||
}
|
||||
// Language code
|
||||
if ( defined( 'ICL_LANGUAGE_CODE' ) AND ICL_LANGUAGE_CODE != '' ) {
|
||||
$output .= '<input type="hidden" name="lang" value="' . esc_attr( ICL_LANGUAGE_CODE ) . '" />';
|
||||
}
|
||||
$output .= '<a class="w-search-close" href="javascript:void(0);" aria-label="' . us_translate( 'Close' ) . '"></a>';
|
||||
$output .= '</form></div></div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_separator
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $size string Separator Height: 'small' / 'medium' / 'large' / 'huge' / 'custom'
|
||||
* @param $height string Separator custom height
|
||||
* @param $show_line bool Show the line in the middle?
|
||||
* @param $line_width string Separator type: 'default' / 'fullwidth' / 'short'
|
||||
* @param $thick string Line thickness: '1' / '2' / '3' / '4' / '5'
|
||||
* @param $style string Line style: 'solid' / 'dashed' / 'dotted' / 'double'
|
||||
* @param $color string Color style: 'border' / 'primary' / 'secondary' / 'custom'
|
||||
* @param $bdcolor string Border color value
|
||||
* @param $icon string Icon
|
||||
* @param $text string Title
|
||||
* @param $title_tag string Title HTML tag: 'h1' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'div'
|
||||
* @param $title_size string Font Size
|
||||
* @param $align string Alignment
|
||||
* @param $link string Link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
|
||||
* @param $el_class string Extra class name
|
||||
* @param $breakpoint_1_width string Screen Width breakpoint 1
|
||||
* @param $breakpoint_1_height string Separator custom height 1
|
||||
* @param $breakpoint_2_width string Screen Width breakpoint 2
|
||||
* @param $breakpoint_2_height string Separator custom height 2
|
||||
*/
|
||||
|
||||
$classes = $inner_html = $inline_css = $link_opener = $link_closer = $responsive_styles = '';
|
||||
|
||||
// Set element index to apply <style> for responsive CSS
|
||||
if ( $size == 'custom' AND $breakpoint_1_height != '' OR $breakpoint_2_height != '' ) {
|
||||
global $us_separator_index;
|
||||
$us_separator_index = isset( $us_separator_index ) ? ( $us_separator_index + 1 ) : 1;
|
||||
$classes .= ' us_separator_' . $us_separator_index;
|
||||
|
||||
$responsive_styles = '<style>';
|
||||
if ( $breakpoint_1_height != '' AND $breakpoint_1_height != $height ) {
|
||||
$responsive_styles .= '@media(max-width:' . esc_attr( $breakpoint_1_width ) . '){.us_separator_' . $us_separator_index . '{height:' . esc_attr( $breakpoint_1_height ) . '!important}}';
|
||||
}
|
||||
if ( $breakpoint_2_height != '' AND $breakpoint_2_height != $height ) {
|
||||
$responsive_styles .= '@media(max-width:' . esc_attr( $breakpoint_2_width ) . '){.us_separator_' . $us_separator_index . '{height:' . esc_attr( $breakpoint_2_height ) . '!important}}';
|
||||
}
|
||||
$responsive_styles .= '</style>';
|
||||
}
|
||||
|
||||
$classes .= ' size_' . $size;
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Link
|
||||
$link_atts = us_generate_link_atts( $link );
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$link_opener = '<a' . $link_atts . '>';
|
||||
$link_closer = '</a>';
|
||||
}
|
||||
|
||||
// Generate separator icon and title
|
||||
if ( $show_line ) {
|
||||
$classes .= ' with_line';
|
||||
$classes .= ' width_' . $line_width;
|
||||
$classes .= ' thick_' . $thick;
|
||||
$classes .= ' style_' . $style;
|
||||
$classes .= ' color_' . $color;
|
||||
$classes .= ' align_' . $align;
|
||||
|
||||
if ( ! empty( $text ) ) {
|
||||
$inner_html .= '<' . $title_tag . ' class="w-separator-text">';
|
||||
$inner_html .= $link_opener;
|
||||
$inner_html .= us_prepare_icon_tag( $icon );
|
||||
$inner_html .= '<span>' . strip_tags( $text, '<br><strong>' ) . '</span>';
|
||||
$inner_html .= $link_closer;
|
||||
$inner_html .= '</' . $title_tag . '>';
|
||||
} else {
|
||||
$inner_html .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
|
||||
if ( $inner_html != '' ) {
|
||||
$classes .= ' with_content';
|
||||
}
|
||||
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'height' => $height,
|
||||
'border-color' => $bdcolor,
|
||||
'color' => $bdcolor,
|
||||
'font-size' => $title_size,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'height' => $height,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-separator' . $classes . '"' . $el_id . $inline_css . '>';
|
||||
$output .= $responsive_styles;
|
||||
if ( $show_line ) {
|
||||
$output .= '<div class="w-separator-h">' . $inner_html . '</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_sharing
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @param $type string Type: 'simple' / 'solid' / 'outlined' / 'fixed'
|
||||
* @param $align string Alignment: 'left' / 'center' / 'right'
|
||||
* @param $color string Color Style: 'default' / 'primary' / 'secondary'
|
||||
* @param $counters string Share Counters: 'show' / 'hide'
|
||||
* @param $email bool Is Email button available?
|
||||
* @param $facebook bool Is Facebook button available?
|
||||
* @param $twitter bool Is Twitter button available?
|
||||
* @param $gplus bool Is Google button available?
|
||||
* @param $linkedin bool Is LinkedIn button available?
|
||||
* @param $pinterest bool Is Pinterest button available?
|
||||
* @param $vk bool Is VK button available?
|
||||
* @param $url string Sharing URL
|
||||
* @param $el_class string Extra class name
|
||||
*/
|
||||
|
||||
$classes = ' type_' . $type . ' align_' . $align . ' color_' . $color;
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => ( trim( $font_size ) == us_get_option( 'body_fontsize' ) ) ? '' : $font_size,
|
||||
)
|
||||
);
|
||||
|
||||
// The list of available sharing providers and additional in-shortcode data
|
||||
$providers_list = array(
|
||||
'email' => array(
|
||||
'title' => __( 'Email this', 'us' ),
|
||||
),
|
||||
'facebook' => array(
|
||||
'title' => __( 'Share this', 'us' ),
|
||||
),
|
||||
'twitter' => array(
|
||||
'title' => __( 'Tweet this', 'us' ),
|
||||
),
|
||||
'linkedin' => array(
|
||||
'title' => __( 'Share this', 'us' ),
|
||||
),
|
||||
'pinterest' => array(
|
||||
'title' => __( 'Pin this', 'us' ),
|
||||
),
|
||||
'vk' => array(
|
||||
'title' => __( 'Share this', 'us' ),
|
||||
),
|
||||
'whatsapp' => array(
|
||||
'title' => __( 'Share this', 'us' ),
|
||||
),
|
||||
'xing' => array(
|
||||
'title' => __( 'Share this', 'us' ),
|
||||
),
|
||||
'reddit' => array(
|
||||
'title' => __( 'Share this', 'us' ),
|
||||
),
|
||||
);
|
||||
|
||||
$set_providers = explode( ',', $providers );
|
||||
|
||||
// Keeping only the actually used providers
|
||||
foreach ( $providers_list as $provider => $provider_data ) {
|
||||
if ( ! in_array( $provider, $set_providers ) ) {
|
||||
unset( $providers_list[ $provider ] );
|
||||
}
|
||||
}
|
||||
if ( empty( $providers_list ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( empty( $url ) ) {
|
||||
// Using the current page URL
|
||||
$url = home_url( $_SERVER['REQUEST_URI'] );
|
||||
$url = str_replace( '?us_iframe=1', '', $url );
|
||||
}
|
||||
|
||||
if ( $counters == 'show' ) {
|
||||
$counts = us_get_sharing_counts( $url, array_keys( $providers_list ) );
|
||||
}
|
||||
|
||||
$post_thumbnail = get_the_post_thumbnail_url( NULL, 'large' );
|
||||
$post_thumbnail = ( $post_thumbnail ) ? $post_thumbnail : '';
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-sharing' . $classes . '"' . $el_id . $inline_css . '>';
|
||||
$output .= '<div class="w-sharing-list" data-sharing-url="' . esc_attr( $url ) . '" data-sharing-image="' . esc_attr( $post_thumbnail ) . '">';
|
||||
$sharing_list = '';
|
||||
foreach ( $providers_list as $provider => $provider_data ) {
|
||||
$sharing_list .= '<a class="w-sharing-item ' . $provider . '" href="javascript:void(0)"';
|
||||
$sharing_list .= ' title="' . esc_attr( $provider_data['title'] ) . '"';
|
||||
$sharing_list .= ' aria-label="' . esc_attr( $provider_data['title'] ) . '"';
|
||||
$sharing_list .= '>';
|
||||
$sharing_list .= '<span class="w-sharing-icon"></span>';
|
||||
if ( $counters == 'show' AND isset( $counts[ $provider ] ) AND $counts[ $provider ] != 0 ) {
|
||||
$sharing_list .= '<span class="w-sharing-count">' . $counts[ $provider ] . '</span>';
|
||||
}
|
||||
$sharing_list .= '</a>';
|
||||
}
|
||||
$output .= $sharing_list;
|
||||
$output .= '</div>';
|
||||
|
||||
if ( $text_selection ) {
|
||||
$sharing_area = ( $text_selection_post ) ? 'post_content' : 'l-main';
|
||||
$output .= '<div class="w-sharing-tooltip" style="display: none" data-sharing-area="' . $sharing_area . '">';
|
||||
$output .= '<div class="w-sharing-list" data-sharing-url="' . esc_attr( $url ) . '" data-sharing-image="' . esc_attr( $post_thumbnail ) . '">';
|
||||
$output .= $sharing_list;
|
||||
$output .= '<a class="w-sharing-item copy2clipboard" href="javascript:void(0)"';
|
||||
$output .= ' title="' . us_translate( 'Copy' ) . '"';
|
||||
$output .= ' aria-label="' . us_translate( 'Copy' ) . '"';
|
||||
$output .= '>';
|
||||
$output .= '<span class="w-sharing-icon"></span></a>';
|
||||
$output .= '</div></div>';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output Social Links element
|
||||
*/
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
$list_inline_css = $item_inline_css = '';
|
||||
|
||||
$classes .= ' style_' . $style;
|
||||
$classes .= ' hover_' . $hover;
|
||||
$classes .= ' color_' . $color;
|
||||
$classes .= ' shape_' . $shape;
|
||||
|
||||
if ( isset( $us_elm_context ) AND $us_elm_context == 'shortcode' ) {
|
||||
$classes .= ' align_' . $align;
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$list_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'font-size' => $size,
|
||||
'margin' => '-' . $gap,
|
||||
)
|
||||
);
|
||||
$item_inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'padding' => $gap,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-socials' . $classes . '"' . $el_id . '>';
|
||||
$output .= '<div class="w-socials-list"' . $list_inline_css . '>';
|
||||
|
||||
$social_links = us_config( 'social_links' );
|
||||
|
||||
// Decoding items in case it is shortcode
|
||||
if ( ! empty( $items ) AND ! is_array( $items ) ) {
|
||||
$items = json_decode( urldecode( $items ), TRUE );
|
||||
if ( ! is_array( $items ) ) {
|
||||
$items = array();
|
||||
}
|
||||
} elseif ( empty( $items ) OR ! is_array( $items ) ) {
|
||||
$items = array();
|
||||
}
|
||||
|
||||
foreach ( $items as $index => $item ) {
|
||||
$social_title = ( isset( $social_links[ $item['type'] ] ) ) ? $social_links[ $item['type'] ] : $item['type'];
|
||||
$social_url = ( isset( $item['url'] ) ) ? $item['url'] : '';
|
||||
$social_target = $social_icon = $social_custom_bg = $social_custom_color = '';
|
||||
|
||||
// Custom type
|
||||
if ( $item['type'] == 'custom' ) {
|
||||
$social_title = ( ! empty( $item['title'] ) ) ? $item['title'] : us_translate( 'Title' );
|
||||
$social_url = esc_url( $social_url );
|
||||
$social_target = ' target="_blank"';
|
||||
if ( isset( $item['icon'] ) ) {
|
||||
$social_icon = us_prepare_icon_tag( $item['icon'] );
|
||||
}
|
||||
$social_custom_bg = us_prepare_inline_css(
|
||||
array(
|
||||
'background' => $item['color'],
|
||||
)
|
||||
);
|
||||
$social_custom_color = us_prepare_inline_css(
|
||||
array(
|
||||
'color' => $item['color'],
|
||||
)
|
||||
);
|
||||
// Email type
|
||||
} elseif ( $item['type'] == 'email' ) {
|
||||
if ( filter_var( $social_url, FILTER_VALIDATE_EMAIL ) ) {
|
||||
$social_url = 'mailto:' . $social_url;
|
||||
}
|
||||
// Skype type
|
||||
} elseif ( $item['type'] == 'skype' ) {
|
||||
if ( strpos( $social_url, ':' ) === FALSE ) {
|
||||
$social_url = 'skype:' . esc_attr( $social_url );
|
||||
}
|
||||
// All others types
|
||||
} else {
|
||||
$social_url = esc_url( $social_url );
|
||||
$social_target = ' target="_blank"';
|
||||
}
|
||||
|
||||
$output .= '<div class="w-socials-item ' . $item['type'] . '"' . $item_inline_css . '>';
|
||||
$output .= '<a class="w-socials-item-link"';
|
||||
$output .= ' rel="nofollow"' . $social_target;
|
||||
$output .= ' href="' . $social_url . '"';
|
||||
$output .= ' title="' . esc_attr( $social_title ) . '"';
|
||||
$output .= ' aria-label="' . esc_attr( $social_title ) . '"';
|
||||
if ( $color == 'brand' ) {
|
||||
$output .= $social_custom_color;
|
||||
}
|
||||
$output .= '>';
|
||||
$output .= '<span class="w-socials-item-link-hover"' . $social_custom_bg . '></span>';
|
||||
$output .= $social_icon;
|
||||
$output .= '</a>';
|
||||
$output .= '<div class="w-socials-item-popup"><span>' . strip_tags( $social_title ) . '</span></div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
$output .= '</div></div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output text element
|
||||
*
|
||||
* @var $text string
|
||||
* @var $size int Text size
|
||||
* @var $size_tablets int Text size for tablets
|
||||
* @var $size_mobiles int Text size for mobiles
|
||||
* @var $link string Link
|
||||
* @var $icon string FontAwesome or Material icon
|
||||
* @var $font string Font Source
|
||||
* @var $color string Custom text color
|
||||
* @var $design_options array
|
||||
* @var $classes string
|
||||
* @var $id string
|
||||
*/
|
||||
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
|
||||
$output = '<div class="w-text' . $classes . '">';
|
||||
|
||||
$link_atts = us_generate_link_atts( $link );
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '<a class="w-text-h"' . $link_atts . '>';
|
||||
} else {
|
||||
$output .= '<div class="w-text-h">';
|
||||
}
|
||||
|
||||
if ( ! empty( $icon ) ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
$output .= '<span class="w-text-value">' . strip_tags( $text, '<br>' ) . '</span>';
|
||||
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$output .= '</a>';
|
||||
} else {
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: vc_column
|
||||
*
|
||||
* Overloaded by UpSolution custom implementation.
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @var $width string Width in format: 1/2 (is set by WPBakery Page Builder renderer)
|
||||
* @var $text_color string Text color
|
||||
* @var $animate string Animation type: '' / 'fade' / 'afc' / 'afl' / 'afr' / 'afb' / 'aft' / 'hfc' / 'wfc'
|
||||
* @var $animate_delay float Animation delay (in seconds)
|
||||
* @var $el_id string element ID
|
||||
* @var $el_class string Additional class
|
||||
* @var $offset string WPBakery Page Builder classes for responsive behaviour
|
||||
* @var $css string Custom CSS
|
||||
*/
|
||||
|
||||
$inner_classes = $el_id_string = $link_html = '';
|
||||
|
||||
if ( function_exists( 'wpb_translateColumnWidthToSpan' ) ) {
|
||||
$width = wpb_translateColumnWidthToSpan( $width );
|
||||
|
||||
} elseif ( function_exists( 'us_wpb_translateColumnWidthToSpan' ) ) {
|
||||
$width = us_wpb_translateColumnWidthToSpan( $width );
|
||||
}
|
||||
|
||||
if ( function_exists( 'vc_column_offset_class_merge' ) ) {
|
||||
$width = vc_column_offset_class_merge( $offset, $width );
|
||||
|
||||
} elseif ( function_exists( 'us_vc_column_offset_class_merge' ) ) {
|
||||
$width = us_vc_column_offset_class_merge( $offset, $width );
|
||||
}
|
||||
$classes = $width . ' wpb_column vc_column_container';
|
||||
|
||||
if ( function_exists( 'vc_shortcode_custom_css_has_property' ) AND vc_shortcode_custom_css_has_property(
|
||||
$css, array(
|
||||
'border',
|
||||
'background',
|
||||
)
|
||||
) ) {
|
||||
$classes .= ' has-fill';
|
||||
} elseif ( function_exists( 'us_vc_shortcode_custom_css_has_property' ) AND us_vc_shortcode_custom_css_has_property(
|
||||
$css, array(
|
||||
'border',
|
||||
'background',
|
||||
)
|
||||
) ) {
|
||||
$classes .= ' has-fill';
|
||||
}
|
||||
|
||||
if ( ! empty( $animate ) ) {
|
||||
$classes .= ' animate_' . $animate;
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$inner_classes .= ' ' . vc_shortcode_custom_css_class( $css, ' ' );
|
||||
}
|
||||
if ( ! empty( $text_color ) ) {
|
||||
$inner_classes .= ' color_custom';
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
// Link
|
||||
$link_atts = us_generate_link_atts( $link );
|
||||
if ( ! empty( $link_atts ) ) {
|
||||
$classes .= ' has-link';
|
||||
$link_html = '<a class="vc_column-link smooth-scroll"' . $link_atts . '></a>';
|
||||
}
|
||||
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'color' => $text_color,
|
||||
'animation-delay' => empty( $animate_delay ) ? '' : floatval( $animate_delay ) . 's',
|
||||
)
|
||||
);
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="' . $classes . '"' . $el_id . $inline_css . '>';
|
||||
$output .= '<div class="vc_column-inner' . $inner_classes . '">';
|
||||
$output .= '<div class="wpb_wrapper">' . do_shortcode( $content ) . '</div>';
|
||||
$output .= $link_html;
|
||||
$output .= '</div></div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode attributes
|
||||
*
|
||||
* @var $el_class
|
||||
* @var $css_animation
|
||||
* @var $css
|
||||
* @var $content - shortcode content
|
||||
* Shortcode class
|
||||
* @var $this WPBakeryShortCode_VC_Column_text
|
||||
*/
|
||||
|
||||
$classes = '';
|
||||
|
||||
if ( function_exists( 'vc_shortcode_custom_css_class' ) AND ! empty( $css ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
|
||||
if ( ! empty( $el_class ) ) {
|
||||
$classes .= ' ' . $el_class;
|
||||
}
|
||||
|
||||
$el_id_string = '';
|
||||
if ( $el_id != '' ) {
|
||||
$el_id_string = ' id="' . esc_attr( $el_id ) . '"';
|
||||
}
|
||||
|
||||
$content = wpautop( preg_replace( '/<\/?p\>/', "\n", $content ) . "\n" );
|
||||
|
||||
$output = '
|
||||
<div class="wpb_text_column ' . esc_attr( $classes ) . '"' . $el_id_string . '>
|
||||
<div class="wpb_wrapper">
|
||||
' . do_shortcode( shortcode_unautop( $content ) ) . '
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,295 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: vc_row
|
||||
*
|
||||
* Overloaded by UpSolution custom implementation to allow creating fullwidth sections and provide lots of additional
|
||||
* features.
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
|
||||
* @var $content_placement string Columns Content Position: 'top' / 'middle' / 'bottom'
|
||||
* @var $gap string gap class for columns
|
||||
* @var $height string Height type. Possible values: 'default' / 'small' / 'medium' / 'large' / 'huge' / 'auto' / 'full'
|
||||
* @var $valign string Vertical align for full-height sections: '' / 'center'
|
||||
* @var $width string Section width: '' / 'full'
|
||||
* @var $color_scheme string Color scheme: '' / 'alternate' / 'primary' / 'secondary' / 'custom'
|
||||
* @var $us_bg_color string
|
||||
* @var $us_text_color string
|
||||
* @var $us_bg_image_source string Background image source: 'none' / 'media' / 'featured' / 'custom'
|
||||
* @var $us_bg_image int Background image ID (from WordPress media)
|
||||
* @var $us_bg_size string Background size: 'cover' / 'contain' / 'initial'
|
||||
* @var $us_bg_repeat string Background size: 'repeat' / 'repeat-x' / 'repeat-y' / 'no-repeat'
|
||||
* @var $us_bg_pos string Background position: 'top left' / 'top center' / 'top right' / 'center left' / 'center center' / 'center right' / 'bottom left' / 'bottom center' / 'bottom right'
|
||||
* @var $us_bg_parallax string Parallax type: '' / 'vertical' / 'horizontal' / 'still'
|
||||
* @var $us_bg_parallax_width string Parallax background width: '110' / '120' / '130' / '140' / '150'
|
||||
* @var $us_bg_parallax_reverse bool Reverse vertival parllax effect?
|
||||
* @var $us_bg_video string Link to video file
|
||||
* @var $us_bg_overlay_color string
|
||||
* @var $sticky bool Fix this row at the top of a page during scroll
|
||||
* @var $sticky_disable_width int When screen width is less than this value, sticky row becomes not sticky
|
||||
* @var $el_id string
|
||||
* @var $el_class string
|
||||
* @var $disable_element string
|
||||
* @var $css string
|
||||
*/
|
||||
|
||||
$atts = us_shortcode_atts( $atts, $shortcode_base );
|
||||
|
||||
// .l-section container additional classes and inner CSS-styles
|
||||
$classes = $inline_css = $inner_inline_css = '';
|
||||
|
||||
if ( $disable_element === 'yes' ) {
|
||||
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
|
||||
$classes .= ' vc_hidden-lg vc_hidden-xs vc_hidden-sm vc_hidden-md';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $height == 'default' ) {
|
||||
$classes .= ' height_' . us_get_option( 'row_height', 'medium' );
|
||||
} else {
|
||||
$classes .= ' height_' . $height;
|
||||
}
|
||||
if ( $height == 'full' AND ! empty( $valign ) ) {
|
||||
$classes .= ' valign_' . $valign;
|
||||
}
|
||||
if ( $width == 'full' ) {
|
||||
$classes .= ' width_full';
|
||||
}
|
||||
if ( $color_scheme != '' ) {
|
||||
$classes .= ' color_' . $color_scheme;
|
||||
if ( $color_scheme == 'custom' ) {
|
||||
// Custom colors
|
||||
if ( $us_bg_color != '' ) {
|
||||
$inline_css .= 'background: ' . $us_bg_color . ';';
|
||||
}
|
||||
if ( $us_text_color != '' ) {
|
||||
$inline_css .= ' color: ' . $us_text_color . ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $sticky == 1 ) {
|
||||
$classes .= ' type_sticky';
|
||||
}
|
||||
if ( ! empty( $el_class ) ) {
|
||||
$classes .= ' ' . $el_class;
|
||||
}
|
||||
|
||||
// Background Image
|
||||
$bg_image_html = $bg_image_url = $bg_img_atts = '';
|
||||
if ( $us_bg_image_source == 'media' AND ! empty( $us_bg_image ) ) {
|
||||
if ( is_numeric( $us_bg_image ) ) {
|
||||
$wp_image = wp_get_attachment_image_src( (int) $us_bg_image, 'full' );
|
||||
if ( $wp_image ) {
|
||||
$bg_image_url = $wp_image[0];
|
||||
$bg_img_atts .= ' data-img-width="' . esc_attr( $wp_image[1] ) . '" data-img-height="' . esc_attr( $wp_image[2] ) . '"';
|
||||
}
|
||||
} else {
|
||||
$bg_image_url = $us_bg_image;
|
||||
}
|
||||
}
|
||||
if ( $us_bg_image_source == 'featured' AND ( isset( $GLOBALS['post'] ) OR is_404() OR is_search() OR is_archive() OR ( is_home() AND ! have_posts() ) ) ) {
|
||||
$us_layout = US_Layout::instance();
|
||||
if ( ! empty( $us_layout->post_id ) ) {
|
||||
$wp_image = wp_get_attachment_image_src( get_post_thumbnail_id( $us_layout->post_id ), 'full' );
|
||||
if ( $wp_image ) {
|
||||
$bg_image_url = $wp_image[0];
|
||||
$bg_img_atts .= ' data-img-width="' . esc_attr( $wp_image[1] ) . '" data-img-height="' . esc_attr( $wp_image[2] ) . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! empty( $bg_image_url ) ) {
|
||||
$classes .= ' with_img';
|
||||
$bg_image_inline_css = 'background-image: url(' . $bg_image_url . ');';
|
||||
if ( $us_bg_pos != 'center center' ) {
|
||||
$bg_image_inline_css .= 'background-position: ' . $us_bg_pos . ';';
|
||||
}
|
||||
if ( $us_bg_repeat != 'repeat' ) {
|
||||
$bg_image_inline_css .= 'background-repeat: ' . $us_bg_repeat . ';';
|
||||
}
|
||||
if ( $us_bg_size != 'cover' ) {
|
||||
$bg_image_inline_css .= 'background-size: ' . $us_bg_size . ';';
|
||||
}
|
||||
$bg_image_additional_class = ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) ? ' loaded' : '';
|
||||
$bg_image_html = '<div class="l-section-img' . $bg_image_additional_class . '" style="' . $bg_image_inline_css . '"' . $bg_img_atts . '></div>';
|
||||
}
|
||||
// Background Video
|
||||
$bg_video_html = '';
|
||||
if ( $us_bg_video != '' ) {
|
||||
$classes .= ' with_video';
|
||||
$provider_matched = FALSE;
|
||||
$bg_video_html = '<div class="l-section-video">';
|
||||
foreach ( us_config( 'embeds' ) as $provider => $embed ) {
|
||||
if ( $embed['type'] != 'video' OR ! preg_match( $embed['regex'], $us_bg_video, $matches ) ) {
|
||||
continue;
|
||||
}
|
||||
$provider_matched = TRUE;
|
||||
$video_id = $matches[ $embed['match_index'] ];
|
||||
if ( $provider == 'youtube' ) {
|
||||
$classes .= ' with_youtube';
|
||||
$video_title = '?autoplay=1&loop=1&playlist=' . $video_id . '&showinfo=0&controls=0&rel=0&showinfo=0&mute=1&iv_load_policy=3&disablekb=1&wmode=transparent';
|
||||
} elseif ( $provider == 'vimeo' ) {
|
||||
$classes .= ' with_vimeo';
|
||||
$video_title = '&autoplay=1&loop=1&muted=1&title=0&byline=0&background=1';
|
||||
}
|
||||
$embed_html = str_replace( '<id>', $matches[ $embed['match_index'] ], $embed['html'] );
|
||||
$embed_html = str_replace( '<video-title>', $video_title, $embed_html );
|
||||
break;
|
||||
}
|
||||
if ( $provider_matched ) {
|
||||
$bg_video_html .= $embed_html;
|
||||
} else {
|
||||
$bg_video_html .= '<video muted loop autoplay preload="auto">';
|
||||
$video_ext = 'mp4'; //use mp4 as default extension
|
||||
$file_path_info = pathinfo( $us_bg_video );
|
||||
if ( isset( $file_path_info['extension'] ) ) {
|
||||
if ( in_array( $file_path_info['extension'], array( 'ogg', 'ogv' ) ) ) {
|
||||
$video_ext = 'ogg';
|
||||
} elseif ( $file_path_info['extension'] == 'webm' ) {
|
||||
$video_ext = 'webm';
|
||||
}
|
||||
}
|
||||
$bg_video_html .= '<source type="video/' . $video_ext . '" src="' . $us_bg_video . '" />';
|
||||
$bg_video_html .= '</video>';
|
||||
}
|
||||
$bg_video_html .= '</div>';
|
||||
} else {
|
||||
if ( $us_bg_parallax == 'vertical' ) {
|
||||
$classes .= ' parallax_ver';
|
||||
if ( $us_bg_parallax_reverse ) {
|
||||
$classes .= ' parallaxdir_reversed';
|
||||
}
|
||||
if ( in_array( $us_bg_pos, array( 'top right', 'center right', 'bottom right' ) ) ) {
|
||||
$classes .= ' parallax_xpos_right';
|
||||
} elseif ( in_array( $us_bg_pos, array( 'top left', 'center left', 'bottom left' ) ) ) {
|
||||
$classes .= ' parallax_xpos_left';
|
||||
}
|
||||
} elseif ( $us_bg_parallax == 'fixed' OR $us_bg_parallax == 'still' ) {
|
||||
$classes .= ' parallax_fixed';
|
||||
} elseif ( $us_bg_parallax == 'horizontal' ) {
|
||||
$classes .= ' parallax_hor';
|
||||
$classes .= ' bgwidth_' . $us_bg_parallax_width;
|
||||
}
|
||||
}
|
||||
|
||||
// Background Slider
|
||||
$bg_slider_html = '';
|
||||
if ( class_exists( 'RevSlider' ) AND $us_bg_slider != '' ) {
|
||||
$classes .= ' with_slider';
|
||||
$bg_slider_html = '<div class="l-section-slider">' . do_shortcode( '[rev_slider ' . $us_bg_slider . ']' ) . '</div>';
|
||||
}
|
||||
|
||||
// Background Overlay
|
||||
$bg_overlay_html = '';
|
||||
if ( ! empty( $us_bg_overlay_color ) ) {
|
||||
$classes .= ' with_overlay';
|
||||
$bg_overlay_html = '<div class="l-section-overlay" style="background: ' . $us_bg_overlay_color . '"></div>';
|
||||
}
|
||||
|
||||
// We cannot use VC's method directly for rows: as it uses !important values, so we're moving the defined css
|
||||
// that don't duplicate the theme's features to inline style attribute.
|
||||
if ( ! empty( $css ) AND preg_match( '~\{([^\}]+?)\;?\}~', $css, $matches ) ) {
|
||||
$vc_css_rules = array_map( 'trim', explode( ';', $matches[1] ) );
|
||||
$overloaded_params = array(
|
||||
'background',
|
||||
'background-position',
|
||||
'background-repeat',
|
||||
'background-size',
|
||||
'padding-top',
|
||||
'padding-bottom',
|
||||
);
|
||||
$inner_params = array(
|
||||
'padding-top',
|
||||
'padding-bottom',
|
||||
);
|
||||
foreach ( $vc_css_rules as $vc_css_rule ) {
|
||||
$vc_css_rule = explode( ':', $vc_css_rule );
|
||||
// Generate inline styles for "l-section"
|
||||
if ( count( $vc_css_rule ) == 2 AND ! in_array( $vc_css_rule[0], $overloaded_params ) ) {
|
||||
$inline_css .= $vc_css_rule[0] . ':' . $vc_css_rule[1] . ';';
|
||||
}
|
||||
// Generate inline styles for "l-section-h"
|
||||
if ( count( $vc_css_rule ) == 2 AND in_array( $vc_css_rule[0], $inner_params ) ) {
|
||||
$inner_inline_css .= $vc_css_rule[0] . ':' . $vc_css_rule[1] . ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$classes = apply_filters( 'vc_shortcodes_css_class', $classes, $shortcode_base, $atts );
|
||||
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
|
||||
$classes .= ' vc_row';
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<section class="l-section wpb_row' . $classes . '"';
|
||||
if ( ! empty( $el_id ) ) {
|
||||
$output .= ' id="' . $el_id . '"';
|
||||
}
|
||||
if ( ! empty( $inline_css ) ) {
|
||||
$output .= ' style="' . $inline_css . '"';
|
||||
}
|
||||
if ( $sticky == 1 AND ! empty( $sticky_disable_width ) ) {
|
||||
$output .= ' data-sticky-disable-width="' . intval( $sticky_disable_width ) . '"';
|
||||
}
|
||||
$output .= '>';
|
||||
$output .= $bg_image_html;
|
||||
$output .= $bg_video_html;
|
||||
$output .= $bg_slider_html;
|
||||
$output .= $bg_overlay_html;
|
||||
$output .= '<div class="l-section-h i-cf"';
|
||||
if ( ! empty( $inner_inline_css ) ) {
|
||||
$output .= ' style="' . $inner_inline_css . '"';
|
||||
}
|
||||
$output .= '>';
|
||||
|
||||
$inner_output = do_shortcode( $content );
|
||||
|
||||
// If the row has no inner rows, preparing wrapper for inner columns
|
||||
if ( substr( $inner_output, 0, 18 ) != '<div class="g-cols' ) {
|
||||
|
||||
$cols_gap_styles = '';
|
||||
$cols_class_name = ( $columns_type ) ? ' type_boxes' : ' type_default';
|
||||
|
||||
if ( ! empty( $content_placement ) ) {
|
||||
$cols_class_name .= ' valign_' . $content_placement;
|
||||
}
|
||||
if ( ! empty( $columns_reverse ) ) {
|
||||
$cols_class_name .= ' reversed';
|
||||
}
|
||||
|
||||
// Prepare extra styles for columns gap
|
||||
$gap = trim( $gap );
|
||||
if ( ! empty( $gap ) ) {
|
||||
$gap = trim( strip_tags( $gap ) );
|
||||
$gap_class = 'gap-' . str_replace( array( '.', ',', ' ' ), '-', $gap );
|
||||
$cols_class_name .= ' ' . $gap_class;
|
||||
|
||||
$cols_gap_styles = '<style>';
|
||||
if ( $columns_type ) {
|
||||
$cols_gap_styles .= '.g-cols.' . $gap_class . '{margin:0 -' . $gap . '}';
|
||||
} else {
|
||||
$cols_gap_styles .= '.g-cols.' . $gap_class . '{margin:0 calc(-1.5rem - ' . $gap . ')}';
|
||||
}
|
||||
$cols_gap_styles .= '.' . $gap_class . ' > .vc_column_container {padding:' . $gap . '}';
|
||||
$cols_gap_styles .= '</style>';
|
||||
}
|
||||
|
||||
$output .= '<div class="g-cols vc_row' . $cols_class_name . '">';
|
||||
$output .= $cols_gap_styles . $inner_output;
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
$output .= $inner_output;
|
||||
}
|
||||
|
||||
$output .= '</div></section>';
|
||||
if ( $sticky == 1 ) {
|
||||
$output .= '<div class="l-section-gap"></div>';
|
||||
}
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: vc_row_inner
|
||||
*
|
||||
* Overloaded by UpSolution custom implementation.
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @var $content_placement string Columns Content Position: 'top' / 'middle' / 'bottom'
|
||||
* @var $gap string gap class for columns
|
||||
* @var $el_id string
|
||||
* @var $el_class string
|
||||
* @var $disable_element string
|
||||
* @var $css string
|
||||
*/
|
||||
|
||||
$atts = us_shortcode_atts( $atts, $shortcode_base );
|
||||
|
||||
if ( $disable_element === 'yes' ) {
|
||||
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
|
||||
$classes .= ' vc_hidden-lg vc_hidden-xs vc_hidden-sm vc_hidden-md';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
$class_name = ( $columns_type ) ? ' type_boxes' : ' type_default';
|
||||
|
||||
if ( ! empty( $content_placement ) ) {
|
||||
$class_name .= ' valign_' . $content_placement;
|
||||
}
|
||||
|
||||
// Prepare extra styles for columns gap
|
||||
$cols_gap_styles = '';
|
||||
$gap = trim( $gap );
|
||||
if ( ! empty( $gap ) ) {
|
||||
$gap = trim( strip_tags( $gap ) );
|
||||
$gap_class = 'gap-' . str_replace( array( '.', ',', ' ' ), '-', $gap );
|
||||
$class_name .= ' ' . $gap_class;
|
||||
|
||||
$cols_gap_styles = '<style>';
|
||||
if ( $columns_type ) {
|
||||
$cols_gap_styles .= '.g-cols.' . $gap_class . '{margin:0 -' . $gap . '}';
|
||||
} else {
|
||||
$cols_gap_styles .= '.g-cols.' . $gap_class . '{margin:0 calc(-1.5rem - ' . $gap . ')}';
|
||||
}
|
||||
$cols_gap_styles .= '.' . $gap_class . ' > .vc_column_container {padding:' . $gap . '}';
|
||||
$cols_gap_styles .= '</style>';
|
||||
}
|
||||
|
||||
if ( ! empty( $columns_reverse ) ) {
|
||||
$class_name .= ' reversed';
|
||||
}
|
||||
|
||||
// Preserving additional class for inner VC rows
|
||||
if ( $shortcode_base == 'vc_row_inner' ) {
|
||||
$class_name .= ' vc_inner';
|
||||
}
|
||||
|
||||
// Additional class set by a user in a shortcode attributes
|
||||
if ( ! empty( $el_class ) ) {
|
||||
$class_name .= ' ' . $el_class;
|
||||
}
|
||||
|
||||
if ( function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$class_name .= ' ' . vc_shortcode_custom_css_class( $css, ' ' );
|
||||
}
|
||||
$class_name = apply_filters( 'vc_shortcodes_css_class', $class_name, $shortcode_base, $atts );
|
||||
|
||||
$row_id_param = '';
|
||||
|
||||
$output = '<div class="g-cols wpb_row ' . $class_name . '"';
|
||||
if ( ! empty( $el_id ) ) {
|
||||
$output .= ' id="' . $el_id . '"';
|
||||
}
|
||||
$output .= '>';
|
||||
$output .= $cols_gap_styles;
|
||||
$output .= do_shortcode( $content );
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: vc_tta_section
|
||||
*
|
||||
* Overloaded by UpSolution custom implementation.
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @var $title string Section title
|
||||
* @var $tab_id string Section slug
|
||||
* @var $icon string Icon
|
||||
* @var $i_position string Icon position: 'left' / 'right'
|
||||
* @var $active bool Tab is opened when page loads
|
||||
* @var $indents string Indents type: '' / 'none'
|
||||
* @var $bg_color string Background color
|
||||
* @var $text_color string Text color
|
||||
* @var $c_position string Control position (inherited from wrapping vc_tta_tabs shortcode): 'left' / 'right'
|
||||
* @var $title_tag string Title HTML tag (inherited from wrapping vc_tta_tabs shortcode): 'div' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'p'
|
||||
* @var $title_size string Title Size
|
||||
* @var $el_class string Extra class name
|
||||
*/
|
||||
|
||||
global $us_tabs_atts, $us_tab_index;
|
||||
// Tab indexes start from 1
|
||||
$us_tab_index = isset( $us_tab_index ) ? ( $us_tab_index + 1 ) : 1;
|
||||
|
||||
// We could overload some of the atts at vc_tabs implementation, so apply them here as well
|
||||
if ( isset( $us_tab_index ) AND isset( $us_tabs_atts[ $us_tab_index - 1 ] ) ) {
|
||||
foreach ( $us_tabs_atts[ $us_tab_index - 1 ] as $_key => $_value ) {
|
||||
${$_key} = $_value;
|
||||
}
|
||||
}
|
||||
|
||||
$content_html = do_shortcode( $content );
|
||||
|
||||
$classes = $item_tag_href = '';
|
||||
if ( $icon ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
if ( $indents == 'none' ) {
|
||||
$classes .= ' no_indents';
|
||||
}
|
||||
if ( $active ) {
|
||||
$classes .= ' active';
|
||||
}
|
||||
// Hide the section with empty content
|
||||
if ( $content_html == '' ) {
|
||||
$classes .= ' content-empty';
|
||||
}
|
||||
if ( ! empty( $el_class ) ) {
|
||||
$classes .= ' ' . $el_class;
|
||||
}
|
||||
|
||||
$item_tag = 'div';
|
||||
|
||||
if ( ! empty( $tab_id ) ) {
|
||||
$item_tag = 'a';
|
||||
$item_tag_href = ' href="#' . $tab_id . '"';
|
||||
$tab_id = ' id="' . $tab_id . '"';
|
||||
}
|
||||
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'background' => $bg_color,
|
||||
'color' => $text_color,
|
||||
)
|
||||
);
|
||||
if ( ! empty( $inline_css ) ) {
|
||||
$classes .= ' color_custom';
|
||||
}
|
||||
|
||||
// Replace comments amount instead of variable
|
||||
$title = us_replace_comment_count_var( $title );
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-tabs-section' . $classes . '"' . $tab_id . $inline_css . '>';
|
||||
$output .= '<' . $item_tag . $item_tag_href . ' class="w-tabs-section-header"' . us_prepare_inline_css( array( 'font-size' => $title_size ) ) . '><div class="w-tabs-section-header-h">';
|
||||
if ( $c_position == 'left' ) {
|
||||
$output .= '<div class="w-tabs-section-control"></div>';
|
||||
}
|
||||
if ( $icon AND $i_position == 'left' ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
$output .= '<' . $title_tag . ' class="w-tabs-section-title">' . $title . '</' . $title_tag . '>';
|
||||
if ( $icon AND $i_position == 'right' ) {
|
||||
$output .= us_prepare_icon_tag( $icon );
|
||||
}
|
||||
if ( $c_position == 'right' ) {
|
||||
$output .= '<div class="w-tabs-section-control"></div>';
|
||||
}
|
||||
$output .= '</div></' . $item_tag . '>';
|
||||
$output .= '<div class="w-tabs-section-content"><div class="w-tabs-section-content-h i-cf">' . $content_html . '</div></div>';
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: vc_tta_tabs
|
||||
*
|
||||
* Overloaded by UpSolution custom implementation.
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @var $toggle bool {@for [vc_tta_accordion]} Act as toggle?
|
||||
* @var $c_align string {@for [vc_tta_accordion], [vc_tta_tour]} Text alignment: 'left' / 'center' / 'right'
|
||||
* @var $c_icon string {@for [vc_tta_accordion]} Icon: '' / 'chevron' / 'plus' / 'triangle'
|
||||
* @var $c_position string {@for [vc_tta_accordion]} Icon position: 'left' / 'right'
|
||||
* @var $title_tag string Title HTML tag (inherited from wrapping vc_tta_tabs shortcode): 'div' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'p'
|
||||
* @var $title_size string Title Size
|
||||
* @var $layout string {@for [vc_tta_tabs]} Tabs layout: 'default' / 'modern' / 'trendy' / 'timeline'
|
||||
* @var $stretch bool {@for [vc_tta_tabs]} Stretch tabs to the full available width
|
||||
* @var $tab_position string {@for [vc_tta_tour]} Tabs position: 'left' / 'right'
|
||||
* @var $controls_size string {@for [vc_tta_tour]} Tabs size: 'auto' / '10' / '20' / '30' / '40' / '50'
|
||||
* @var $el_id string element ID
|
||||
* @var $el_class string {@for [vc_tta_accordion], [vc_tta_tabs], [vc_tta_tour]} Extra class
|
||||
* @var $css string Custom CSS
|
||||
*/
|
||||
|
||||
// Backward compatibility
|
||||
if ( $shortcode_base == 'vc_tour' ) {
|
||||
$shortcode_base = 'vc_tta_tour';
|
||||
} elseif ( $shortcode_base == 'vc_accordion' ) {
|
||||
$shortcode_base = 'vc_tta_accordion';
|
||||
} elseif ( $shortcode_base == 'vc_tabs' ) {
|
||||
$shortcode_base = 'vc_tta_tabs';
|
||||
}
|
||||
|
||||
$classes = $list_classes = $list_inline_css = $el_id_string = '';
|
||||
|
||||
// Extract tab attributes for future html preparations
|
||||
global $us_tabs_atts;
|
||||
preg_match_all( '/\[vc_tta_section([^\]]*?)\]/i', $content, $matches, PREG_OFFSET_CAPTURE );
|
||||
$us_tabs_atts = isset( $matches[0] ) ? $matches[0] : array();
|
||||
$active_tab_indexes = array();
|
||||
foreach ( $us_tabs_atts as $index => $tab_atts ) {
|
||||
$us_tabs_atts[ $index ] = shortcode_parse_atts( '[' . rtrim( $tab_atts[0], '[]' ) . ' ]' );
|
||||
if ( isset( $us_tabs_atts[ $index ]['active'] ) AND $us_tabs_atts[ $index ]['active'] ) {
|
||||
$active_tab_indexes[] = $index;
|
||||
$us_tabs_atts[ $index ]['defined_active'] = 1;
|
||||
}
|
||||
}
|
||||
// If none of the tabs is active, the first one will be
|
||||
if ( empty( $active_tab_indexes ) AND $shortcode_base != 'vc_tta_accordion' ) {
|
||||
$active_tab_indexes[] = 0;
|
||||
$us_tabs_atts[0]['active'] = 'yes';
|
||||
}
|
||||
|
||||
if ( ! ( $shortcode_base == 'vc_tta_accordion' AND $toggle ) AND count( $active_tab_indexes ) > 1 ) {
|
||||
foreach ( array_slice( $active_tab_indexes, 1 ) as $index ) {
|
||||
$us_tabs_atts[ $index ]['active'] = 0;
|
||||
$us_tabs_atts[ $index ]['defined_active'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Inheriging some of the attributes to the sections
|
||||
if ( isset( $c_position ) ) {
|
||||
foreach ( $us_tabs_atts as $index => $tab_atts ) {
|
||||
$us_tabs_atts[ $index ]['c_position'] = $c_position;
|
||||
}
|
||||
}
|
||||
|
||||
// Inheriging some of the attributes to the sections
|
||||
if ( isset( $title_tag ) ) {
|
||||
foreach ( $us_tabs_atts as $index => $tab_atts ) {
|
||||
$us_tabs_atts[ $index ]['title_tag'] = $title_tag;
|
||||
}
|
||||
}
|
||||
|
||||
// Inheriging some of the attributes to the sections
|
||||
if ( isset( $title_size ) ) {
|
||||
foreach ( $us_tabs_atts as $index => $tab_atts ) {
|
||||
$us_tabs_atts[ $index ]['title_size'] = $title_size;
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $layout ) ) {
|
||||
$layout = 'default';
|
||||
}
|
||||
if ( $shortcode_base == 'vc_tta_tabs' ) {
|
||||
$list_classes .= ' hidden';
|
||||
} elseif ( $shortcode_base == 'vc_tta_tour' ) {
|
||||
$layout = 'ver';
|
||||
$classes .= ' navpos_' . $tab_position . ' navwidth_' . $controls_size . ' title_at' . $c_align;
|
||||
}
|
||||
|
||||
$classes .= ' layout_' . $layout;
|
||||
$list_classes .= ' items_' . count( $us_tabs_atts );
|
||||
$list_classes .= ( isset( $stretch ) AND $stretch ) ? ' stretch' : '';
|
||||
|
||||
// Accordion-specific settings
|
||||
if ( $shortcode_base == 'vc_tta_accordion' ) {
|
||||
$classes .= ' accordion';
|
||||
if ( $toggle ) {
|
||||
$classes .= ' type_togglable';
|
||||
}
|
||||
$classes .= ' title_at' . $c_align;
|
||||
if ( ! empty( $c_icon ) ) {
|
||||
$classes .= ' icon_' . $c_icon . ' iconpos_' . $c_position;
|
||||
} else {
|
||||
$classes .= ' icon_none';
|
||||
}
|
||||
} else {
|
||||
// For accordion state of tabs
|
||||
$classes .= ' icon_chevron iconpos_right';
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
if ( ! empty( $el_class ) ) {
|
||||
$classes .= ' ' . $el_class;
|
||||
}
|
||||
|
||||
if ( $el_id != '' ) {
|
||||
$el_id_string = ' id="' . esc_attr( $el_id ) . '"';
|
||||
}
|
||||
|
||||
// Generate inline styles for Tabs & Tour
|
||||
if ( $shortcode_base != 'vc_tta_accordion' ) {
|
||||
$list_inline_css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $title_font,
|
||||
'font-weight' => $title_weight,
|
||||
'text-transform' => $title_transform,
|
||||
'font-size' => $title_size,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Output the element
|
||||
$output = '<div class="w-tabs' . $classes . ' "' . $el_id_string . '>';
|
||||
$output .= '<div class="w-tabs-list' . $list_classes . '"' . $list_inline_css . '>';
|
||||
$output .= '<div class="w-tabs-list-h">';
|
||||
foreach ( $us_tabs_atts as $index => $tab_atts ) {
|
||||
$tab_atts['title'] = isset( $tab_atts['title'] ) ? us_replace_comment_count_var( $tab_atts['title'] ) : '';
|
||||
$tab_atts['i_position'] = isset( $tab_atts['i_position'] ) ? $tab_atts['i_position'] : 'left';
|
||||
$tab_atts['el_class'] = isset( $tab_atts['el_class'] ) ? ' ' . $tab_atts['el_class'] : '';
|
||||
|
||||
$item_tag = 'div';
|
||||
$item_tag_href = '';
|
||||
if ( ! empty( $tab_atts['tab_id'] ) ) {
|
||||
$item_tag = 'a';
|
||||
$item_tag_href = ' href="#' . $tab_atts['tab_id'] . '"';
|
||||
}
|
||||
|
||||
$active_class = ( isset( $tab_atts['active'] ) AND $tab_atts['active'] ) ? ' active' : '';
|
||||
$active_class .= ( isset( $tab_atts['defined_active'] ) AND $tab_atts['defined_active'] ) ? ' defined-active' : '';
|
||||
$icon_class = isset( $tab_atts['icon'] ) ? ' with_icon' : '';
|
||||
$output .= '<div class="w-tabs-item' . $active_class . $icon_class . $tab_atts['el_class'] . '"><' . $item_tag . $item_tag_href . ' class="w-tabs-item-h">';
|
||||
if ( isset( $tab_atts['icon'] ) AND $tab_atts['i_position'] == 'left' ) {
|
||||
$output .= us_prepare_icon_tag( $tab_atts['icon'] );
|
||||
}
|
||||
$output .= '<span class="w-tabs-item-title">' . $tab_atts['title'] . '</span>';
|
||||
if ( isset( $tab_atts['icon'] ) AND $tab_atts['i_position'] == 'right' ) {
|
||||
$output .= us_prepare_icon_tag( $tab_atts['icon'] );
|
||||
}
|
||||
$output .= '</' . $item_tag . '></div>';
|
||||
}
|
||||
$output .= '</div></div>';
|
||||
|
||||
// Handling inner tabs
|
||||
global $us_tab_index;
|
||||
$us_tab_index = 0;
|
||||
|
||||
$output .= '<div class="w-tabs-sections"><div class="w-tabs-sections-h">' . do_shortcode( $content ) . '</div></div></div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: us_btn
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
* @var $content string Shortcode's inner content
|
||||
*
|
||||
* @var $link string Video link
|
||||
* @var $ratio string Ratio: '16x9' / '4x3' / '3x2' / '1x1'
|
||||
* @var $max_width string Max width in pixels
|
||||
* @var $align string Video alignment: 'left' / 'center' / 'right'
|
||||
* @var $css string Extra css
|
||||
* @var $el_id string element ID
|
||||
* @var $el_class string Extra class name
|
||||
*/
|
||||
|
||||
$classes = $inline_css = $embed_html = $video_title = '';
|
||||
$hide_video_title = ! empty( $hide_video_title ) ? TRUE : FALSE;
|
||||
$hide_controls = ! empty( $hide_controls ) ? TRUE : FALSE;
|
||||
|
||||
if ( ! empty( $ratio ) ) {
|
||||
$classes .= ' ratio_' . $ratio;
|
||||
}
|
||||
|
||||
if ( ! empty( $max_width ) ) {
|
||||
$classes .= ' align_' . $align;
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'max-width' => $max_width,
|
||||
)
|
||||
);
|
||||
}
|
||||
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
|
||||
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
|
||||
}
|
||||
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
|
||||
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
|
||||
|
||||
foreach ( us_config( 'embeds' ) as $provider => $embed ) {
|
||||
if ( $embed['type'] != 'video' OR ! preg_match( $embed['regex'], $link, $matches ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $hide_controls AND $provider == 'youtube' ) {
|
||||
$video_title = '?controls=0';
|
||||
} elseif ( $hide_video_title AND $provider == 'vimeo' ) {
|
||||
$video_title = '&byline=0&title=0';
|
||||
}
|
||||
$video_id = $matches[ $embed['match_index'] ];
|
||||
$embed_html = str_replace( '<id>', $video_id, $embed['html'] );
|
||||
$embed_html = str_replace( '<video-title>', $video_title, $embed_html );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( empty( $embed_html ) ) {
|
||||
// Using the default WordPress way
|
||||
global $wp_embed;
|
||||
$embed_html = $wp_embed->run_shortcode( '[embed]' . $link . '[/embed]' );
|
||||
}
|
||||
|
||||
$output = '<div class="w-video' . $classes . '"' . $inline_css . $el_id . '><div class="w-video-h">' . $embed_html . '</div></div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Shortcode: vc_wp_custommenu
|
||||
*
|
||||
* Overloaded by UpSolution custom implementation.
|
||||
*
|
||||
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
|
||||
*
|
||||
*/
|
||||
|
||||
$atts = us_shortcode_atts( $atts, $shortcode_base );
|
||||
|
||||
$classes = '';
|
||||
|
||||
if ( ! empty( $layout ) ) {
|
||||
$classes .= ' layout_' . $layout;
|
||||
}
|
||||
$classes .= ' align_' . $align;
|
||||
if ( $el_class != '' ) {
|
||||
$classes .= ' ' . $el_class;
|
||||
}
|
||||
|
||||
$inline_css = us_prepare_inline_css( array( 'font-size' => $font_size ) );
|
||||
|
||||
$output = '<div class="vc_wp_custommenu ' . esc_attr( $classes ) . '"';
|
||||
if ( ! empty( $el_id ) ) {
|
||||
$output .= ' id="' . $el_id . '"';
|
||||
}
|
||||
$output .= $inline_css . '>';
|
||||
$type = 'WP_Nav_Menu_Widget';
|
||||
$args = array();
|
||||
global $wp_widget_factory;
|
||||
// to avoid unwanted warnings let's check before using widget
|
||||
if ( is_object( $wp_widget_factory ) AND isset( $wp_widget_factory->widgets, $wp_widget_factory->widgets[ $type ] ) ) {
|
||||
ob_start();
|
||||
the_widget( $type, $atts, $args );
|
||||
$output .= ob_get_clean();
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
} else {
|
||||
echo 'Widget ' . esc_attr( $type ) . 'Not found in : vc_wp_custommenu';
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output elements list to choose from
|
||||
* @var array $elements Set of elements to display
|
||||
*/
|
||||
|
||||
global $cl_uri;
|
||||
|
||||
$elements = isset($elements) ? $elements : us_config( 'header-settings.elements', array() );
|
||||
|
||||
$output = '<div class="us-bld-window for_adding"><div class="us-bld-window-h"><div class="us-bld-window-header">';
|
||||
$output .= '<div class="us-bld-window-title">' . __( 'Add element', 'us' ) . '</div>';
|
||||
$output .= '<div class="us-bld-window-closer" title="' . us_translate( 'Close' ) . '"></div></div>';
|
||||
$output .= '<div class="us-bld-window-body"><ul class="us-bld-window-list">';
|
||||
foreach ( $elements as $name ) {
|
||||
$elm = us_config( 'elements/' . $name );
|
||||
if ( isset( $elm['place_if'] ) AND $elm['place_if'] === FALSE ) {
|
||||
continue;
|
||||
}
|
||||
$output .= '<li class="us-bld-window-item type_' . $name . '" data-name="' . $name . '"><div class="us-bld-window-item-h">';
|
||||
$output .= '<div class="us-bld-window-item-icon';
|
||||
if ( isset( $elm['icon'] ) AND ! empty( $elm['icon'] ) ) {
|
||||
$output .= ' ' . $elm['icon'];
|
||||
}
|
||||
$output .= '"></div>';
|
||||
$output .= '<div class="us-bld-window-item-title">' . ( isset( $elm['title'] ) ? $elm['title'] : $name ) . '</div>';
|
||||
if ( isset( $elm['description'] ) AND ! empty( $elm['description'] ) ) {
|
||||
$output .= '<div class="us-bld-window-item-description">' . $elm['description'] . '</div>';
|
||||
}
|
||||
$output .= '</div></li>';
|
||||
}
|
||||
$output .= '</ul></div></div></div>';
|
||||
|
||||
echo $output;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output export-import dialog
|
||||
* @var string $title
|
||||
* @var string $text
|
||||
* @var string $save_text
|
||||
*/
|
||||
|
||||
$title = isset( $title ) ? $title : '';
|
||||
$text = isset( $text ) ? $text : '';
|
||||
$save_text = isset( $save_text ) ? $save_text : '';
|
||||
|
||||
?>
|
||||
<div class="us-bld-window for_export_import">
|
||||
<div class="us-bld-window-h">
|
||||
<div class="us-bld-window-header">
|
||||
<div class="us-bld-window-title"><?php echo $title ?></div>
|
||||
<div class="us-bld-window-closer" title="<?php echo us_translate( 'Close' ) ?>"></div>
|
||||
</div>
|
||||
<div class="us-bld-window-body usof-container">
|
||||
<div class="usof-form-row type_transfer desc_1">
|
||||
<div class="usof-form-row-title">
|
||||
<span><?php echo $text ?></span>
|
||||
</div>
|
||||
<div class="usof-form-row-field">
|
||||
<div class="usof-form-row-control">
|
||||
<textarea></textarea>
|
||||
</div>
|
||||
<div class="usof-form-row-state"><?php echo us_translate( 'Invalid data provided.' ) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="us-bld-window-footer">
|
||||
<div class="us-bld-window-btn for_close"><span><?php echo us_translate( 'Close' ) ?></span></div>
|
||||
<div class="us-bld-window-btn for_save"><span><?php echo $save_text ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Outputs page's Footer
|
||||
*/
|
||||
|
||||
$us_layout = US_Layout::instance();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
global $us_iframe, $us_hide_footer;
|
||||
if ( ( ! isset( $us_iframe ) OR ! $us_iframe ) AND ( ! isset( $us_hide_footer ) OR ! $us_hide_footer ) ) {
|
||||
do_action( 'us_before_footer' );
|
||||
?>
|
||||
<footer class="l-footer"<?php echo ( us_get_option( 'schema_markup' ) ) ? ' itemscope itemtype="https://schema.org/WPFooter"' : ''; ?>>
|
||||
<?php
|
||||
$footer_id = us_get_page_area_id( 'footer' );
|
||||
|
||||
// Output content of Page Block (us_page_block) post
|
||||
$footer_content = '';
|
||||
if ( $footer_id != '' ) {
|
||||
|
||||
$footer = get_post( (int) $footer_id );
|
||||
|
||||
us_open_wp_query_context();
|
||||
if ( $footer ) {
|
||||
$translated_footer_id = apply_filters( 'wpml_object_id', $footer->ID, 'us_page_block', TRUE );
|
||||
if ( $translated_footer_id != $footer->ID ) {
|
||||
$footer = get_post( $translated_footer_id );
|
||||
}
|
||||
|
||||
us_add_to_page_block_ids( $translated_footer_id );
|
||||
|
||||
us_add_page_shortcodes_custom_css( $translated_footer_id );
|
||||
|
||||
$footer_content = $footer->post_content;
|
||||
}
|
||||
us_close_wp_query_context();
|
||||
|
||||
// Apply filters to Page Block content and echoing it ouside of us_open_wp_query_context,
|
||||
// so all WP widgets (like WP Nav Menu) would work as they should
|
||||
echo apply_filters( 'us_page_block_the_content', $footer_content );
|
||||
|
||||
if ( $footer ) {
|
||||
us_remove_from_page_block_ids();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</footer>
|
||||
<?php
|
||||
do_action( 'us_after_footer' );
|
||||
}
|
||||
if ( us_get_option( 'back_to_top', 1 ) ) {
|
||||
?>
|
||||
<a class="w-toplink pos_<?php echo us_get_option( 'back_to_top_pos', 'right' ) ?>" href="#" title="<?php _e( 'Back to top', 'us' ); ?>" aria-hidden="true"></a>
|
||||
<?php
|
||||
}
|
||||
if ( $us_layout->header_show != 'never' ) {
|
||||
?>
|
||||
<a class="w-header-show" href="javascript:void(0);"><span><?php echo us_translate( 'Menu' ) ?></span></a>
|
||||
<div class="w-header-overlay"></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
// Store some global theme options used in JS
|
||||
if ( window.$us === undefined ) {
|
||||
window.$us = {};
|
||||
}
|
||||
$us.canvasOptions = ( $us.canvasOptions || {} );
|
||||
$us.canvasOptions.disableEffectsWidth = <?php echo intval( us_get_option( 'disable_effects_width', 900 ) ) ?>;
|
||||
$us.canvasOptions.responsive = <?php echo us_get_option( 'responsive_layout', TRUE ) ? 'true' : 'false' ?>;
|
||||
$us.canvasOptions.backToTopDisplay = <?php echo intval( us_get_option( 'back_to_top_display', 100 ) ) ?>;
|
||||
$us.canvasOptions.scrollDuration = <?php echo intval( us_get_option( 'smooth_scroll_duration', 1000 ) ) ?>;
|
||||
|
||||
$us.langOptions = ( $us.langOptions || {} );
|
||||
$us.langOptions.magnificPopup = ( $us.langOptions.magnificPopup || {} );
|
||||
$us.langOptions.magnificPopup.tPrev = '<?php _e( 'Previous (Left arrow key)', 'us' ); ?>';
|
||||
$us.langOptions.magnificPopup.tNext = '<?php _e( 'Next (Right arrow key)', 'us' ); ?>';
|
||||
$us.langOptions.magnificPopup.tCounter = '<?php _ex( '%curr% of %total%', 'Example: 3 of 12', 'us' ); ?>';
|
||||
|
||||
$us.navOptions = ( $us.navOptions || {} );
|
||||
$us.navOptions.mobileWidth = <?php echo intval( us_get_option( 'menu_mobile_width', 900 ) ) ?>;
|
||||
$us.navOptions.togglable = <?php echo us_get_option( 'menu_togglable_type', TRUE ) ? 'true' : 'false' ?>;
|
||||
$us.ajaxLoadJs = <?php echo us_get_option( 'ajax_load_js', 0 ) ? 'true' : 'false' ?>;
|
||||
$us.templateDirectoryUri = '<?php global $us_template_directory_uri; echo $us_template_directory_uri; ?>';
|
||||
</script>
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's agreement box
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
* @var $checked bool checked
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/checkbox'
|
||||
* @action After the template: 'us_after_template:templates/form/checkbox'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/checkbox'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$value = isset( $value ) ? trim( $value ) : '1';
|
||||
$checked = ( isset( $checked ) AND $checked ) ? 'checked' : '';
|
||||
$classes .= ' required';
|
||||
$required_atts = 'data-required="true" aria-required="true"';
|
||||
?>
|
||||
<div class="w-form-row for_agreement<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) . ' <span class="required">*</span>' ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars ) ?>
|
||||
<label>
|
||||
<input class="screen-reader-text" type="checkbox" name="<?php echo( ! empty( $name ) ? $name : $field_id ) ?>" <?php echo esc_attr( $checked ) . 'value="' . esc_attr( $value ) . '"' ?> <?php echo $required_atts ?>/>
|
||||
<span class="w-form-checkbox"></span>
|
||||
<span><?php echo strip_tags( $value, '<a><br><strong>' ) ?></span>
|
||||
</label>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'You need to agree with the terms to proceed', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's captcha field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/captcha'
|
||||
* @action After the template: 'us_after_template:templates/form/captcha'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/captcha'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$label = strip_tags( $label, '<a><br><strong>' );
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$numbers = array( rand( 16, 30 ), rand( 1, 15 ) );
|
||||
$sign = rand( 0, 1 );
|
||||
$label .= ' <span>' . implode( $sign ? ' + ' : ' - ', $numbers );
|
||||
$result_hash = md5( ( $numbers[0] + ( $sign ? 1 : - 1 ) * $numbers[1] ) . NONCE_SALT );
|
||||
|
||||
// Always required field
|
||||
$classes .= ' required';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' = ?</span>';
|
||||
}
|
||||
|
||||
$field_atts = 'type="text"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
$field_atts .= ' placeholder="' . esc_attr( $placeholder ) . '"';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_captcha<?php echo $classes ?>">
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo $label ?></span>
|
||||
</div>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_captcha_start', $vars ) ?>
|
||||
<input type="hidden" name="<?php echo( ! empty( $name ) ? $name : $field_id ) ?>_hash" value="<?php echo $result_hash ?>" />
|
||||
<?php echo $icon; ?>
|
||||
<input <?php echo $field_atts ?>"/>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_captcha_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Enter the equation result to proceed', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's checkboxes
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $description string Field description
|
||||
* @var $required bool Is the field required?
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
* @var $values string Field values
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/checkboxes'
|
||||
* @action After the template: 'us_after_template:templates/form/checkboxes'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/checkboxes'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$required = isset( $required ) ? $required : FALSE;
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$values = isset( $values ) ? explode( "\n", $values ) : array();
|
||||
|
||||
// Do not show this field if it has no values
|
||||
if ( empty( $values ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$field_atts = 'type="checkbox"';
|
||||
$field_atts .= ' class="screen-reader-text"';
|
||||
$field_atts .= ' name="' . $field_id . '[]"';
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= 'data-required="true" aria-required="true"';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_checkboxes<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) . ( $required ? ' <span class="required">*</span>' : '' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
foreach ( $values as $key => $value ) {
|
||||
$value = trim( $value );
|
||||
if ( empty( $value ) ) {
|
||||
continue;
|
||||
}
|
||||
$checkbox_id = $field_id . '_' . ( $key + 1 );
|
||||
?>
|
||||
<label>
|
||||
<input value="<?php echo esc_attr( $value ) ?>" <?php echo $field_atts ?>/>
|
||||
<span class="w-form-checkbox"></span>
|
||||
<span><?php echo strip_tags( $value, '<a><br><strong>' ) ?></span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Select an option', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's email field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $required bool Is the field required?
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/email'
|
||||
* @action After the template: 'us_after_template:templates/form/email'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/email'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$required = ( isset( $required ) AND $required );
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = 'type="email"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
$field_atts .= ' value="' . esc_attr( $value ) . '"';
|
||||
if ( $required AND ! empty( $placeholder ) AND empty( $label ) ) {
|
||||
$placeholder .= ' *';
|
||||
}
|
||||
$field_atts .= ' placeholder="' . strip_tags( $placeholder ) . '"';
|
||||
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_email<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<input <?php echo $field_atts ?>/>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php echo us_translate( 'Please enter a valid email address.' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a single form
|
||||
*
|
||||
* @var $type string Form type: 'contact' / 'search' / 'comment' / 'protectedpost' / ...
|
||||
* @var $action string Form action
|
||||
* @var $method string Form method: 'post' / 'get'
|
||||
* @var $fields array Form fields (see any of the fields template header for details)
|
||||
* @var $content string
|
||||
* @var $json_data array Json data to pass to JavaScript
|
||||
* @var $classes string Additional classes to append to form
|
||||
* @var $start_html string HTML to append to the form's start
|
||||
* @var $end_html string HTML to append to the form's end
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/form'
|
||||
* @action After the template: 'us_after_template:templates/form/form'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/form'
|
||||
*/
|
||||
|
||||
// Variables defaults and filtering
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$action = isset( $action ) ? $action : site_url( $_SERVER['REQUEST_URI'] );
|
||||
$method = isset( $method ) ? $method : 'post';
|
||||
$fields = isset( $fields ) ? (array) $fields : array();
|
||||
|
||||
// Repeatable fields IDs start from 1
|
||||
$repeatable_fields = array(
|
||||
'text' => 1,
|
||||
'email' => 1,
|
||||
'textarea' => 1,
|
||||
'select' => 1,
|
||||
'agreement' => 1,
|
||||
'checkboxes' => 1,
|
||||
'radio' => 1,
|
||||
);
|
||||
|
||||
foreach ( $fields as $field_name => $field ) {
|
||||
if ( isset( $field['type'] ) ) {
|
||||
$fields[ $field_name ]['type'] = $field['type'];
|
||||
if ( in_array( $field['type'], array_keys( $repeatable_fields ) ) ) {
|
||||
$fields[ $field_name ]['field_id'] = $repeatable_fields[ $field['type'] ];
|
||||
$repeatable_fields[ $field['type'] ] += 1;
|
||||
}
|
||||
if ( $field['type'] == 'agreement' ) {
|
||||
$field['required'] = 1;
|
||||
}
|
||||
} else {
|
||||
$fields[ $field_name ]['type'] = 'text';
|
||||
}
|
||||
}
|
||||
|
||||
$json_data = array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
);
|
||||
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
$el_id = isset( $el_id ) ? $el_id : '';
|
||||
$start_html = isset( $start_html ) ? $start_html : '';
|
||||
$end_html = isset( $end_html ) ? $end_html : '';
|
||||
if ( ! empty( $type ) ) {
|
||||
$classes = ' for_' . $type . $classes;
|
||||
}
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$classes .= ' us_form_' . $us_cform_index;
|
||||
?>
|
||||
<div class="w-form<?php echo $classes ?>"<?php echo $el_id ?>>
|
||||
<form class="w-form-h" autocomplete="off" action="<?php echo esc_attr( $action ) ?>" method="<?php echo $method ?>">
|
||||
<?php echo $start_html ?>
|
||||
<?php foreach ( $fields as $field ):
|
||||
if ( isset( $field['type'] ) ) {
|
||||
us_load_template( 'templates/form/' . $field['type'], $field );
|
||||
}
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<div class="w-form-message"></div>
|
||||
<?php echo $end_html ?>
|
||||
</form>
|
||||
<div class="w-form-json hidden"<?php echo us_pass_data_to_js( $json_data ) ?>></div>
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's hidden field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $value string Field value
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/hidden'
|
||||
* @action After the template: 'us_after_template:templates/form/hidden'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/hidden'
|
||||
*/
|
||||
|
||||
$name = isset( $label ) ? $label : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
|
||||
?>
|
||||
<input type="hidden" name="<?php echo esc_attr( $name ) ?>" value="<?php echo esc_attr( $value ) ?>" />
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's info field
|
||||
*
|
||||
* @var $value string Field value
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/info'
|
||||
* @action After the template: 'us_after_template:templates/form/info'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/info'
|
||||
*/
|
||||
|
||||
$value = isset( $value ) ? trim( $value ) : '';
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
?>
|
||||
<div class="w-form-row for_info<?php echo $classes ?>">
|
||||
<p><?php echo strip_tags( $value, '<a><br><strong>' ) ?></p>
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
/**
|
||||
* Output a form's nonce field
|
||||
*
|
||||
* @var $name string Nonce Name
|
||||
* @var $action string Nonce Action
|
||||
*/
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$action = isset( $action ) ? $action : '';
|
||||
|
||||
if ( ! empty( $action ) AND ! empty( $name ) ) {
|
||||
wp_nonce_field( $action, $name );
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's password field
|
||||
*
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $required bool Is the field required?
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/password'
|
||||
* @action After the template: 'us_after_template:templates/form/password'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/password'
|
||||
*/
|
||||
global $us_cform_index;
|
||||
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$required = ( isset( $required ) AND $required );
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = 'type="password"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
$field_atts .= ' value="' . esc_attr( $value ) . '"';
|
||||
if ( $required AND ! empty( $placeholder ) AND empty( $label ) ) {
|
||||
$placeholder .= ' *';
|
||||
}
|
||||
$field_atts .= ' placeholder="' . esc_attr( $placeholder ) . '"';
|
||||
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_password<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<input <?php echo $field_atts ?>/>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Fill out this field', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's radio input
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
* @var $values string Field values
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/radio'
|
||||
* @action After the template: 'us_after_template:templates/form/radio'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/radio'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$required = isset( $required ) ? $required : FALSE;
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$values = isset( $values ) ? explode( "\n", $values ) : array();
|
||||
|
||||
// Do not show this field if it has no values
|
||||
if ( empty( $values ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$field_atts = 'type="radio"';
|
||||
$field_atts .= ' class="screen-reader-text"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= 'data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_radio<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
foreach ( $values as $key => $value ) {
|
||||
$value = trim( $value );
|
||||
if ( empty( $value ) ) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<label>
|
||||
<input <?php echo $field_atts ?> value="<?php echo esc_attr( $value ) ?>"<?php checked( $key, 0 ) ?>/>
|
||||
<span class="w-form-radio"></span>
|
||||
<span><?php echo strip_tags( $value, '<a><br><strong>' ) ?></span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Select an option', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's select field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
* @var $values string Field values
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/select'
|
||||
* @action After the template: 'us_after_template:templates/form/select'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/select'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
$values = isset( $values ) ? explode( "\n", trim( $values ) ) : array();
|
||||
|
||||
// Do not show this field if it has no values
|
||||
if ( empty( $values ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = '';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_select<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<select <?php echo $field_atts ?>>
|
||||
<?php
|
||||
foreach ( $values as $value ) {
|
||||
echo '<option value="' . esc_attr( $value ) . '">' . $value . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Select an option', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's hidden field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $classes string Additional field classes
|
||||
* @var $title string Submit button title
|
||||
* @var $btn_classes string Additional button classes
|
||||
* @var $btn_inner_css string Button inner css
|
||||
* @var $btn_size_mobiles string Button Size on Mobiles
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/submit'
|
||||
* @action After the template: 'us_after_template:templates/form/submit'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/submit'
|
||||
*/
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
$title = ! empty( $title ) ? $title : us_translate( 'Submit' );
|
||||
$btn_classes = ! empty( $btn_classes ) ? ( ' ' . $btn_classes ) : '';
|
||||
$btn_inner_css = ! empty( $btn_inner_css ) ? ( ' style="' . $btn_inner_css . '"' ) : '';
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$icon_pos = isset( $icon_pos ) ? $icon_pos : 'left';
|
||||
|
||||
// Add Size on mobiles as inline style tag
|
||||
$inline_style = '';
|
||||
if ( ! empty( $btn_size_mobiles ) ) {
|
||||
global $us_cform_index;
|
||||
$inline_style .= '<style>@media(max-width:600px){.us_form_' . $us_cform_index . ' .w-btn{font-size:' . $btn_size_mobiles . '!important}}</style>';
|
||||
}
|
||||
|
||||
// Swap icon position for RTL
|
||||
if ( is_rtl() ) {
|
||||
$icon_pos = ( $icon_pos == 'left' ) ? 'right' : 'left';
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="w-form-row for_submit<?php echo $classes ?>">
|
||||
<div class="w-form-row-field">
|
||||
<?php echo $inline_style ?>
|
||||
<button class="w-btn<?php echo $btn_classes ?>"<?php echo $btn_inner_css ?> type="submit" aria-label="<?php echo esc_attr( $title ) ?>">
|
||||
<span class="g-preloader type_1"></span>
|
||||
<?php echo ( $icon_pos == 'left' ) ? $icon : ''; ?>
|
||||
<span class="w-btn-label"><?php echo strip_tags( $title, '<br>' ) ?></span>
|
||||
<?php echo ( $icon_pos == 'right' ) ? $icon : ''; ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's text field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $required bool Is the field required?
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/text'
|
||||
* @action After the template: 'us_after_template:templates/form/text'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/text'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$required = ( isset( $required ) AND $required );
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = 'type="text"';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
$field_atts .= ' value="' . esc_attr( $value ) . '"';
|
||||
if ( $required AND ! empty( $placeholder ) AND empty( $label ) ) {
|
||||
$placeholder .= ' *';
|
||||
}
|
||||
$field_atts .= ' placeholder="' . strip_tags( $placeholder ) . '"';
|
||||
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_text<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<input <?php echo $field_atts ?>/>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Fill out this field', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a form's textarea field
|
||||
*
|
||||
* @var $name string Field name
|
||||
* @var $type string Field type
|
||||
* @var $label string Field label
|
||||
* @var $placeholder string Field placeholder
|
||||
* @var $description string Field description
|
||||
* @var $value string Field value
|
||||
* @var $required bool Is the field required?
|
||||
* @var $icon string Field icon
|
||||
* @var $field_id string Field id
|
||||
* @var $classes string Additional field classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/form/textarea'
|
||||
* @action After the template: 'us_after_template:templates/form/textarea'
|
||||
* @filter Template variables: 'us_template_vars:templates/form/textarea'
|
||||
*/
|
||||
|
||||
global $us_cform_index;
|
||||
|
||||
$name = isset( $name ) ? $name : '';
|
||||
$type = isset( $type ) ? $type : '';
|
||||
$label = isset( $label ) ? trim( $label ) : '';
|
||||
$placeholder = isset( $placeholder ) ? trim( $placeholder ) : '';
|
||||
$description = isset( $description ) ? trim( $description ) : '';
|
||||
$value = isset( $value ) ? $value : '';
|
||||
$required = ( isset( $required ) AND $required );
|
||||
$icon = isset( $icon ) ? us_prepare_icon_tag( $icon ) : '';
|
||||
$field_id = isset( $field_id ) ? $field_id : 1;
|
||||
$field_id = 'us_form_' . $us_cform_index . '_' . $type . '_' . $field_id;
|
||||
$classes = ! empty( $classes ) ? ( ' ' . $classes ) : '';
|
||||
|
||||
if ( ! empty( $label ) ) {
|
||||
$aria_label = $label;
|
||||
} elseif ( empty( $label ) AND ! empty( $placeholder ) ) {
|
||||
$aria_label = $placeholder;
|
||||
} else {
|
||||
$aria_label = $field_id;
|
||||
}
|
||||
|
||||
$field_atts = '';
|
||||
if ( ! empty( $name ) ) {
|
||||
$field_atts .= ' name="' . $name . '"';
|
||||
} else {
|
||||
$field_atts .= ' name="' . $field_id . '"';
|
||||
}
|
||||
$field_atts .= ' aria-label="' . strip_tags( $aria_label ) . '"';
|
||||
if ( $required AND ! empty( $placeholder ) AND empty( $label ) ) {
|
||||
$placeholder .= ' *';
|
||||
}
|
||||
$field_atts .= ' placeholder="' . strip_tags( $placeholder ) . '"';
|
||||
|
||||
if ( $required ) {
|
||||
$classes .= ' required';
|
||||
$field_atts .= ' data-required="true" aria-required="true"';
|
||||
if ( ! empty( $label ) ) {
|
||||
$label .= ' <span class="required">*</span>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $icon ) ) {
|
||||
$classes .= ' with_icon';
|
||||
}
|
||||
?>
|
||||
<div class="w-form-row for_textarea<?php echo $classes ?>">
|
||||
<?php if ( ! empty( $label ) ) : ?>
|
||||
<div class="w-form-row-label">
|
||||
<span><?php echo strip_tags( $label, '<a><br><strong>' ) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-field">
|
||||
<?php do_action( 'us_form_field_start', $vars );
|
||||
echo $icon;
|
||||
?>
|
||||
<textarea <?php echo $field_atts ?>><?php echo esc_textarea( $value ) ?></textarea>
|
||||
<span class="w-form-row-field-bar"></span>
|
||||
<?php do_action( 'us_form_field_end', $vars ) ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $description ) ) : ?>
|
||||
<div class="w-form-row-description">
|
||||
<?php echo strip_tags( $description, '<a><br><strong>' ) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="w-form-row-state"><?php _e( 'Fill out this field', 'us' ) ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output elements list to choose from
|
||||
*
|
||||
* @var $body string Optional predefined body
|
||||
*/
|
||||
global $us_template_directory_uri;
|
||||
|
||||
$templates = us_config( 'grid-templates', array() );
|
||||
|
||||
if ( ! isset( $body ) ) {
|
||||
$params_defaults = array();
|
||||
|
||||
$body = '<ul class="us-bld-window-list">';
|
||||
foreach ( $templates as $name => $template ) {
|
||||
$template_title = isset( $template['title'] ) ? $template['title'] : ucfirst( $name );
|
||||
$template = us_fix_grid_settings( $template );
|
||||
$body .= '<li data-name="' . esc_attr( $name ) . '" class="us-bld-window-item type_gtemplate ' . $name . '">';
|
||||
$body .= '<div class="us-bld-window-item-h">';
|
||||
$body .= '<div class="us-bld-window-item-icon">';
|
||||
$body .= '<img src="' . $us_template_directory_uri . '/admin/img/grid-templates/' . $name . '.jpg" />';
|
||||
$body .= '</div>';
|
||||
$body .= '<div class="us-bld-window-item-title">' . $template_title . '</div>';
|
||||
$body .= '<div class="us-bld-window-item-data hidden"' . us_pass_data_to_js( $template ) . '></div>';
|
||||
$body .= '</div>';
|
||||
$body .= '</li>';
|
||||
}
|
||||
$body .= '</ul>';
|
||||
}
|
||||
|
||||
$output = '<div class="us-bld-window for_templates"><div class="us-bld-window-h">';
|
||||
$output .= '<div class="us-bld-window-header"><div class="us-bld-window-title">' . __( 'Grid Layout Templates', 'us' ) . '</div><div class="us-bld-window-closer" title="' . us_translate( 'Close' ) . '"></div></div>';
|
||||
$output .= '<div class="us-bld-window-body">';
|
||||
$output .= $body;
|
||||
$output .= '<span class="usof-preloader"></span>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div></div>';
|
||||
|
||||
echo $output;
|
||||
@@ -0,0 +1,841 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Generates and outputs header generated stylesheets
|
||||
*
|
||||
* @action Before the template: us_before_template:config/header.css
|
||||
* @action After the template: us_after_template:config/header.css
|
||||
*/
|
||||
global $us_template_directory;
|
||||
|
||||
/* Set breakpoint values */
|
||||
$tablets_breakpoint = us_get_header_option( 'breakpoint', 'tablets' ) ? us_get_header_option( 'breakpoint', 'tablets' ) : '901';
|
||||
$mobiles_breakpoint = us_get_header_option( 'breakpoint', 'mobiles' ) ? us_get_header_option( 'breakpoint', 'mobiles' ) : '601';
|
||||
$desktop_query = '(min-width:' . intval( $tablets_breakpoint ) . 'px)';
|
||||
$tablets_query = '(min-width:' . intval( $mobiles_breakpoint ) . 'px) and (max-width:' . ( intval( $tablets_breakpoint ) - 1 ) . 'px)';
|
||||
$mobiles_query = '(max-width:' . ( intval( $mobiles_breakpoint ) - 1 ) . 'px)';
|
||||
|
||||
/* Header styles as variables */
|
||||
$header_hor_styles = file_get_contents( $us_template_directory . '/css/base/header-hor.css' );
|
||||
$header_ver_styles = file_get_contents( $us_template_directory . '/css/base/header-ver.css' );
|
||||
?>
|
||||
|
||||
/* =============================================== */
|
||||
/* ================ Default state ================ */
|
||||
/* =============================================== */
|
||||
|
||||
@media <?php echo $desktop_query ?> {
|
||||
|
||||
.hidden_for_default { display: none !important; }
|
||||
|
||||
<?php if ( ! us_get_header_option( 'top_show' ) ) { ?>
|
||||
.l-subheader.at_top { display: none; }
|
||||
<?php }
|
||||
if ( ! us_get_header_option( 'bottom_show' ) ) { ?>
|
||||
.l-subheader.at_bottom { display: none; }
|
||||
<?php }
|
||||
if ( us_get_header_option( 'bg_img' ) AND $bg_image = usof_get_image_src( us_get_header_option( 'bg_img' ) ) ) { ?>
|
||||
.l-subheader.at_middle {
|
||||
background-image: url(<?php echo $bg_image[0] ?>);
|
||||
background-attachment: <?php echo ( us_get_header_option( 'bg_img_attachment' ) ) ? 'scroll' : 'fixed'; ?>;
|
||||
background-position: <?php echo us_get_header_option( 'bg_img_position' ) ?>;
|
||||
background-repeat: <?php echo us_get_header_option( 'bg_img_repeat' ) ?>;
|
||||
background-size: <?php echo us_get_header_option( 'bg_img_size' ) ?>;
|
||||
}
|
||||
<?php }
|
||||
|
||||
// Horizontal header
|
||||
if ( us_get_header_option( 'orientation' ) == 'hor' ) {
|
||||
echo $header_hor_styles;
|
||||
?>
|
||||
.l-subheader.at_top {
|
||||
line-height: <?php echo us_get_header_option( 'top_height' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'top_height' ) ?>;
|
||||
}
|
||||
.l-header.sticky .l-subheader.at_top {
|
||||
line-height: <?php echo us_get_header_option( 'top_sticky_height' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'top_sticky_height' ) ?>;
|
||||
<?php if ( us_get_header_option( 'top_sticky_height' ) == 0 ): ?>
|
||||
overflow: hidden;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
.l-subheader.at_middle {
|
||||
line-height: <?php echo us_get_header_option( 'middle_height' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'middle_height' ) ?>;
|
||||
}
|
||||
.l-header.sticky .l-subheader.at_middle {
|
||||
line-height: <?php echo us_get_header_option( 'middle_sticky_height' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'middle_sticky_height' ) ?>;
|
||||
<?php if ( us_get_header_option( 'middle_sticky_height' ) == 0 ): ?>
|
||||
overflow: hidden;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
.l-subheader.at_bottom {
|
||||
line-height: <?php echo us_get_header_option( 'bottom_height' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'bottom_height' ) ?>;
|
||||
}
|
||||
.l-header.sticky .l-subheader.at_bottom {
|
||||
line-height: <?php echo us_get_header_option( 'bottom_sticky_height' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'bottom_sticky_height' ) ?>;
|
||||
<?php if ( us_get_header_option( 'bottom_sticky_height' ) == 0 ): ?>
|
||||
overflow: hidden;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
/* Center the middle cell */
|
||||
.l-subheader.with_centering .l-subheader-cell.at_left,
|
||||
.l-subheader.with_centering .l-subheader-cell.at_right {
|
||||
flex-basis: 100px;
|
||||
}
|
||||
|
||||
/* Calculate top padding for content overlapped by sticky header */
|
||||
.l-header.pos_fixed ~ .l-main > .l-section:first-of-type,
|
||||
.l-header.pos_fixed ~ .l-main > .l-section-gap:nth-child(2),
|
||||
.headerinpos_below .l-header.pos_fixed ~ .l-main > .l-section:nth-of-type(2),
|
||||
.l-header.pos_static.bg_transparent ~ .l-main > .l-section:first-of-type {
|
||||
<?php
|
||||
$header_height = us_get_header_option( 'top_show' ) ? intval( us_get_header_option( 'top_height' ) ) : 0;
|
||||
$header_height += intval( us_get_header_option( 'middle_height' ) );
|
||||
$header_height += us_get_header_option( 'bottom_show' ) ? intval( us_get_header_option( 'bottom_height' ) ) : 0;
|
||||
?>
|
||||
padding-top: <?php echo $header_height ?>px;
|
||||
}
|
||||
.headerinpos_bottom .l-header.pos_fixed ~ .l-main > .l-section:first-of-type {
|
||||
padding-bottom: <?php echo $header_height ?>px;
|
||||
}
|
||||
|
||||
/* Fix vertical centering of first section when header is transparent */
|
||||
.l-header.bg_transparent ~ .l-main .l-section.valign_center:first-of-type > .l-section-h {
|
||||
top: -<?php echo $header_height/2 ?>px;
|
||||
}
|
||||
.headerinpos_bottom .l-header.pos_fixed.bg_transparent ~ .l-main .l-section.valign_center:first-of-type > .l-section-h {
|
||||
top: <?php echo $header_height/2 ?>px;
|
||||
}
|
||||
|
||||
/* Calculate height of "Full Screen" rows */
|
||||
.l-header.pos_fixed ~ .l-main .l-section.height_full:not(:first-of-type) {
|
||||
<?php
|
||||
$header_sticky_height = us_get_header_option( 'top_show' ) ? intval( us_get_header_option( 'top_sticky_height' ) ) : 0;
|
||||
$header_sticky_height += intval( us_get_header_option( 'middle_sticky_height' ) );
|
||||
$header_sticky_height += us_get_header_option( 'bottom_show' ) ? intval( us_get_header_option( 'bottom_sticky_height' ) ) : 0;
|
||||
?>
|
||||
min-height: calc(100vh - <?php echo $header_sticky_height ?>px);
|
||||
}
|
||||
.admin-bar .l-header.pos_fixed ~ .l-main .l-section.height_full:not(:first-of-type) {
|
||||
min-height: calc(100vh - <?php echo $header_sticky_height + 32 ?>px);
|
||||
}
|
||||
.l-header.pos_static.bg_solid ~ .l-main .l-section.height_full:first-of-type {
|
||||
min-height: calc(100vh - <?php echo $header_height ?>px);
|
||||
}
|
||||
|
||||
/* Calculate position of "Sticky" rows */
|
||||
.l-header.pos_fixed ~ .l-main .l-section.sticky {
|
||||
top: <?php echo $header_sticky_height ?>px;
|
||||
}
|
||||
.admin-bar .l-header.pos_fixed ~ .l-main .l-section.sticky {
|
||||
top: <?php echo $header_sticky_height + 32 ?>px;
|
||||
}
|
||||
.l-header.pos_fixed.sticky ~ .l-main .l-section.type_sticky:first-of-type {
|
||||
padding-top: <?php echo $header_sticky_height ?>px;
|
||||
}
|
||||
|
||||
/* Initial header position BOTTOM & BELOW */
|
||||
.headerinpos_below .l-header.pos_fixed:not(.sticky) {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
}
|
||||
.headerinpos_bottom .l-header.pos_fixed:not(.sticky) {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
.headerinpos_below .l-header.pos_fixed ~ .l-main > .l-section:first-of-type,
|
||||
.headerinpos_bottom .l-header.pos_fixed ~ .l-main > .l-section:first-of-type {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
.headerinpos_below .l-header.pos_fixed ~ .l-main .l-section.height_full:nth-of-type(2) {
|
||||
min-height: 100vh;
|
||||
}
|
||||
.admin-bar.headerinpos_below .l-header.pos_fixed ~ .l-main .l-section.height_full:nth-of-type(2) {
|
||||
min-height: calc(100vh - 32px); /* WP admin bar height */
|
||||
}
|
||||
.headerinpos_bottom .l-header.pos_fixed:not(.sticky) .w-cart-dropdown,
|
||||
.headerinpos_bottom .l-header.pos_fixed:not(.sticky) .w-nav.type_desktop .w-nav-list.level_2 {
|
||||
bottom: 100%;
|
||||
transform-origin: 0 100%;
|
||||
}
|
||||
.headerinpos_bottom .l-header.pos_fixed:not(.sticky) .w-nav.type_mobile.m_layout_dropdown .w-nav-list.level_1 {
|
||||
top: auto;
|
||||
bottom: 100%;
|
||||
box-shadow: 0 -3px 3px rgba(0,0,0,0.1);
|
||||
}
|
||||
.headerinpos_bottom .l-header.pos_fixed:not(.sticky) .w-nav.type_desktop .w-nav-list.level_3,
|
||||
.headerinpos_bottom .l-header.pos_fixed:not(.sticky) .w-nav.type_desktop .w-nav-list.level_4 {
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
transform-origin: 0 100%;
|
||||
}
|
||||
<?php } else {
|
||||
// Vertical header
|
||||
echo $header_ver_styles;
|
||||
?>
|
||||
html:not(.no-touch) .l-header.scrollable {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
}
|
||||
.l-body {
|
||||
padding-left: <?php echo us_get_header_option( 'width' ) ?>;
|
||||
position: relative;
|
||||
}
|
||||
.l-body.rtl {
|
||||
padding-left: 0;
|
||||
padding-right: <?php echo us_get_header_option( 'width' ) ?>;
|
||||
}
|
||||
.l-header,
|
||||
.l-header .w-cart-notification,
|
||||
.w-nav.type_mobile.m_layout_panel .w-nav-list.level_1 {
|
||||
width: <?php echo us_get_header_option( 'width' ) ?>;
|
||||
}
|
||||
.l-body.rtl .l-header {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
.l-body:not(.rtl) .post_navigation.layout_sided .order_first {
|
||||
left: calc(<?php echo us_get_header_option( 'width' ) ?> - 14rem);
|
||||
}
|
||||
.l-body:not(.rtl) .w-toplink.pos_left,
|
||||
.l-body:not(.rtl) .l-section.sticky,
|
||||
.no-touch .l-body:not(.rtl) .post_navigation.layout_sided .order_first:hover {
|
||||
left: <?php echo us_get_header_option( 'width' ) ?>;
|
||||
}
|
||||
.l-body.rtl .post_navigation.layout_sided .order_second {
|
||||
right: calc(<?php echo us_get_header_option( 'width' ) ?> - 14rem);
|
||||
}
|
||||
.l-body.rtl .w-toplink.pos_right,
|
||||
.l-body.rtl .l-section.sticky,
|
||||
.no-touch .l-body.rtl .post_navigation.layout_sided .order_second:hover {
|
||||
right: <?php echo us_get_header_option( 'width' ) ?>;
|
||||
}
|
||||
.w-nav.type_desktop [class*="columns"] .w-nav-list.level_2 {
|
||||
width: calc(100vw - <?php echo us_get_header_option( 'width' ) ?>);
|
||||
max-width: 980px;
|
||||
}
|
||||
.rtl .w-nav.type_desktop .w-nav-list.level_2 {
|
||||
left: auto;
|
||||
right: 100%;
|
||||
}
|
||||
<?php
|
||||
if ( us_get_header_option( 'elm_align' ) == 'left' ) { ?>
|
||||
.l-subheader-cell {
|
||||
text-align: left;
|
||||
align-items: flex-start;
|
||||
}
|
||||
<?php }
|
||||
if ( us_get_header_option( 'elm_align' ) == 'right' ) { ?>
|
||||
.l-subheader-cell {
|
||||
text-align: right;
|
||||
align-items: flex-end;
|
||||
}
|
||||
<?php }
|
||||
if ( us_get_header_option( 'elm_valign' ) == 'middle' ) { ?>
|
||||
.l-subheader.at_middle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
<?php }
|
||||
if ( us_get_header_option( 'elm_valign' ) == 'bottom' ) { ?>
|
||||
.l-subheader.at_middle {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* =============================================== */
|
||||
/* ================ Tablets state ================ */
|
||||
/* =============================================== */
|
||||
|
||||
@media <?php echo $tablets_query ?> {
|
||||
|
||||
.hidden_for_tablets { display: none !important; }
|
||||
|
||||
<?php if ( ! us_get_header_option( 'top_show', 'tablets' ) ) { ?>
|
||||
.l-subheader.at_top { display: none; }
|
||||
<?php }
|
||||
if ( ! us_get_header_option( 'bottom_show', 'tablets' ) ) { ?>
|
||||
.l-subheader.at_bottom { display: none; }
|
||||
<?php }
|
||||
if ( us_get_header_option( 'bg_img', 'tablets' ) AND $bg_image = usof_get_image_src( us_get_header_option( 'bg_img', 'tablets' ) ) ) { ?>
|
||||
.l-subheader.at_middle {
|
||||
background-image: url(<?php echo $bg_image[0] ?>);
|
||||
background-attachment: <?php echo ( us_get_header_option( 'bg_img_attachment', 'tablets' ) ) ? 'scroll' : 'fixed'; ?>;
|
||||
background-position: <?php echo us_get_header_option( 'bg_img_position', 'tablets' ) ?>;
|
||||
background-repeat: <?php echo us_get_header_option( 'bg_img_repeat', 'tablets' ) ?>;
|
||||
background-size: <?php echo us_get_header_option( 'bg_img_size', 'tablets' ) ?>;
|
||||
}
|
||||
<?php }
|
||||
|
||||
// Horizontal header on Tablets
|
||||
if ( us_get_header_option( 'orientation', 'tablets' ) == 'hor' ) {
|
||||
echo $header_hor_styles;
|
||||
?>
|
||||
.l-subheader.at_top {
|
||||
line-height: <?php echo us_get_header_option( 'top_height', 'tablets' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'top_height', 'tablets' ) ?>;
|
||||
}
|
||||
.l-header.sticky .l-subheader.at_top {
|
||||
line-height: <?php echo us_get_header_option( 'top_sticky_height', 'tablets' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'top_sticky_height', 'tablets' ) ?>;
|
||||
<?php if ( us_get_header_option( 'top_sticky_height', 'tablets' ) == 0 ): ?>
|
||||
overflow: hidden;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
.l-subheader.at_middle {
|
||||
line-height: <?php echo us_get_header_option( 'middle_height', 'tablets' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'middle_height', 'tablets' ) ?>;
|
||||
}
|
||||
.l-header.sticky .l-subheader.at_middle {
|
||||
line-height: <?php echo us_get_header_option( 'middle_sticky_height', 'tablets' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'middle_sticky_height', 'tablets' ) ?>;
|
||||
<?php if ( us_get_header_option( 'middle_sticky_height', 'tablets' ) == 0 ): ?>
|
||||
overflow: hidden;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
.l-subheader.at_bottom {
|
||||
line-height: <?php echo us_get_header_option( 'bottom_height', 'tablets' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'bottom_height', 'tablets' ) ?>;
|
||||
}
|
||||
.l-header.sticky .l-subheader.at_bottom {
|
||||
line-height: <?php echo us_get_header_option( 'bottom_sticky_height', 'tablets' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'bottom_sticky_height', 'tablets' ) ?>;
|
||||
<?php if ( us_get_header_option( 'bottom_sticky_height', 'tablets' ) == 0 ): ?>
|
||||
overflow: hidden;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
/* Calculate top padding for content overlapped by sticky header */
|
||||
.l-header.pos_fixed ~ .l-main > .l-section:first-of-type,
|
||||
.l-header.pos_fixed ~ .l-main > .l-section-gap:nth-child(2),
|
||||
.headerinpos_below .l-header.pos_fixed ~ .l-main > .l-section:nth-of-type(2),
|
||||
.l-header.pos_static.bg_transparent ~ .l-main > .l-section:first-of-type {
|
||||
<?php
|
||||
$header_height = us_get_header_option( 'top_show', 'tablets' ) ? intval( us_get_header_option( 'top_height', 'tablets' ) ) : 0;
|
||||
$header_height += intval( us_get_header_option( 'middle_height', 'tablets' ) );
|
||||
$header_height += us_get_header_option( 'bottom_show', 'tablets' ) ? intval( us_get_header_option( 'bottom_height', 'tablets' ) ) : 0;
|
||||
?>
|
||||
padding-top: <?php echo $header_height ?>px;
|
||||
}
|
||||
|
||||
/* Calculate position of "Sticky" rows */
|
||||
.l-header.pos_fixed ~ .l-main .l-section.sticky {
|
||||
<?php
|
||||
$header_sticky_height = us_get_header_option( 'top_show', 'tablets' ) ? intval( us_get_header_option( 'top_sticky_height', 'tablets' ) ) : 0;
|
||||
$header_sticky_height += intval( us_get_header_option( 'middle_sticky_height', 'tablets' ) );
|
||||
$header_sticky_height += us_get_header_option( 'bottom_show', 'tablets' ) ? intval( us_get_header_option( 'bottom_sticky_height', 'tablets' ) ) : 0;
|
||||
?>
|
||||
top: <?php echo $header_sticky_height ?>px;
|
||||
}
|
||||
.l-header.pos_fixed.sticky ~ .l-main .l-section.type_sticky:first-of-type {
|
||||
padding-top: <?php echo $header_sticky_height ?>px;
|
||||
}
|
||||
<?php } else {
|
||||
// Vertical header on Mobiles
|
||||
echo $header_ver_styles;
|
||||
?>
|
||||
.l-header,
|
||||
.l-header .w-cart-notification,
|
||||
.w-nav.type_mobile.m_layout_panel .w-nav-list.level_1 {
|
||||
width: <?php echo us_get_header_option( 'width', 'tablets' ) ?>;
|
||||
}
|
||||
.w-search.layout_simple,
|
||||
.w-search.layout_modern.active {
|
||||
width: calc(<?php echo us_get_header_option( 'width', 'tablets' ) ?> - 40px);
|
||||
}
|
||||
|
||||
/* Slided vertical header */
|
||||
.w-header-show,
|
||||
.w-header-overlay {
|
||||
display: block;
|
||||
}
|
||||
.l-header {
|
||||
bottom: 0;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
box-shadow: none;
|
||||
transition: transform 0.3s;
|
||||
transform: translate3d(-100%,0,0);
|
||||
}
|
||||
.header-show .l-header {
|
||||
transform: translate3d(0,0,0);
|
||||
}
|
||||
<?php if ( us_get_header_option( 'elm_align', 'tablets' ) == 'left' ) { ?>
|
||||
.l-subheader-cell {
|
||||
text-align: left;
|
||||
align-items: flex-start;
|
||||
}
|
||||
<?php }
|
||||
if ( us_get_header_option( 'elm_align', 'tablets' ) == 'right' ) { ?>
|
||||
.l-subheader-cell {
|
||||
text-align: right;
|
||||
align-items: flex-end;
|
||||
}
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* =============================================== */
|
||||
/* ================ Mobiles state ================ */
|
||||
/* =============================================== */
|
||||
|
||||
@media <?php echo $mobiles_query ?> {
|
||||
|
||||
.hidden_for_mobiles { display: none !important; }
|
||||
|
||||
<?php if ( ! us_get_header_option( 'top_show', 'mobiles' ) ) { ?>
|
||||
.l-subheader.at_top { display: none; }
|
||||
<?php }
|
||||
if ( ! us_get_header_option( 'bottom_show', 'mobiles' ) ) { ?>
|
||||
.l-subheader.at_bottom { display: none; }
|
||||
<?php }
|
||||
if ( us_get_header_option( 'bg_img', 'mobiles' ) AND $bg_image = usof_get_image_src( us_get_header_option( 'bg_img', 'mobiles' ) ) ) { ?>
|
||||
.l-subheader.at_middle {
|
||||
background-image: url(<?php echo $bg_image[0] ?>);
|
||||
background-attachment: <?php echo ( us_get_header_option( 'bg_img_attachment', 'mobiles' ) ) ? 'scroll' : 'fixed'; ?>;
|
||||
background-position: <?php echo us_get_header_option( 'bg_img_position', 'mobiles' ) ?>;
|
||||
background-repeat: <?php echo us_get_header_option( 'bg_img_repeat', 'mobiles' ) ?>;
|
||||
background-size: <?php echo us_get_header_option( 'bg_img_size', 'mobiles' ) ?>;
|
||||
}
|
||||
<?php }
|
||||
|
||||
// Horizontal header on Mobiles
|
||||
if ( us_get_header_option( 'orientation', 'mobiles' ) == 'hor' ) {
|
||||
echo $header_hor_styles;
|
||||
?>
|
||||
.l-subheader.at_top {
|
||||
line-height: <?php echo us_get_header_option( 'top_height', 'mobiles' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'top_height', 'mobiles' ) ?>;
|
||||
}
|
||||
.l-header.sticky .l-subheader.at_top {
|
||||
line-height: <?php echo us_get_header_option( 'top_sticky_height', 'mobiles' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'top_sticky_height', 'mobiles' ) ?>;
|
||||
<?php if ( us_get_header_option( 'top_sticky_height', 'mobiles' ) == 0 ): ?>
|
||||
overflow: hidden;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
.l-subheader.at_middle {
|
||||
line-height: <?php echo us_get_header_option( 'middle_height', 'mobiles' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'middle_height', 'mobiles' ) ?>;
|
||||
}
|
||||
.l-header.sticky .l-subheader.at_middle {
|
||||
line-height: <?php echo us_get_header_option( 'middle_sticky_height', 'mobiles' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'middle_sticky_height', 'mobiles' ) ?>;
|
||||
<?php if ( us_get_header_option( 'middle_sticky_height', 'mobiles' ) == 0 ): ?>
|
||||
overflow: hidden;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
.l-subheader.at_bottom {
|
||||
line-height: <?php echo us_get_header_option( 'bottom_height', 'mobiles' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'bottom_height', 'mobiles' ) ?>;
|
||||
}
|
||||
.l-header.sticky .l-subheader.at_bottom {
|
||||
line-height: <?php echo us_get_header_option( 'bottom_sticky_height', 'mobiles' ) ?>;
|
||||
height: <?php echo us_get_header_option( 'bottom_sticky_height', 'mobiles' ) ?>;
|
||||
<?php if ( us_get_header_option( 'bottom_sticky_height', 'mobiles' ) == 0 ): ?>
|
||||
overflow: hidden;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
/* Calculate top padding for content overlapped by sticky header */
|
||||
.l-header.pos_fixed ~ .l-main > .l-section:first-of-type,
|
||||
.l-header.pos_fixed ~ .l-main > .l-section-gap:nth-child(2),
|
||||
.headerinpos_below .l-header.pos_fixed ~ .l-main > .l-section:nth-of-type(2),
|
||||
.l-header.pos_static.bg_transparent ~ .l-main > .l-section:first-of-type {
|
||||
<?php
|
||||
$header_height = us_get_header_option( 'top_show', 'mobiles' ) ? intval( us_get_header_option( 'top_height', 'mobiles' ) ) : 0;
|
||||
$header_height += intval( us_get_header_option( 'middle_height', 'mobiles' ) );
|
||||
$header_height += us_get_header_option( 'bottom_show', 'mobiles' ) ? intval( us_get_header_option( 'bottom_height', 'mobiles' ) ) : 0;
|
||||
?>
|
||||
padding-top: <?php echo $header_height ?>px;
|
||||
}
|
||||
|
||||
/* Calculate position of "Sticky" rows */
|
||||
.l-header.pos_fixed ~ .l-main .l-section.sticky {
|
||||
<?php
|
||||
$header_sticky_height = us_get_header_option( 'top_show', 'mobiles' ) ? intval( us_get_header_option( 'top_sticky_height', 'mobiles' ) ) : 0;
|
||||
$header_sticky_height += intval( us_get_header_option( 'middle_sticky_height', 'mobiles' ) );
|
||||
$header_sticky_height += us_get_header_option( 'bottom_show', 'mobiles' ) ? intval( us_get_header_option( 'bottom_sticky_height', 'mobiles' ) ) : 0;
|
||||
?>
|
||||
top: <?php echo $header_sticky_height ?>px;
|
||||
}
|
||||
.l-header.pos_fixed.sticky ~ .l-main .l-section.type_sticky:first-of-type {
|
||||
padding-top: <?php echo $header_sticky_height ?>px;
|
||||
}
|
||||
<?php } else {
|
||||
// Vertical header on Mobiles
|
||||
echo $header_ver_styles;
|
||||
?>
|
||||
.l-header,
|
||||
.l-header .w-cart-notification,
|
||||
.w-nav.type_mobile.m_layout_panel .w-nav-list.level_1 {
|
||||
width: <?php echo us_get_header_option( 'width', 'mobiles' ) ?>;
|
||||
}
|
||||
.w-search.layout_simple,
|
||||
.w-search.layout_modern.active {
|
||||
width: calc(<?php echo us_get_header_option( 'width', 'mobiles' ) ?> - 40px);
|
||||
}
|
||||
|
||||
/* Slided vertical header */
|
||||
.w-header-show,
|
||||
.w-header-overlay {
|
||||
display: block;
|
||||
}
|
||||
.l-header {
|
||||
bottom: 0;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
box-shadow: none;
|
||||
transition: transform 0.3s;
|
||||
transform: translate3d(-100%,0,0);
|
||||
}
|
||||
.header-show .l-header {
|
||||
transform: translate3d(0,0,0);
|
||||
}
|
||||
<?php if ( us_get_header_option( 'elm_align', 'mobiles' ) == 'left' ) { ?>
|
||||
.l-subheader-cell {
|
||||
text-align: left;
|
||||
align-items: flex-start;
|
||||
}
|
||||
<?php }
|
||||
if ( us_get_header_option( 'elm_align', 'mobiles' ) == 'right' ) { ?>
|
||||
.l-subheader-cell {
|
||||
text-align: right;
|
||||
align-items: flex-end;
|
||||
}
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Image */
|
||||
|
||||
<?php foreach ( us_get_header_elms_of_a_type( 'image' ) as $class => $param ): ?>
|
||||
@media <?php echo $desktop_query ?> {
|
||||
.<?php echo $class ?> { height: <?php echo $param['height'] ?>; }
|
||||
.l-header.sticky .<?php echo $class ?> { height: <?php echo $param['height_sticky'] ?>; }
|
||||
}
|
||||
@media <?php echo $tablets_query ?> {
|
||||
.<?php echo $class ?> { height: <?php echo $param['height_tablets'] ?>; }
|
||||
.l-header.sticky .<?php echo $class ?> { height: <?php echo $param['height_sticky_tablets'] ?>; }
|
||||
}
|
||||
@media <?php echo $mobiles_query ?> {
|
||||
.<?php echo $class ?> { height: <?php echo $param['height_mobiles'] ?>; }
|
||||
.l-header.sticky .<?php echo $class ?> { height: <?php echo $param['height_sticky_mobiles'] ?>; }
|
||||
}
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
/* Text */
|
||||
|
||||
<?php
|
||||
foreach ( us_get_header_elms_of_a_type( 'text' ) as $class => $param ) {
|
||||
|
||||
$css = '.' . $class . '{';
|
||||
$css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => isset( $param['font'] ) ? $param['font'] : '',
|
||||
'font-weight' => isset( $param['font_weight'] ) ? $param['font_weight'] : '',
|
||||
'text-transform' => isset( $param['text_transform'] ) ? $param['text_transform'] : '',
|
||||
'font-style' => isset( $param['font_style'] ) ? $param['font_style'] : '',
|
||||
'font-size' => isset( $param['font_size'] ) ? $param['font_size'] : '',
|
||||
'line-height' => isset( $param['line_height'] ) ? $param['line_height'] : '',
|
||||
'white-space' => ( ! $param['wrap'] ) ? 'nowrap' : '',
|
||||
),
|
||||
$style_attr = FALSE
|
||||
);
|
||||
$css .= '}';
|
||||
if ( ! empty( $param['color'] ) ) {
|
||||
$css .= '.' . $class . ' .w-text-h { color:' . $param['color'] . '; }';
|
||||
}
|
||||
if ( ! empty( $param['font_size_tablets'] ) OR ! empty( $param['line_height_tablets'] ) ) {
|
||||
$css .= '@media ' . $tablets_query . ' {.' . $class . '{';
|
||||
$css .= ( ! empty( $param['font_size_tablets'] ) ) ? ( 'font-size:' . $param['font_size_tablets'] . ';' ) : '';
|
||||
$css .= ( ! empty( $param['line_height_tablets'] ) ) ? ( 'line-height:' . $param['line_height_tablets'] . ';' ) : '';
|
||||
$css .= '}}';
|
||||
}
|
||||
if ( ! empty( $param['font_size_mobiles'] ) OR ! empty( $param['line_height_mobiles'] ) ) {
|
||||
$css .= '@media ' . $mobiles_query . ' {.' . $class . '{';
|
||||
$css .= ( ! empty( $param['font_size_mobiles'] ) ) ? ( 'font-size:' . $param['font_size_mobiles'] . ';' ) : '';
|
||||
$css .= ( ! empty( $param['line_height_mobiles'] ) ) ? ( 'line-height:' . $param['line_height_mobiles'] . ';' ) : '';
|
||||
$css .= '}}';
|
||||
}
|
||||
|
||||
echo $css;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
/* Button */
|
||||
|
||||
<?php foreach ( us_get_header_elms_of_a_type( 'btn' ) as $class => $param ): ?>
|
||||
@media <?php echo $desktop_query ?> {
|
||||
.<?php echo $class ?> { font-size: <?php echo $param['font_size'] ?>; }
|
||||
}
|
||||
@media <?php echo $tablets_query ?> {
|
||||
.<?php echo $class ?> { font-size: <?php echo $param['font_size_tablets'] ?>; }
|
||||
}
|
||||
@media <?php echo $mobiles_query ?> {
|
||||
.<?php echo $class ?> { font-size: <?php echo $param['font_size_mobiles'] ?>; }
|
||||
}
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
/* Menu */
|
||||
|
||||
<?php foreach ( us_get_header_elms_of_a_type( 'menu' ) as $class => $param ): ?>
|
||||
.header_hor .<?php echo $class ?>.type_desktop .w-nav-list.level_1 > .menu-item > a {
|
||||
padding-left: <?php echo $param['indents'] ?>;
|
||||
padding-right: <?php echo $param['indents'] ?>;
|
||||
}
|
||||
.header_ver .<?php echo $class ?>.type_desktop .w-nav-list.level_1 > .menu-item > a {
|
||||
padding-top: <?php echo $param['indents'] ?>;
|
||||
padding-bottom: <?php echo $param['indents'] ?>;
|
||||
}
|
||||
<?php
|
||||
$css = '.' . $class . '{';
|
||||
$css .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => $param['font'],
|
||||
'font-weight' => $param['font_weight'],
|
||||
'text-transform' => $param['text_transform'],
|
||||
'font-style' => $param['font_style'],
|
||||
),
|
||||
$style_attr = FALSE
|
||||
);
|
||||
$css .= '}';
|
||||
echo $css;
|
||||
|
||||
if ( $param['dropdown_arrow'] ): ?>
|
||||
.<?php echo $class ?>.type_desktop .menu-item-has-children .w-nav-anchor.level_1 > .w-nav-arrow {
|
||||
display: inline-block;
|
||||
}
|
||||
<?php endif; ?>
|
||||
.<?php echo $class ?>.type_desktop .w-nav-list > .menu-item.level_1 {
|
||||
font-size: <?php echo $param['font_size'] ?>;
|
||||
}
|
||||
.<?php echo $class ?>.type_desktop .w-nav-list > .menu-item:not(.level_1) {
|
||||
font-size: <?php echo $param['dropdown_font_size'] ?>;
|
||||
}
|
||||
<?php if ( $param['dropdown_width'] ): ?>
|
||||
.<?php echo $class ?>.type_desktop {
|
||||
position: relative;
|
||||
}
|
||||
<?php endif; ?>
|
||||
.<?php echo $class ?>.type_mobile .w-nav-anchor.level_1 {
|
||||
font-size: <?php echo $param['mobile_font_size'] ?>;
|
||||
}
|
||||
.<?php echo $class ?>.type_mobile .w-nav-anchor:not(.level_1) {
|
||||
font-size: <?php echo $param['mobile_dropdown_font_size'] ?>;
|
||||
}
|
||||
@media <?php echo $desktop_query ?> {
|
||||
.<?php echo $class ?> .w-nav-icon {
|
||||
font-size: <?php echo $param['mobile_icon_size'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $tablets_query ?> {
|
||||
.<?php echo $class ?> .w-nav-icon {
|
||||
font-size: <?php echo $param['mobile_icon_size_tablets'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $mobiles_query ?> {
|
||||
.<?php echo $class ?> .w-nav-icon {
|
||||
font-size: <?php echo $param['mobile_icon_size_mobiles'] ?>;
|
||||
}
|
||||
}
|
||||
/* Show mobile menu instead of desktop */
|
||||
@media screen and (max-width: <?php echo ( intval( $param['mobile_width'] ) - 1 ) ?>px) {
|
||||
.w-nav.<?php echo $class ?> > .w-nav-list.level_1 {
|
||||
display: none;
|
||||
}
|
||||
.<?php echo $class ?> .w-nav-control {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
/* Links Menu */
|
||||
|
||||
<?php foreach ( us_get_header_elms_of_a_type( 'additional_menu' ) as $class => $param ): ?>
|
||||
@media <?php echo $desktop_query ?> {
|
||||
.<?php echo $class ?> {
|
||||
font-size: <?php echo $param['size'] ?>;
|
||||
}
|
||||
.header_hor .<?php echo $class ?> .w-menu-list {
|
||||
margin: 0 -<?php echo $param['indents'] ?>;
|
||||
}
|
||||
.header_hor .<?php echo $class ?> .w-menu-item {
|
||||
padding: 0 <?php echo $param['indents'] ?>;
|
||||
}
|
||||
.header_ver .<?php echo $class ?> .w-menu-list {
|
||||
line-height: <?php echo $param['indents'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $tablets_query ?> {
|
||||
.<?php echo $class ?> {
|
||||
font-size: <?php echo $param['size_tablets'] ?>;
|
||||
}
|
||||
.header_hor .<?php echo $class ?> .w-menu-list {
|
||||
margin: 0 -<?php echo $param['indents_tablets'] ?>;
|
||||
}
|
||||
.header_hor .<?php echo $class ?> .w-menu-item {
|
||||
padding: 0 <?php echo $param['indents_tablets'] ?>;
|
||||
}
|
||||
.header_ver .<?php echo $class ?> .w-menu-list {
|
||||
line-height: <?php echo $param['indents_tablets'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $mobiles_query ?> {
|
||||
.<?php echo $class ?> {
|
||||
font-size: <?php echo $param['size_mobiles'] ?>;
|
||||
}
|
||||
.header_hor .<?php echo $class ?> .w-menu-list {
|
||||
margin: 0 -<?php echo $param['indents_mobiles'] ?>;
|
||||
}
|
||||
.header_hor .<?php echo $class ?> .w-menu-item {
|
||||
padding: 0 <?php echo $param['indents_mobiles'] ?>;
|
||||
}
|
||||
.header_ver .<?php echo $class ?> .w-menu-list {
|
||||
line-height: <?php echo $param['indents_mobiles'] ?>;
|
||||
}
|
||||
}
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
/* Search */
|
||||
|
||||
<?php foreach ( us_get_header_elms_of_a_type( 'search' ) as $class => $param ): ?>
|
||||
@media <?php echo $desktop_query ?> {
|
||||
.<?php echo $class ?>.layout_simple {
|
||||
max-width: <?php echo $param['field_width'] ?>;
|
||||
}
|
||||
.<?php echo $class ?>.layout_modern.active {
|
||||
width: <?php echo $param['field_width'] ?>;
|
||||
}
|
||||
.<?php echo $class ?> {
|
||||
font-size: <?php echo $param['icon_size'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $tablets_query ?> {
|
||||
.<?php echo $class ?>.layout_simple {
|
||||
max-width: <?php echo $param['field_width_tablets'] ?>;
|
||||
}
|
||||
.<?php echo $class ?>.layout_modern.active {
|
||||
width: <?php echo $param['field_width_tablets'] ?>;
|
||||
}
|
||||
.<?php echo $class ?> {
|
||||
font-size: <?php echo $param['icon_size_tablets'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $mobiles_query ?> {
|
||||
.<?php echo $class ?> {
|
||||
font-size: <?php echo $param['icon_size_mobiles'] ?>;
|
||||
}
|
||||
}
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
/* Socials */
|
||||
|
||||
<?php foreach ( us_get_header_elms_of_a_type( 'socials' ) as $class => $param ): ?>
|
||||
.<?php echo $class ?> .w-socials-list {
|
||||
margin: -<?php echo $param['gap'] ?>;
|
||||
}
|
||||
.<?php echo $class ?> .w-socials-item {
|
||||
padding: <?php echo $param['gap'] ?>;
|
||||
}
|
||||
@media <?php echo $desktop_query ?> {
|
||||
.<?php echo $class ?> {
|
||||
font-size: <?php echo $param['size'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $tablets_query ?> {
|
||||
.<?php echo $class ?> {
|
||||
font-size: <?php echo $param['size_tablets'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $mobiles_query ?> {
|
||||
.<?php echo $class ?> {
|
||||
font-size: <?php echo $param['size_mobiles'] ?>;
|
||||
}
|
||||
}
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
/* Dropdown */
|
||||
|
||||
<?php foreach ( us_get_header_elms_of_a_type( 'dropdown' ) as $class => $param ): ?>
|
||||
@media <?php echo $desktop_query ?> {
|
||||
.<?php echo $class ?> .w-dropdown-h {
|
||||
font-size: <?php echo $param['size'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $tablets_query ?> {
|
||||
.<?php echo $class ?> .w-dropdown-h {
|
||||
font-size: <?php echo $param['size_tablets'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $mobiles_query ?> {
|
||||
.<?php echo $class ?> .w-dropdown-h {
|
||||
font-size: <?php echo $param['size_mobiles'] ?>;
|
||||
}
|
||||
}
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
/* Cart */
|
||||
|
||||
<?php foreach ( us_get_header_elms_of_a_type( 'cart' ) as $class => $param ): ?>
|
||||
@media <?php echo $desktop_query ?> {
|
||||
.<?php echo $class ?> .w-cart-link {
|
||||
font-size: <?php echo $param['size'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $tablets_query ?> {
|
||||
.<?php echo $class ?> .w-cart-link {
|
||||
font-size: <?php echo $param['size_tablets'] ?>;
|
||||
}
|
||||
}
|
||||
@media <?php echo $mobiles_query ?> {
|
||||
.<?php echo $class ?> .w-cart-link {
|
||||
font-size: <?php echo $param['size_mobiles'] ?>;
|
||||
}
|
||||
}
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
/* Design Options */
|
||||
|
||||
<?php echo us_get_header_design_options_css() ?>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Template header
|
||||
*/
|
||||
|
||||
$us_layout = US_Layout::instance();
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html class="<?php echo $us_layout->html_classes() ?>" <?php language_attributes( 'html' ) ?>>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<?php wp_head() ?>
|
||||
|
||||
<?php if ( ( defined( 'US_DEV' ) AND US_DEV ) OR us_get_option( 'optimize_assets', 0 ) == 0 ): ?>
|
||||
<style id="us-theme-options-css"><?php echo us_get_theme_options_css() ?></style>
|
||||
<?php endif; ?>
|
||||
<?php if ( $us_layout->header_show != 'never' ): ?>
|
||||
<style id="us-header-css"><?php echo us_minify_css( us_get_template( 'templates/header.css' ) ) ?></style>
|
||||
<?php endif; ?>
|
||||
<?php if ( us_get_option( 'optimize_assets', 0 ) == 0 AND ( $us_custom_css = us_get_option( 'custom_css', '' ) ) != '' ): ?>
|
||||
<style id="us-custom-css"><?php echo us_minify_css( $us_custom_css ) ?></style>
|
||||
<?php endif; ?>
|
||||
<?php echo us_get_option( 'custom_html_head', '' ); ?>
|
||||
|
||||
</head>
|
||||
<body <?php body_class( 'l-body ' . $us_layout->body_classes() );
|
||||
if ( us_get_option( 'schema_markup' ) ) {
|
||||
echo ' itemscope itemtype="https://schema.org/WebPage"';
|
||||
} ?>>
|
||||
<?php
|
||||
global $us_iframe;
|
||||
if ( ! ( isset( $us_iframe ) AND $us_iframe ) AND us_get_option( 'preloader' ) != 'disabled' ) {
|
||||
add_action( 'us_before_canvas', 'us_display_preloader', 100 );
|
||||
function us_display_preloader() {
|
||||
$preloader_type = us_get_option( 'preloader' );
|
||||
if ( ! in_array( $preloader_type, array_merge( us_get_preloader_numeric_types(), array( 'custom' ) ) ) ) {
|
||||
$preloader_type = 1;
|
||||
}
|
||||
|
||||
$preloader_image = us_get_option( 'preloader_image' );
|
||||
$preloader_image_html = '';
|
||||
$img = usof_get_image_src( $preloader_image, 'medium' );
|
||||
if ( $preloader_type == 'custom' AND $img[0] != '' ) {
|
||||
$preloader_image_html .= '<img src="' . esc_url( $img[0] ) . '"';
|
||||
if ( ! empty( $img[1] ) AND ! empty( $img[2] ) ) {
|
||||
// Image sizes may be missing when logo is a direct URL
|
||||
$preloader_image_html .= ' width="' . $img[1] . '" height="' . $img[2] . '"';
|
||||
}
|
||||
$preloader_image_html .= ' alt="' . us_get_image_alt( $preloader_image ) . '"/>';
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="l-preloader">
|
||||
<div class="l-preloader-spinner">
|
||||
<div class="g-preloader type_<?php echo $preloader_type ?>">
|
||||
<div><?php echo $preloader_image_html ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'us_before_canvas' ) ?>
|
||||
|
||||
<div class="l-canvas <?php echo $us_layout->canvas_classes() ?>">
|
||||
|
||||
<?php if ( $us_layout->header_show != 'never' ): ?>
|
||||
|
||||
<?php do_action( 'us_before_header' ) ?>
|
||||
|
||||
<?php us_load_template( 'templates/l-header' ) ?>
|
||||
|
||||
<?php do_action( 'us_after_header' ) ?>
|
||||
|
||||
<?php endif/*( $us_layout->header_show != 'never' )*/
|
||||
; ?>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* The template for displaying the 404 page
|
||||
*/
|
||||
|
||||
$posts_page = get_post( us_get_option( 'posts_page' ) );
|
||||
|
||||
// Output specific page
|
||||
if ( $posts_page ) {
|
||||
$posts_page = get_post( apply_filters( 'wpml_object_id', $posts_page->ID, 'page', TRUE ) );
|
||||
|
||||
get_header();
|
||||
|
||||
?>
|
||||
<main class="l-main"<?php echo ( us_get_option( 'schema_markup' ) ) ? ' itemprop="mainContentOfPage"' : ''; ?>>
|
||||
|
||||
<?php
|
||||
do_action( 'us_before_page' );
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
|
||||
// Titlebar, if it is enabled in Theme Options
|
||||
us_load_template( 'templates/titlebar' );
|
||||
|
||||
// START wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'before' ) );
|
||||
}
|
||||
|
||||
us_open_wp_query_context();
|
||||
|
||||
us_add_page_shortcodes_custom_css( $posts_page->ID );
|
||||
|
||||
us_close_wp_query_context();
|
||||
|
||||
// Setting search page ID as $us_page_block_id for grid shortcodes
|
||||
us_add_to_page_block_ids( $posts_page->ID );
|
||||
|
||||
echo apply_filters( 'the_content', $posts_page->post_content );
|
||||
|
||||
us_remove_from_page_block_ids();
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
// AFTER wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'after' ) );
|
||||
}
|
||||
|
||||
do_action( 'us_after_page' );
|
||||
?>
|
||||
|
||||
</main>
|
||||
<?php
|
||||
|
||||
get_footer();
|
||||
|
||||
// Output default archive layout
|
||||
} else {
|
||||
us_load_template( 'templates/archive' );
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Template of website header HTML markup
|
||||
*/
|
||||
|
||||
$us_layout = US_Layout::instance();
|
||||
if ( $us_layout->header_show == 'never' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $us_header_settings;
|
||||
us_load_header_settings_once();
|
||||
|
||||
if ( isset( $us_header_settings['is_hidden'] ) AND $us_header_settings['is_hidden'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = us_arr_path( $us_header_settings, 'default.options', array() );
|
||||
$layout = us_arr_path( $us_header_settings, 'default.layout', array() );
|
||||
$data = us_arr_path( $us_header_settings, 'data', array() );
|
||||
echo '<header class="l-header ' . $us_layout->header_classes();
|
||||
if ( ! empty( $options['bg_img'] ) ) {
|
||||
echo ' with_bgimg';
|
||||
}
|
||||
if ( ! empty( $us_header_settings['header_id'] ) ) {
|
||||
echo ' id_' . $us_header_settings['header_id'];
|
||||
}
|
||||
echo '"';
|
||||
if ( us_get_option( 'schema_markup' ) ) {
|
||||
echo ' itemscope itemtype="https://schema.org/WPHeader"';
|
||||
}
|
||||
echo '>';
|
||||
foreach ( array( 'top', 'middle', 'bottom' ) as $valign ) {
|
||||
$show_state = FALSE;
|
||||
foreach ( array( 'default', 'tablets', 'mobiles' ) as $state ) {
|
||||
if ( ! isset( $us_header_settings[$state]['options'][$valign . '_show'] ) OR $us_header_settings[$state]['options'][$valign . '_show'] == 1 ) {
|
||||
$show_state = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach ( array( 'left', 'center', 'right' ) as $halign ) {
|
||||
if ( isset( $us_header_settings['default']['layout'][$valign . '_' . $halign] ) AND count( $us_header_settings['default']['layout'][$valign . '_' . $halign] ) > 0 ) {
|
||||
$show_state = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $show_state ) {
|
||||
continue;
|
||||
}
|
||||
echo '<div class="l-subheader at_' . $valign;
|
||||
if ( isset( $options[$valign . '_fullwidth'] ) AND $options[$valign . '_fullwidth'] ) {
|
||||
echo ' width_full';
|
||||
}
|
||||
if ( isset( $options[$valign . '_centering'] ) AND $options[$valign . '_centering'] ) {
|
||||
echo ' with_centering';
|
||||
}
|
||||
echo '"><div class="l-subheader-h">';
|
||||
foreach ( array( 'left', 'center', 'right' ) as $halign ) {
|
||||
echo '<div class="l-subheader-cell at_' . $halign . '">';
|
||||
if ( isset( $layout[$valign . '_' . $halign] ) ) {
|
||||
us_output_builder_elms( $us_header_settings, 'default', $valign . '_' . $halign );
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
||||
// Outputting elements that are hidden in default state but are visible in tablets / mobiles state
|
||||
$default_elms = us_get_builder_shown_elements_list( us_get_header_layout() );
|
||||
$tablets_elms = us_get_builder_shown_elements_list( us_get_header_layout( 'tablets' ) );
|
||||
$mobiles_elms = us_get_builder_shown_elements_list( us_get_header_layout( 'mobiles' ) );
|
||||
|
||||
$us_header_settings['default']['layout']['temporarily_hidden'] = array_diff( array_unique( array_merge( $tablets_elms, $mobiles_elms ) ), $default_elms );
|
||||
echo '<div class="l-subheader for_hidden hidden">';
|
||||
us_output_builder_elms( $us_header_settings, 'default', 'temporarily_hidden' );
|
||||
echo '</div>';
|
||||
unset( $us_header_settings['default']['layout']['temporarily_hidden'] );
|
||||
|
||||
echo '</header>';
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* The template for displaying the 404 page
|
||||
*/
|
||||
|
||||
$search_page = get_post( us_get_option( 'search_page' ) );
|
||||
|
||||
// Output specific page
|
||||
if ( $search_page ) {
|
||||
$search_page = get_post( apply_filters( 'wpml_object_id', $search_page->ID, 'page', TRUE ) );
|
||||
|
||||
get_header();
|
||||
|
||||
?>
|
||||
<main class="l-main"<?php echo ( us_get_option( 'schema_markup' ) ) ? ' itemprop="mainContentOfPage"' : ''; ?>>
|
||||
|
||||
<?php
|
||||
do_action( 'us_before_page' );
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
|
||||
// Titlebar, if it is enabled in Theme Options
|
||||
us_load_template( 'templates/titlebar' );
|
||||
|
||||
// START wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'before' ) );
|
||||
}
|
||||
|
||||
$content_area_id = us_get_page_area_id( 'content' );
|
||||
|
||||
if ( $content_area_id != '' AND get_post_status( $content_area_id ) != FALSE ) {
|
||||
global $us_is_search_page_block;
|
||||
$us_is_search_page_block = TRUE;
|
||||
us_load_template( 'templates/content' );
|
||||
} else {
|
||||
us_open_wp_query_context();
|
||||
|
||||
us_add_page_shortcodes_custom_css( $search_page->ID );
|
||||
|
||||
us_close_wp_query_context();
|
||||
|
||||
// Set search page ID as $us_page_block_id for grid shortcodes
|
||||
us_add_to_page_block_ids( $search_page->ID );
|
||||
|
||||
echo apply_filters( 'the_content', $search_page->post_content );
|
||||
|
||||
us_remove_from_page_block_ids();
|
||||
}
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
// AFTER wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'after' ) );
|
||||
}
|
||||
|
||||
do_action( 'us_after_page' );
|
||||
?>
|
||||
|
||||
</main>
|
||||
<?php
|
||||
|
||||
get_footer();
|
||||
|
||||
// Output default archive layout
|
||||
} else {
|
||||
us_load_template( 'templates/archive' );
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Outputs Sidebar HTML
|
||||
*
|
||||
* @filter Template variables: 'us_template_vars:templates/content'
|
||||
*/
|
||||
|
||||
$sidebar_id = us_get_page_area_id( 'sidebar' );
|
||||
if ( ! isset( $place ) OR $sidebar_id == '' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get Sidebar position for the current page (based on "us_get_page_area_id" function)
|
||||
$public_cpt = array_keys( us_get_public_cpt() );
|
||||
$position = us_get_option( 'sidebar_pos', 'right' );
|
||||
if ( is_singular( array( 'us_portfolio' ) ) ) {
|
||||
$position = us_get_option( 'sidebar_portfolio_pos' );
|
||||
|
||||
} elseif ( is_singular( array( 'post', 'attachment' ) ) ) {
|
||||
$position = us_get_option( 'sidebar_post_pos' );
|
||||
|
||||
} elseif ( function_exists( 'is_product' ) AND is_product() ) {
|
||||
$position = us_get_option( 'sidebar_product_pos' );
|
||||
|
||||
} elseif ( is_post_type_archive( 'product' ) AND is_search() ) {
|
||||
$position = us_get_option( 'sidebar_shop_pos' );
|
||||
|
||||
} elseif ( function_exists( 'is_shop' ) AND is_shop() ) {
|
||||
$position = us_get_option( 'sidebar_shop_pos' );
|
||||
|
||||
} elseif ( function_exists( 'is_product_category' ) AND is_product_category() ) {
|
||||
if ( us_get_option( 'sidebar_tax_product_cat_id' ) == '__defaults__' ) {
|
||||
$position = us_get_option( 'sidebar_shop_pos' );
|
||||
} else {
|
||||
$position = us_get_option( 'sidebar_tax_product_cat_pos' );
|
||||
}
|
||||
|
||||
} elseif ( function_exists( 'is_product_tag' ) AND is_product_tag() ) {
|
||||
if ( us_get_option( 'sidebar_tax_product_tag_id' ) == '__defaults__' ) {
|
||||
$position = us_get_option( 'sidebar_shop_pos' );
|
||||
} else {
|
||||
$position = us_get_option( 'sidebar_tax_product_tag_pos' );
|
||||
}
|
||||
|
||||
} elseif ( is_author() ) {
|
||||
if ( us_get_option( 'sidebar_author_id' ) != '__defaults__' ) {
|
||||
$position = us_get_option( 'sidebar_author_pos' );
|
||||
}
|
||||
|
||||
} elseif ( is_archive() OR is_search() ) {
|
||||
$public_taxonomies = array_keys( us_get_taxonomies( TRUE ) );
|
||||
|
||||
$position = us_get_option( 'sidebar_archive_pos' );
|
||||
|
||||
$current_tax = NULL;
|
||||
if ( is_category() ) {
|
||||
$current_tax = 'category';
|
||||
} elseif ( is_tag() ) {
|
||||
$current_tax = 'post_tag';
|
||||
} elseif ( is_tax() ) {
|
||||
$current_tax = get_query_var( 'taxonomy' );
|
||||
}
|
||||
if ( ! empty( $current_tax ) AND in_array( $current_tax, $public_taxonomies ) ) {
|
||||
if ( us_get_option( 'sidebar_tax_' . $current_tax . '_id' ) != '__defaults__' ) {
|
||||
$position = us_get_option( 'sidebar_tax_' . $current_tax . '_pos' );
|
||||
}
|
||||
}
|
||||
|
||||
} elseif ( ! empty( $public_cpt ) AND is_singular( $public_cpt ) ) {
|
||||
if ( is_singular( array( 'tribe_events' ) ) ) {
|
||||
$post_type = 'tribe_events'; // Events Calendar fix
|
||||
} else {
|
||||
$post_type = get_post_type();
|
||||
}
|
||||
$position = us_get_option( 'sidebar_' . $post_type . '_pos' );
|
||||
}
|
||||
if ( is_search() AND ! is_post_type_archive( 'product' ) AND $postID = us_get_option( 'search_page' ) AND $postID != 'default' ) {
|
||||
$position = usof_meta( 'us_sidebar_pos', array(), $postID );
|
||||
}
|
||||
if ( is_home() AND $postID = us_get_option( 'posts_page' ) AND $postID != 'default' ) {
|
||||
$position = usof_meta( 'us_sidebar_pos', array(), $postID );
|
||||
}
|
||||
if ( is_404() AND $postID = us_get_option( 'page_404' ) AND $postID != 'default' ) {
|
||||
$position = usof_meta( 'us_sidebar_pos', array(), $postID );
|
||||
}
|
||||
if ( is_singular() ) {
|
||||
$postID = get_the_ID();
|
||||
if ( $postID AND usof_meta( 'us_sidebar_id', array(), $postID ) != '__defaults__' ) {
|
||||
$position = usof_meta( 'us_sidebar_pos', array(), $postID );
|
||||
}
|
||||
}
|
||||
|
||||
// Generate column for Content area
|
||||
$content_column_start = '<div class="vc_col-sm-9 vc_column_container l-content">'; // TODO: make width be changeable
|
||||
$content_column_start .= '<div class="vc_column-inner"><div class="wpb_wrapper">';
|
||||
|
||||
// Generate column for Sidebar
|
||||
$sidebar_column_start = '<div class="vc_col-sm-3 vc_column_container l-sidebar">'; // TODO: make width be changeable
|
||||
$sidebar_column_start .= '<div class="vc_column-inner"><div class="wpb_wrapper">';
|
||||
|
||||
// Outputs HTML regarding place value
|
||||
if ( $place == 'before' ) {
|
||||
|
||||
echo '<section class="l-section height_auto for_sidebar at_' . $position . '"><div class="l-section-h">';
|
||||
echo '<div class="g-cols type_default valign_top">';
|
||||
|
||||
// Content column
|
||||
echo $content_column_start;
|
||||
|
||||
} elseif ( $place == 'after' ) {
|
||||
|
||||
echo '</div></div></div>';
|
||||
|
||||
// Sidebar column
|
||||
echo $sidebar_column_start;
|
||||
|
||||
dynamic_sidebar( $sidebar_id );
|
||||
|
||||
echo '</div></div></div>';
|
||||
echo '</div></div></section>';
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Template to show single page or any post type
|
||||
*/
|
||||
|
||||
$us_layout = US_Layout::instance();
|
||||
|
||||
get_header();
|
||||
|
||||
?>
|
||||
<main class="l-main"<?php echo ( us_get_option( 'schema_markup' ) ) ? ' itemprop="mainContentOfPage"' : ''; ?>>
|
||||
<?php
|
||||
do_action( 'us_before_page' );
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
|
||||
// Titlebar, if it is enabled in Theme Options
|
||||
us_load_template( 'templates/titlebar' );
|
||||
|
||||
// START wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'before' ) );
|
||||
}
|
||||
|
||||
while ( have_posts() ) {
|
||||
the_post();
|
||||
|
||||
$content_area_id = us_get_page_area_id( 'content' );
|
||||
|
||||
if ( $content_area_id != '' AND get_post_status( $content_area_id ) != FALSE ) {
|
||||
us_load_template( 'templates/content' );
|
||||
} else {
|
||||
$the_content = apply_filters( 'the_content', get_the_content() );
|
||||
|
||||
// The page may be paginated itself via <!--nextpage--> tags
|
||||
$pagination = wp_link_pages(
|
||||
array(
|
||||
'before' => '<nav class="post-pagination"><span class="title">' . us_translate( 'Pages:' ) . '</span>',
|
||||
'after' => '</nav>',
|
||||
'link_before' => '<span>',
|
||||
'link_after' => '</span>',
|
||||
'echo' => 0,
|
||||
)
|
||||
);
|
||||
|
||||
// If content has no sections, we'll create them manually
|
||||
$has_own_sections = ( strpos( $the_content, ' class="l-section' ) !== FALSE );
|
||||
if ( ! ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) AND ( ! $has_own_sections OR get_post_type() == 'tribe_events' ) ) {
|
||||
$the_content = '<section class="l-section"><div class="l-section-h i-cf">' . $the_content . $pagination . '</div></section>';
|
||||
} elseif ( ! empty( $pagination ) ) {
|
||||
$the_content .= '<section class="l-section"><div class="l-section-h i-cf">' . $pagination . '</div></section>';
|
||||
}
|
||||
|
||||
echo $the_content;
|
||||
|
||||
// Post comments
|
||||
if ( comments_open() OR get_comments_number() != '0' ) {
|
||||
|
||||
$show_comments = TRUE;
|
||||
// Check comments option of Events Calendar plugin
|
||||
if ( function_exists( 'tribe_get_option' ) AND get_post_type() == 'tribe_events' ) {
|
||||
$show_comments = tribe_get_option( 'showComments' );
|
||||
}
|
||||
|
||||
if ( $show_comments ) {
|
||||
?>
|
||||
<section class="l-section for_comments">
|
||||
<div class="l-section-h i-cf"><?php
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
comments_template();
|
||||
?></div>
|
||||
</section><?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
// AFTER wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'after' ) );
|
||||
}
|
||||
|
||||
do_action( 'us_after_page' );
|
||||
?>
|
||||
</main>
|
||||
|
||||
<?php get_footer() ?>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Outputs Titlebar content
|
||||
*
|
||||
* @filter Template variables: 'us_template_vars:templates/content'
|
||||
*/
|
||||
|
||||
global $us_iframe;
|
||||
if ( $us_iframe ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get Titlebar content
|
||||
$titlebar_content = '';
|
||||
$titlebar_id = us_get_page_area_id( 'titlebar' );
|
||||
if ( $titlebar_id != '' ) {
|
||||
|
||||
$page_block = get_post( (int) $titlebar_id );
|
||||
|
||||
us_open_wp_query_context();
|
||||
if ( $page_block ) {
|
||||
$translated_page_block_id = apply_filters( 'wpml_object_id', $page_block->ID, 'us_page_block', TRUE );
|
||||
if ( $translated_page_block_id != $page_block->ID ) {
|
||||
$page_block = get_post( $translated_page_block_id );
|
||||
}
|
||||
|
||||
us_add_to_page_block_ids( $translated_page_block_id );
|
||||
us_add_page_shortcodes_custom_css( $translated_page_block_id );
|
||||
|
||||
$titlebar_content = $page_block->post_content;
|
||||
}
|
||||
us_close_wp_query_context();
|
||||
|
||||
// Apply filters to Page Block content and echoing it ouside of us_open_wp_query_context,
|
||||
// so all WP widgets (like WP Nav Menu) would work as they should
|
||||
echo apply_filters( 'us_page_block_the_content', $titlebar_content );
|
||||
|
||||
if ( $page_block ) {
|
||||
us_remove_from_page_block_ids();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Closing part of Grid output
|
||||
*/
|
||||
|
||||
$us_grid_index = isset( $us_grid_index ) ? intval( $us_grid_index ) : 0;
|
||||
$post_id = isset( $post_id ) ? $post_id : NULL;
|
||||
$filter_html = isset( $filter_html ) ? $filter_html : '';
|
||||
$is_widget = isset( $is_widget ) ? $is_widget : FALSE;
|
||||
|
||||
// Check Grid params and use default values from config, if its not set
|
||||
$default_grid_params = us_shortcode_atts( array(), 'us_grid' );
|
||||
foreach ( $default_grid_params as $param => $value ) {
|
||||
if ( ! isset( $$param ) ) {
|
||||
$$param = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Check Carousel params and use default values from config, if its not set
|
||||
if ( $type == 'carousel' ) {
|
||||
$default_carousel_params = us_shortcode_atts( array(), 'us_carousel' );
|
||||
foreach ( $default_carousel_params as $param => $value ) {
|
||||
if ( ! isset( $$param ) ) {
|
||||
$$param = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( ! $is_widget ) AND ( $post_id != NULL ) AND ( $type != 'carousel' ) ) {
|
||||
$us_grid_ajax_indexes[ $post_id ] = isset( $us_grid_ajax_indexes[ $post_id ] ) ? ( $us_grid_ajax_indexes[ $post_id ] ) : 1;
|
||||
} else {
|
||||
$us_grid_ajax_indexes = NULL;
|
||||
}
|
||||
|
||||
// Global preloader type
|
||||
$preloader_type = us_get_option( 'preloader' );
|
||||
if ( ! in_array( $preloader_type, array_merge( us_get_preloader_numeric_types(), array( 'custom' ) ) ) ) {
|
||||
$preloader_type = 1;
|
||||
}
|
||||
$preloader_image = us_get_option( 'preloader_image' );
|
||||
$preloader_image_html = '';
|
||||
$img = usof_get_image_src( $preloader_image, 'medium' );
|
||||
if ( $preloader_type == 'custom' AND $img[0] != '' ) {
|
||||
$preloader_image_html .= '<img src="' . esc_url( $img[0] ) . '"';
|
||||
if ( ! empty( $img[1] ) AND ! empty( $img[2] ) ) {
|
||||
// Image sizes may be missing when logo is a direct URL
|
||||
$preloader_image_html .= ' width="' . $img[1] . '" height="' . $img[2] . '"';
|
||||
}
|
||||
$preloader_image_html .= ' alt="' . us_get_image_alt( $preloader_image ) . '"/>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
// Output preloader for Carousel and Filter
|
||||
if ( $filter_html != '' ) {
|
||||
?>
|
||||
<div class="w-grid-preloader">
|
||||
<div class="g-preloader type_<?php echo $preloader_type; ?>">
|
||||
<div><?php echo $preloader_image_html ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} elseif ( $type == 'carousel' ) {
|
||||
?>
|
||||
<div class="g-preloader type_<?php echo $preloader_type; ?>">
|
||||
<div><?php echo $preloader_image_html ?></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
// Output pagination for not Carousel type
|
||||
if ( $wp_query->max_num_pages > 1 AND $type != 'carousel' ) {
|
||||
|
||||
// Next page elements may have sliders, so we preloading the needed assets now
|
||||
if ( us_get_option( 'ajax_load_js', 0 ) == 0 ) {
|
||||
wp_enqueue_script( 'us-royalslider' );
|
||||
}
|
||||
|
||||
if ( $pagination == 'infinite' ) {
|
||||
$is_infinite = TRUE;
|
||||
$pagination = 'ajax';
|
||||
}
|
||||
if ( $pagination == 'regular' ) {
|
||||
the_posts_pagination(
|
||||
array(
|
||||
'mid_size' => 3,
|
||||
'before_page_number' => '<span>',
|
||||
'after_page_number' => '</span>',
|
||||
)
|
||||
);
|
||||
} elseif ( $pagination == 'ajax' ) {
|
||||
$pagination_btn_css = us_prepare_inline_css( array( 'font-size' => $pagination_btn_size ) );
|
||||
if ( $pagination_btn_fullwidth ) {
|
||||
$loadmore_classes = ' width_full';
|
||||
} else {
|
||||
$loadmore_classes = '';
|
||||
}
|
||||
?>
|
||||
<div class="g-loadmore<?php echo $loadmore_classes; ?>">
|
||||
<div class="g-preloader type_<?php echo $preloader_type; ?>">
|
||||
<div></div>
|
||||
</div>
|
||||
<a class="w-btn us-btn-style_<?php echo $pagination_btn_style ?>"<?php echo $pagination_btn_css ?> href="javascript:void(0)">
|
||||
<span class="w-btn-label"><?php echo $pagination_btn_text ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
// Define and output all JSON data
|
||||
$json_data = array(
|
||||
|
||||
// Controller options
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'permalink_url' => get_permalink(),
|
||||
'action' => 'us_ajax_grid',
|
||||
'max_num_pages' => $wp_query->max_num_pages,
|
||||
'infinite_scroll' => ( isset( $is_infinite ) ? $is_infinite : 0 ),
|
||||
|
||||
// Grid listing template variables that will be passed to this file in the next call
|
||||
'template_vars' => array(
|
||||
'query_args' => $query_args,
|
||||
'post_id' => $post_id,
|
||||
'us_grid_index' => $us_grid_index,
|
||||
'us_grid_ajax_index' => $us_grid_ajax_indexes[ $post_id ],
|
||||
'exclude_items' => $exclude_items,
|
||||
'items_offset' => $items_offset,
|
||||
'items_layout' => $items_layout,
|
||||
'type' => $type,
|
||||
'columns' => $columns,
|
||||
'img_size' => $img_size,
|
||||
'overriding_link' => $overriding_link,
|
||||
),
|
||||
);
|
||||
|
||||
// Carousel settings
|
||||
if ( $type == 'carousel' ) {
|
||||
$json_data = array_merge( $json_data, array(
|
||||
'carousel_settings' => array(
|
||||
'items' => $columns,
|
||||
'nav' => intval( ! ! $carousel_arrows ),
|
||||
'navNext' => '',
|
||||
'navPrev' => '',
|
||||
'dots' => intval( ! ! $carousel_dots ),
|
||||
'center' => intval( ! ! $carousel_center ),
|
||||
'autoplay' => ( $carousel_autoplay AND ( $items_count > $columns ) ) ? 1 : 0,
|
||||
'smooth_play' => intval( ! ! $carousel_autoplay_smooth ),
|
||||
'timeout' => intval( $carousel_interval * 1000 ),
|
||||
'speed' => intval( $carousel_speed ),
|
||||
'transition' => strip_tags( $carousel_transition ),
|
||||
'autoHeight' => ( $columns == 1 ) ? intval( $carousel_autoheight ) : 0,
|
||||
'slideby' => ( $carousel_slideby ? 'page' : '1' ),
|
||||
),
|
||||
'carousel_breakpoints' => array(
|
||||
intval( $breakpoint_1_width ) => array(
|
||||
'items' => intval( $columns ),
|
||||
),
|
||||
intval( $breakpoint_2_width ) => array(
|
||||
'items' => min( intval( $breakpoint_1_cols ), $columns ),
|
||||
'autoplay' => intval( ! ! $breakpoint_1_autoplay ),
|
||||
'autoplayHoverPause' => intval( ! ! $breakpoint_1_autoplay ),
|
||||
),
|
||||
intval( $breakpoint_3_width ) => array(
|
||||
'items' => min( intval( $breakpoint_2_cols ), $columns ),
|
||||
'autoplay' => intval( ! ! $breakpoint_2_autoplay ),
|
||||
'autoplayHoverPause' => intval( ! ! $breakpoint_2_autoplay ),
|
||||
),
|
||||
0 => array(
|
||||
'items' => min( intval( $breakpoint_3_cols ), $columns ),
|
||||
'autoplay' => intval( ! ! $breakpoint_3_autoplay ),
|
||||
'autoplayHoverPause' => intval( ! ! $breakpoint_3_autoplay ),
|
||||
'autoHeight' => ( $carousel_autoheight AND ! $breakpoint_3_autoplay ) ? 1 : 0,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Add lang variable if WPML is active
|
||||
if ( class_exists( 'SitePress' ) ) {
|
||||
global $sitepress;
|
||||
if ( $sitepress->get_default_language() != $sitepress->get_current_language() ) {
|
||||
$json_data['template_vars']['lang'] = $sitepress->get_current_language();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="w-grid-json hidden"<?php echo us_pass_data_to_js( $json_data ) ?>></div>
|
||||
<?php
|
||||
|
||||
// Output popup semantics
|
||||
if ( $overriding_link == 'popup_post' ) {
|
||||
?>
|
||||
<div class="l-popup">
|
||||
<div class="l-popup-overlay"></div>
|
||||
<div class="l-popup-wrap">
|
||||
<div class="l-popup-box">
|
||||
<div class="l-popup-box-content"<?php echo us_prepare_inline_css( array( 'max-width' => $popup_width ) ); ?>>
|
||||
<div class="g-preloader type_<?php echo $preloader_type; ?>">
|
||||
<div><?php echo $preloader_image_html ?></div>
|
||||
</div>
|
||||
<iframe class="l-popup-box-content-frame" allowfullscreen></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( $popup_arrows ) { ?>
|
||||
<div class="l-popup-arrow to_next" title="Next"></div>
|
||||
<div class="l-popup-arrow to_prev" title="Previous"></div>
|
||||
<?php } ?>
|
||||
<div class="l-popup-closer"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output one post from Grid listing.
|
||||
*
|
||||
* (!) Should be called in WP_Query fetching loop only.
|
||||
* @link https://codex.wordpress.org/Class_Reference/WP_Query#Standard_Loop
|
||||
*
|
||||
* @var $post_classes string CSS classes
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/grid/listing-post'
|
||||
* @action After the template: 'us_after_template:templates/grid/listing-post'
|
||||
* @filter Template variables: 'us_template_vars:templates/grid/listing-post'
|
||||
*/
|
||||
|
||||
global $us_grid_listing_post_atts;
|
||||
$grid_layout_settings = $us_grid_listing_post_atts['grid_layout_settings'];
|
||||
$type = $us_grid_listing_post_atts['type'];
|
||||
$is_widget = $us_grid_listing_post_atts['is_widget'];
|
||||
$overriding_link = $us_grid_listing_post_atts['overriding_link'];
|
||||
|
||||
$post_classes = 'w-grid-item';
|
||||
|
||||
// Aspect ratio class
|
||||
if ( us_arr_path( $grid_layout_settings, 'default.options.ratio' ) ) {
|
||||
$post_classes .= ' ratio_' . us_arr_path( $grid_layout_settings, 'default.options.ratio' );
|
||||
}
|
||||
|
||||
// Size class for Portfolio Pages
|
||||
if ( $type != 'carousel' AND ! $is_widget AND usof_meta( 'us_tile_size' ) != '' ) {
|
||||
$post_classes .= ' size_' . usof_meta( 'us_tile_size' );
|
||||
}
|
||||
|
||||
// Custom colors for Portfolio Pages
|
||||
$inline_css = us_prepare_inline_css(
|
||||
array(
|
||||
'background' => usof_meta( 'us_tile_bg_color' ),
|
||||
'color' => usof_meta( 'us_tile_text_color' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Generate Overriding Link semantics to the whole grid item
|
||||
$link_url = $link_atts = '';
|
||||
$link_title = FALSE;
|
||||
if ( $overriding_link == 'post' OR $overriding_link == 'popup_post' ) {
|
||||
// Force custom link from metabox option
|
||||
$tile_custom_link = json_decode( usof_meta( 'us_tile_link' ), TRUE );
|
||||
if ( $tile_custom_link AND ! empty( $tile_custom_link['url'] ) ) {
|
||||
$link_url = $tile_custom_link['url'];
|
||||
if ( ! empty( $tile_custom_link['target'] ) ) {
|
||||
$link_atts .= ' target="_blank"';
|
||||
// If link to an image, open it in a popup
|
||||
} elseif ( preg_match( "/\.(bmp|gif|jpeg|jpg|png)$/i", $link_url ) ) {
|
||||
$link_atts .= ' ref="magnificPopupGrid" title="' . esc_attr( strip_tags( get_the_title() ) ) . '"';
|
||||
$link_title = TRUE;
|
||||
}
|
||||
$post_classes .= ' custom-link';
|
||||
} else {
|
||||
$link_url = apply_filters( 'the_permalink', get_permalink() );
|
||||
$link_atts .= ' rel="bookmark"';
|
||||
}
|
||||
// Force opening in a new tab for "Link" post format
|
||||
if ( get_post_format() == 'link' ) {
|
||||
$link_atts .= ' target="_blank"';
|
||||
}
|
||||
} elseif ( $overriding_link == 'popup_post_image' ) {
|
||||
$tnail_id = get_post_thumbnail_id();
|
||||
$link_url = wp_get_attachment_image_url( $tnail_id, 'full' );
|
||||
if ( $link_url ) {
|
||||
// Use the Caption as a Title
|
||||
$attachment = get_post( $tnail_id );
|
||||
$img_title = trim( strip_tags( $attachment->post_excerpt ) );
|
||||
if ( empty( $img_title ) ) {
|
||||
// If not, Use the Alt
|
||||
$img_title = trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', TRUE ) ) );
|
||||
}
|
||||
if ( empty( $img_title ) ) {
|
||||
// If no Alt, use the Title
|
||||
$img_title = trim( strip_tags( get_the_title() ) );
|
||||
}
|
||||
$link_atts .= ' ref="magnificPopupGrid" title="' . esc_attr( $img_title ) . '"';
|
||||
$link_title = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Add aria-label if "title" attribute is absent for accessibility support
|
||||
if ( ! $link_title ) {
|
||||
$link_atts .= ' aria-label="' . esc_attr( strip_tags( get_the_title() ) ) . '"';
|
||||
}
|
||||
|
||||
// Apply theme filter
|
||||
$post_classes = apply_filters( 'us_grid_item_classes', $post_classes, get_the_id() );
|
||||
?>
|
||||
<article <?php post_class( $post_classes ) ?> data-id="<?php the_ID() ?>">
|
||||
<div class="w-grid-item-h"<?php echo $inline_css ?>>
|
||||
<?php if ( $link_url ): ?>
|
||||
<a class="w-grid-item-anchor" href="<?php echo esc_url( $link_url ) ?>"<?php echo $link_atts ?>></a>
|
||||
<?php endif; ?>
|
||||
<?php us_output_builder_elms( $grid_layout_settings, 'default', 'middle_center', 'grid' ); ?>
|
||||
</div>
|
||||
</article>
|
||||
<?php
|
||||
@@ -0,0 +1,379 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Opening part of Grid output
|
||||
*/
|
||||
|
||||
// Variables defaults
|
||||
$list_classes = $css_listing = $css_layout = '';
|
||||
|
||||
$us_grid_index = isset( $us_grid_index ) ? intval( $us_grid_index ) : 0;
|
||||
$is_widget = isset( $is_widget ) ? $is_widget : FALSE;
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$filter_html = isset( $filter_html ) ? $filter_html : '';
|
||||
$data_atts = isset( $data_atts ) ? $data_atts : '';
|
||||
|
||||
// Check Grid params and use default values from config, if its not set
|
||||
$default_grid_params = us_shortcode_atts( array(), 'us_grid' );
|
||||
foreach ( $default_grid_params as $param => $value ) {
|
||||
if ( ! isset( $$param ) ) {
|
||||
$$param = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Check Carousel params and use default values from config, if its not set
|
||||
if ( $type == 'carousel' ) {
|
||||
$default_carousel_params = us_shortcode_atts( array(), 'us_carousel' );
|
||||
foreach ( $default_carousel_params as $param => $value ) {
|
||||
if ( ! isset( $$param ) ) {
|
||||
$$param = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set grid ID
|
||||
$grid_elm_id = ( ! empty( $el_id ) ) ? $el_id : 'us_grid_' . $us_grid_index;
|
||||
|
||||
// Calculate or not specific CSS for grid items depending on Grid Layout Aspect Ratio
|
||||
$grid_fixed_ratio = us_arr_path( $grid_layout_settings, 'default.options.fixed' );
|
||||
|
||||
// Additional classes for "w-grid"
|
||||
$classes .= ' type_' . $type;
|
||||
$classes .= ' layout_' . $items_layout;
|
||||
if ( $columns != 1 AND $type != 'carousel' ) {
|
||||
$classes .= ' cols_' . $columns;
|
||||
}
|
||||
if ( $items_valign ) {
|
||||
$classes .= ' valign_center';
|
||||
}
|
||||
if ( $pagination == 'regular' ) {
|
||||
$classes .= ' with_pagination';
|
||||
}
|
||||
if ( $grid_fixed_ratio ) {
|
||||
$classes .= ' height_fixed';
|
||||
} elseif ( us_arr_path( $grid_layout_settings, 'default.options.overflow' ) ) {
|
||||
$classes .= ' overflow_hidden';
|
||||
}
|
||||
if ( $overriding_link == 'popup_post' ) {
|
||||
$classes .= ' popup_page';
|
||||
}
|
||||
if ( $filter_html != '' ) {
|
||||
$classes .= ' with_filters';
|
||||
}
|
||||
|
||||
// Apply isotope script for Masonry type
|
||||
if ( $type == 'masonry' AND $columns > 1 ) {
|
||||
if ( us_get_option( 'ajax_load_js', 0 ) == 0 ) {
|
||||
wp_enqueue_script( 'us-isotope' );
|
||||
}
|
||||
$classes .= ' with_isotope';
|
||||
}
|
||||
|
||||
// Output attributes for Carousel type
|
||||
if ( $type == 'carousel' ) {
|
||||
if ( us_get_option( 'ajax_load_js', 0 ) == 0 ) {
|
||||
wp_enqueue_script( 'us-owl' );
|
||||
}
|
||||
|
||||
$list_classes .= ' owl-carousel';
|
||||
$list_classes .= ' navstyle_' . $carousel_arrows_style;
|
||||
$list_classes .= ' navpos_' . $carousel_arrows_pos;
|
||||
if ( $carousel_dots ) {
|
||||
$list_classes .= ' with_dots';
|
||||
}
|
||||
if ( $columns == 1 AND $carousel_autoheight ) {
|
||||
$list_classes .= ' autoheight';
|
||||
}
|
||||
|
||||
// Customize Carousel Arrows for current listing only
|
||||
if ( $carousel_arrows ) {
|
||||
if ( ! empty( $carousel_arrows_size ) AND $carousel_arrows_size != '1.8rem' ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .owl-nav div { font-size: ' . strip_tags( $carousel_arrows_size ) . '}';
|
||||
}
|
||||
if ( ! empty( $carousel_arrows_offset ) ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .owl-nav div { margin-left: ' . strip_tags( $carousel_arrows_offset ) . '; margin-right: ' . strip_tags( $carousel_arrows_offset ) . '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Generate items gap via CSS
|
||||
if ( ! empty( $items_gap ) ) {
|
||||
if ( $columns != 1 ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-item { padding: ' . $items_gap . '}';
|
||||
if ( ! empty( $filter_html ) AND $pagination == 'none' ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-list { margin: ' . $items_gap . ' -' . $items_gap . ' -' . $items_gap . '}';
|
||||
}
|
||||
if ( ! empty( $filter_html ) AND $pagination != 'none' ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-list { margin: ' . $items_gap . ' -' . $items_gap . '}';
|
||||
}
|
||||
if ( empty( $filter_html ) AND $pagination != 'none' ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-list { margin: -' . $items_gap . ' -' . $items_gap . ' ' . $items_gap . '}';
|
||||
}
|
||||
if ( empty( $filter_html ) AND $pagination == 'none' ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-list { margin: -' . $items_gap . '}';
|
||||
}
|
||||
// Force gap between neighbour "w-grid" elements
|
||||
$css_listing .= '.w-grid + #' . $grid_elm_id . ' .w-grid-list { margin-top: ' . $items_gap . '}';
|
||||
// Force left & right gaps for grid-list in fullwidth section
|
||||
$css_listing .= '.l-section.width_full > div > div > .vc_col-sm-12 > div > div > #' . $grid_elm_id . ' .w-grid-list { margin-left: ' . $items_gap . '; margin-right: ' . $items_gap . '}';
|
||||
// Force top & bottom gaps for grid-list in fullheight section
|
||||
$css_listing .= '.l-section.height_auto > div > div > .vc_col-sm-12 > div > div > #' . $grid_elm_id . ':first-child .w-grid-list { margin-top: ' . $items_gap . '}';
|
||||
$css_listing .= '.l-section.height_auto > div > div > .vc_col-sm-12 > div > div > #' . $grid_elm_id . ':last-child .w-grid-list { margin-bottom: ' . $items_gap . '}';
|
||||
} elseif ( $type != 'carousel' ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-item:not(:last-child) { margin-bottom: ' . $items_gap . '}';
|
||||
$css_listing .= '#' . $grid_elm_id . ' .g-loadmore { margin-top: ' . $items_gap . '}';
|
||||
}
|
||||
} else {
|
||||
$classes .= ' no_gap';
|
||||
}
|
||||
|
||||
// Generate columns responsive CSS for 3 breakpoints
|
||||
if ( $type != 'carousel' AND ! $is_widget ) {
|
||||
for ( $i = 1; $i < 4; $i ++ ) {
|
||||
$responsive_cols = intval( ${ 'breakpoint_' . $i .'_cols' } );
|
||||
$responsive_width = intval( ${ 'breakpoint_' . $i . '_width' } );
|
||||
|
||||
if ( $columns > $responsive_cols ) {
|
||||
$css_listing .= '@media (max-width:' . ( $responsive_width - 1 ) . 'px) {';
|
||||
if ( $responsive_cols == 1 AND ! empty( $items_gap ) ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-list { margin: 0 }';
|
||||
}
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-item { width:' . 100 / $responsive_cols . '%;';
|
||||
if ( $responsive_cols == 1 AND ! empty( $items_gap ) ) {
|
||||
$css_listing .= 'padding: 0; margin-bottom: ' . $items_gap;
|
||||
}
|
||||
$css_listing .= '}';
|
||||
if ( $responsive_cols != 1 AND $grid_fixed_ratio ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-item.size_2x1,';
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-grid-item.size_2x2 {';
|
||||
$css_listing .= 'width:' . 200 / $responsive_cols . '% }';
|
||||
}
|
||||
$css_listing .= '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add Post Title font-size for current listing only
|
||||
if ( $title_size != '' ) {
|
||||
$css_listing .= '#' . $grid_elm_id . ' .w-post-elm.post_title { font-size: ' . strip_tags( $title_size ) . '}';
|
||||
}
|
||||
|
||||
// Calculate items aspect ratio
|
||||
if ( $grid_fixed_ratio ) {
|
||||
$grid_elm_ratio_w = $grid_elm_ratio_h = 1;
|
||||
|
||||
$grid_elm_ratio = us_arr_path( $grid_layout_settings, 'default.options.ratio' );
|
||||
if ( $grid_elm_ratio == '4x3' ) {
|
||||
$grid_elm_ratio_w = 4;
|
||||
$grid_elm_ratio_h = 3;
|
||||
} elseif ( $grid_elm_ratio == '3x2' ) {
|
||||
$grid_elm_ratio_w = 3;
|
||||
$grid_elm_ratio_h = 2;
|
||||
} elseif ( $grid_elm_ratio == '2x3' ) {
|
||||
$grid_elm_ratio_w = 2;
|
||||
$grid_elm_ratio_h = 3;
|
||||
} elseif ( $grid_elm_ratio == '3x4' ) {
|
||||
$grid_elm_ratio_w = 3;
|
||||
$grid_elm_ratio_h = 4;
|
||||
} elseif ( $grid_elm_ratio == '16x9' ) {
|
||||
$grid_elm_ratio_w = 16;
|
||||
$grid_elm_ratio_h = 9;
|
||||
} elseif ( $grid_elm_ratio == 'custom' ) {
|
||||
$grid_elm_ratio_w = floatval( str_replace( ',', '.', preg_replace( '/^[^\d.,]+$/', '', us_arr_path( $grid_layout_settings, 'default.options.ratio_width' ) ) ) );
|
||||
if ( $grid_elm_ratio_w <= 0 ) {
|
||||
$grid_elm_ratio_w = 1;
|
||||
}
|
||||
$grid_elm_ratio_h = floatval( str_replace( ',', '.', preg_replace( '/^[^\d.,]+$/', '', us_arr_path( $grid_layout_settings, 'default.options.ratio_height' ) ) ) );
|
||||
if ( $grid_elm_ratio_h <= 0 ) {
|
||||
$grid_elm_ratio_h = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply grid item aspect ratio
|
||||
$css_layout .= '#' . $grid_elm_id . ' .w-grid-item-h:before {';
|
||||
$css_layout .= 'padding-bottom: ' . number_format( $grid_elm_ratio_h / $grid_elm_ratio_w * 100, 4 ) . '%}';
|
||||
|
||||
// Fix aspect ratio regarding meta custom size and items gap
|
||||
if ( empty( $items_gap ) ) {
|
||||
$items_gap = '0px'; // needed for CSS calc function
|
||||
}
|
||||
if ( $type != 'carousel' AND ! $is_widget ) {
|
||||
$css_layout .= '@media (min-width:' . intval( $breakpoint_3_width ) . 'px) {';
|
||||
$css_layout .= '#' . $grid_elm_id . ' .w-grid-item.size_1x2 .w-grid-item-h:before {';
|
||||
$css_layout .= 'padding-bottom: calc(' . ( $grid_elm_ratio_h * 2 ) / $grid_elm_ratio_w * 100 . '% + ' . $items_gap . ' + ' . $items_gap . ')}';
|
||||
$css_layout .= '#' . $grid_elm_id . ' .w-grid-item.size_2x1 .w-grid-item-h:before {';
|
||||
$css_layout .= 'padding-bottom: calc(' . $grid_elm_ratio_h / ( $grid_elm_ratio_w * 2 ) * 100 . '% - ' . $items_gap . ' * ' . $grid_elm_ratio_h / $grid_elm_ratio_w . ')}';
|
||||
$css_layout .= '#' . $grid_elm_id . ' .w-grid-item.size_2x2 .w-grid-item-h:before {';
|
||||
$css_layout .= 'padding-bottom: calc(' . $grid_elm_ratio_h / $grid_elm_ratio_w * 100 . '% - ' . $items_gap . ' * ' . 2 * ( $grid_elm_ratio_h / $grid_elm_ratio_w - 1 ) . ')}';
|
||||
$css_layout .= '}';
|
||||
}
|
||||
}
|
||||
|
||||
// Generate Grid Layout settings CSS
|
||||
$item_bg_color = us_arr_path( $grid_layout_settings, 'default.options.color_bg' );
|
||||
$item_text_color = us_arr_path( $grid_layout_settings, 'default.options.color_text' );
|
||||
$item_border_radius = floatval( us_arr_path( $grid_layout_settings, 'default.options.border_radius' ) );
|
||||
$item_box_shadow = floatval( us_arr_path( $grid_layout_settings, 'default.options.box_shadow' ) );
|
||||
$item_box_shadow_hover = floatval( us_arr_path( $grid_layout_settings, 'default.options.box_shadow_hover' ) );
|
||||
|
||||
$css_layout .= '#' . $grid_elm_id . ' .w-grid-item-h {';
|
||||
if ( ! empty( $item_bg_color ) ) {
|
||||
$css_layout .= 'background:' . $item_bg_color . ';';
|
||||
}
|
||||
if ( ! empty( $item_text_color ) ) {
|
||||
$css_layout .= 'color:' . $item_text_color . ';';
|
||||
}
|
||||
if ( ! empty( $item_border_radius ) ) {
|
||||
$css_layout .= 'border-radius:' . $item_border_radius . 'rem;';
|
||||
$css_layout .= 'z-index: 3;';
|
||||
}
|
||||
if ( ! empty( $item_box_shadow ) OR ! empty( $item_box_shadow_hover ) ) {
|
||||
$css_layout .= 'box-shadow:';
|
||||
$css_layout .= '0 ' . number_format( $item_box_shadow / 10, 2 ) . 'rem ' . number_format( $item_box_shadow / 5, 2 ) . 'rem rgba(0,0,0,0.1),';
|
||||
$css_layout .= '0 ' . number_format( $item_box_shadow / 3, 2 ) . 'rem ' . number_format( $item_box_shadow, 2 ) . 'rem rgba(0,0,0,0.1);';
|
||||
$css_layout .= 'transition-duration: 0.3s;';
|
||||
}
|
||||
$css_layout .= '}';
|
||||
if ( $item_box_shadow_hover != $item_box_shadow ) {
|
||||
$css_layout .= '.no-touch #' . $grid_elm_id . ' .w-grid-item-h:hover { box-shadow:';
|
||||
$css_layout .= '0 ' . number_format( $item_box_shadow_hover / 10, 2 ) . 'rem ' . number_format( $item_box_shadow_hover / 5, 2 ) . 'rem rgba(0,0,0,0.1),';
|
||||
$css_layout .= '0 ' . number_format( $item_box_shadow_hover / 3, 2 ) . 'rem ' . number_format( $item_box_shadow_hover, 2 ) . 'rem rgba(0,0,0,0.15);';
|
||||
$css_layout .= 'z-index: 4;';
|
||||
$css_layout .= '}';
|
||||
}
|
||||
|
||||
// Generate Grid Layout elements CSS
|
||||
$css_data = array();
|
||||
foreach ( $grid_layout_settings['data'] as $elm_id => $elm ) {
|
||||
$elm_class = 'usg_' . str_replace( ':', '_', $elm_id );
|
||||
|
||||
// Elements settings
|
||||
$css_layout .= '#' . $grid_elm_id . ' .' . $elm_class . '{';
|
||||
$elm_tag = isset( $elm['tag'] ) ? $elm['tag'] : 'div';
|
||||
$css_layout .= us_prepare_inline_css(
|
||||
array(
|
||||
'font-family' => isset( $elm['font'] ) ? $elm['font'] : '',
|
||||
'font-weight' => isset( $elm['font_weight'] ) ? $elm['font_weight'] : '',
|
||||
'text-transform' => isset( $elm['text_transform'] ) ? $elm['text_transform'] : '',
|
||||
'font-style' => isset( $elm['font_style'] ) ? $elm['font_style'] : '',
|
||||
'font-size' => isset( $elm['font_size'] ) ? $elm['font_size'] : '',
|
||||
'line-height' => isset( $elm['line_height'] ) ? $elm['line_height'] : '',
|
||||
'border-radius' => isset( $elm['border_radius'] ) ? $elm['border_radius'] : '',
|
||||
'width' => isset( $elm['width'] ) ? $elm['width'] : '',
|
||||
'flex-shrink' => ! empty( $elm['width'] ) ? '0' : '',
|
||||
'background' => isset( $elm['color_bg'] ) ? $elm['color_bg'] : '',
|
||||
'border-color' => isset( $elm['color_border'] ) ? $elm['color_border'] : '',
|
||||
'color' => isset( $elm['color_text'] ) ? $elm['color_text'] : '',
|
||||
),
|
||||
$style_attr = FALSE,
|
||||
$elm_tag
|
||||
);
|
||||
$css_layout .= ( isset( $elm['bg_gradient'] ) AND $elm['bg_gradient'] AND ! empty( $elm['color_grad'] ) ) ? 'background: linear-gradient( transparent, ' . $elm['color_grad'] . ');' : '';
|
||||
$css_layout .= '}';
|
||||
if ( ! empty( $elm['font_size_mobiles'] ) ) {
|
||||
$css_layout .= '@media (max-width:' . ( intval( $breakpoint_3_width ) - 1 ) . 'px) {';
|
||||
$css_layout .= '#' . $grid_elm_id . ' .' . $elm_class . '{';
|
||||
$css_layout .= 'font-size:' . $elm['font_size_mobiles'] . ' !important;';
|
||||
$css_layout .= '}}';
|
||||
}
|
||||
if ( ! empty( $elm['line_height_mobiles'] ) ) {
|
||||
$css_layout .= '@media (max-width:' . ( intval( $breakpoint_3_width ) - 1 ) . 'px) {';
|
||||
$css_layout .= '#' . $grid_elm_id . ' .' . $elm_class . '{';
|
||||
$css_layout .= 'line-height:' . $elm['line_height_mobiles'] . ' !important;';
|
||||
$css_layout .= '}}';
|
||||
}
|
||||
if ( isset( $elm['hide_below'] ) AND intval( $elm['hide_below'] ) != 0 ) {
|
||||
$css_layout .= '@media (max-width:' . ( intval( $elm['hide_below'] ) - 1 ) . 'px) {';
|
||||
$css_layout .= '#' . $grid_elm_id . ' .' . $elm_class . '{ display: none !important; }';
|
||||
$css_layout .= '}';
|
||||
}
|
||||
|
||||
// CSS of Hover effects
|
||||
if ( isset( $elm['hover'] ) AND $elm['hover'] ) {
|
||||
$css_layout .= '#' . $grid_elm_id . ' .' . $elm_class . '{';
|
||||
$css_layout .= isset( $elm['transition_duration'] ) ? 'transition-duration:' . $elm['transition_duration'] . ';' : '';
|
||||
if ( isset( $elm['scale'] ) AND isset( $elm['translateX'] ) AND isset( $elm['translateY'] ) ) {
|
||||
$css_layout .= 'transform: scale(' . $elm['scale'] . ') translate(' . $elm['translateX'] . ',' . $elm['translateY'] . ');';
|
||||
}
|
||||
$css_layout .= ( isset( $elm['opacity'] ) AND intval( $elm['opacity'] ) != 1 ) ? 'opacity:' . $elm['opacity'] . ';' : '';
|
||||
$css_layout .= '}';
|
||||
|
||||
$css_layout .= '#' . $grid_elm_id . ' .w-grid-item-h:hover .' . $elm_class . '{';
|
||||
if ( isset( $elm['scale_hover'] ) AND isset( $elm['translateX_hover'] ) AND isset( $elm['translateY_hover'] ) ) {
|
||||
$css_layout .= 'transform: scale(' . $elm['scale_hover'] . ') translate(' . $elm['translateX_hover'] . ',' . $elm['translateY_hover'] . ');';
|
||||
}
|
||||
$css_layout .= isset( $elm['opacity_hover'] ) ? 'opacity:' . $elm['opacity_hover'] . ';' : '';
|
||||
$css_layout .= ( ! empty( $elm['color_bg_hover'] ) ) ? 'background:' . $elm['color_bg_hover'] . ';' : '';
|
||||
$css_layout .= ( ! empty( $elm['color_border_hover'] ) ) ? 'border-color:' . $elm['color_border_hover'] . ';' : '';
|
||||
$css_layout .= ( ! empty( $elm['color_text_hover'] ) ) ? 'color:' . $elm['color_text_hover'] . ';' : '';
|
||||
$css_layout .= '}';
|
||||
}
|
||||
|
||||
// CSS Design Options
|
||||
if ( ! empty( $elm['design_options'] ) AND is_array( $elm['design_options'] ) ) {
|
||||
foreach ( $elm['design_options'] as $key => $value ) {
|
||||
if ( $value === '' ) {
|
||||
continue;
|
||||
}
|
||||
$key = explode( '_', $key );
|
||||
if ( ! isset( $css_data[ $key[2] ] ) ) {
|
||||
$css_data[ $key[2] ] = array();
|
||||
}
|
||||
if ( ! isset( $css_data[ $key[2] ][ $elm_class ] ) ) {
|
||||
$css_data[ $key[2] ][ $elm_class ] = array();
|
||||
}
|
||||
if ( ! isset( $css_data[ $key[2] ][ $elm_class ][ $key[0] ] ) ) {
|
||||
$css_data[ $key[2] ][ $elm_class ][ $key[0] ] = array();
|
||||
}
|
||||
$css_data[ $key[2] ][ $elm_class ][ $key[0] ][ $key[1] ] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( array( 'default' ) as $state ) {
|
||||
if ( ! isset( $css_data[ $state ] ) ) {
|
||||
continue;
|
||||
}
|
||||
foreach ( $css_data[ $state ] as $elm_class => $props ) {
|
||||
$css_layout .= '#' . $grid_elm_id . ' .' . $elm_class . '{';
|
||||
foreach ( $props as $prop => $values ) {
|
||||
// Add absolute positioning if its values not empty
|
||||
if ( $prop === 'position' AND ! empty( $values ) ) {
|
||||
$css_layout .= 'position: absolute;';
|
||||
}
|
||||
// Add solid border if its values not empty
|
||||
if ( $prop === 'border' AND ! empty( $values ) ) {
|
||||
$css_layout .= 'border-style: solid; border-width: 0;';
|
||||
}
|
||||
if ( count( $values ) == 4 AND count( array_unique( $values ) ) == 1 AND $prop !== 'position' ) {
|
||||
// All the directions have the same value, so grouping them together
|
||||
$values = array_values( $values );
|
||||
|
||||
if ( $prop === 'border' ) {
|
||||
$css_layout .= $prop . '-width:' . $values[0] . ';';
|
||||
} else {
|
||||
$css_layout .= $prop . ':' . $values[0] . ';';
|
||||
}
|
||||
} else {
|
||||
foreach ( $values as $dir => $val ) {
|
||||
if ( $prop === 'position' ) {
|
||||
$css_prop = $dir;
|
||||
} elseif ( $prop === 'border' ) {
|
||||
$css_prop = $prop . '-' . $dir . '-width';
|
||||
} else {
|
||||
$css_prop = $prop . '-' . $dir;
|
||||
}
|
||||
$css_layout .= $css_prop . ':' . $val . ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
$css_layout .= "}";
|
||||
}
|
||||
}
|
||||
|
||||
// Output the Grid semantics
|
||||
echo '<div class="w-grid' . $classes . '" id="' . esc_attr( $grid_elm_id ) . '">';
|
||||
echo '<style id="' . $grid_elm_id . '_css">' . us_minify_css( $css_listing ) . '</style>';
|
||||
echo '<style>' . us_minify_css( $css_layout ) . '</style>'; // TODO make this depends on the previous Grid Layout of a page
|
||||
echo $filter_html;
|
||||
echo '<div class="w-grid-list' . $list_classes . '"' . $data_atts . '>';
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output one term from Grid listing
|
||||
*/
|
||||
|
||||
global $us_grid_listing_post_atts, $us_grid_term;
|
||||
$grid_layout_settings = $us_grid_listing_post_atts['grid_layout_settings'];
|
||||
$overriding_link = $us_grid_listing_post_atts['overriding_link'];
|
||||
|
||||
$term_classes = 'w-grid-item type_term';
|
||||
|
||||
// Aspect ratio class
|
||||
if ( us_arr_path( $grid_layout_settings, 'default.options.ratio' ) ) {
|
||||
$term_classes .= ' ratio_' . us_arr_path( $grid_layout_settings, 'default.options.ratio' );
|
||||
}
|
||||
|
||||
// Generate Overriding Link semantics to the whole grid item
|
||||
$link_url = $link_atts = '';
|
||||
$link_title = FALSE;
|
||||
|
||||
if ( $overriding_link == 'post' OR $overriding_link == 'popup_post' ) {
|
||||
|
||||
$link_url = apply_filters( 'the_permalink', get_term_link( $us_grid_term ) );
|
||||
$link_atts .= ' rel="bookmark"';
|
||||
|
||||
} elseif ( $overriding_link == 'popup_post_image' ) {
|
||||
|
||||
$tnail_id = get_term_meta( $us_grid_term->term_id, 'thumbnail_id', TRUE );
|
||||
$link_url = wp_get_attachment_image_url( $tnail_id, 'full' );
|
||||
if ( $link_url ) {
|
||||
// Use the Caption as a Title
|
||||
$attachment = get_post( $tnail_id );
|
||||
$img_title = trim( strip_tags( $attachment->post_excerpt ) );
|
||||
if ( empty( $img_title ) ) {
|
||||
// If not, Use the Alt
|
||||
$img_title = trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', TRUE ) ) );
|
||||
}
|
||||
if ( empty( $img_title ) ) {
|
||||
// If no Alt, use the Term name
|
||||
$img_title = $us_grid_term->name;
|
||||
}
|
||||
$link_atts .= ' ref="magnificPopupGrid" title="' . esc_attr( $img_title ) . '"';
|
||||
$link_title = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Add aria-label if "title" attribute is absent for accessibility support
|
||||
if ( ! $link_title ) {
|
||||
$link_atts .= ' aria-label="' . esc_attr( strip_tags( $us_grid_term->name ) ) . '"';
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="<?php echo $term_classes ?>">
|
||||
<div class="w-grid-item-h">
|
||||
<?php if ( $link_url ): ?>
|
||||
<a class="w-grid-item-anchor" href="<?php echo esc_url( $link_url ) ?>"<?php echo $link_atts ?>></a>
|
||||
<?php endif; ?>
|
||||
<?php us_output_builder_elms( $grid_layout_settings, 'default', 'middle_center', 'grid_term' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
@@ -0,0 +1,270 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Output a single Grid listing. The universal template that is used by all the possible Grid listings.
|
||||
*
|
||||
* (!) $query_args should be filtered before passing to this template.
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/us_grid/listing'
|
||||
* @action After the template: 'us_after_template:templates/us_grid/listing'
|
||||
* @filter Template variables: 'us_template_vars:templates/us_grid/listing'
|
||||
*/
|
||||
|
||||
$us_grid_index = isset( $us_grid_index ) ? intval( $us_grid_index ) : 0;
|
||||
$grid_elm_id = isset( $el_id ) ? $el_id : 'us_grid_' . $us_grid_index;
|
||||
$post_id = isset( $post_id ) ? $post_id : NULL;
|
||||
$is_widget = isset( $is_widget ) ? $is_widget : FALSE;
|
||||
$classes = isset( $classes ) ? $classes : '';
|
||||
$filter_taxonomy_name = isset( $filter_taxonomy_name ) ? $filter_taxonomy_name : '';
|
||||
$terms = isset( $terms ) ? $terms : array();
|
||||
|
||||
// Check Grid params and use default values from config, if its not set
|
||||
$default_grid_params = us_shortcode_atts( array(), 'us_grid' );
|
||||
foreach ( $default_grid_params as $param => $value ) {
|
||||
if ( ! isset( $$param ) ) {
|
||||
$$param = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Check Carousel params and use default values from config, if its not set
|
||||
if ( $type == 'carousel' ) {
|
||||
$default_carousel_params = us_shortcode_atts( array(), 'us_carousel' );
|
||||
foreach ( $default_carousel_params as $param => $value ) {
|
||||
if ( ! isset( $$param ) ) {
|
||||
$$param = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $is_widget AND $post_id != NULL AND $type != 'carousel' ) {
|
||||
$us_grid_ajax_indexes[ $post_id ] = isset( $us_grid_ajax_indexes[ $post_id ] ) ? ( $us_grid_ajax_indexes[ $post_id ] ) : 1;
|
||||
} else {
|
||||
$us_grid_ajax_indexes = NULL;
|
||||
}
|
||||
|
||||
// Determine Grid Layout
|
||||
if ( ! empty( $items_layout ) ) {
|
||||
if ( $templates_config = us_config( 'grid-templates', array(), TRUE ) AND isset( $templates_config[ $items_layout ] ) ) {
|
||||
$grid_layout_settings = us_fix_grid_settings( $templates_config[ $items_layout ] );
|
||||
} elseif ( $grid_layout = get_post( (int) $items_layout ) ) {
|
||||
if ( $grid_layout instanceof WP_Post AND $grid_layout->post_type === 'us_grid_layout' ) {
|
||||
if ( ! empty( $grid_layout->post_content ) AND substr( strval( $grid_layout->post_content ), 0, 1 ) === '{' ) {
|
||||
try {
|
||||
$grid_layout_settings = json_decode( $grid_layout->post_content, TRUE );
|
||||
}
|
||||
catch ( Exception $e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output "No Grid Layout"
|
||||
if ( ! isset( $grid_layout_settings ) OR empty( $grid_layout_settings ) ) {
|
||||
echo '<div>Selected Grid Layout is not found. Check the element settings.</div>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set items offset to WP Query flow
|
||||
* Needed both for regular us_grid element on page and it's AJAX pagination.
|
||||
*/
|
||||
if ( $exclude_items == 'offset' AND abs( intval( $items_offset ) ) > 0 ) {
|
||||
global $us_grid_items_offset;
|
||||
$us_grid_items_offset = abs( intval( $items_offset ) );
|
||||
$query_args['_id'] = 'us_grid';
|
||||
add_action( 'pre_get_posts', 'us_grid_query_offset', 1 );
|
||||
add_filter( 'found_posts', 'us_grid_adjust_offset_pagination', 1, 2 );
|
||||
}
|
||||
|
||||
// Filter and execute database query
|
||||
global $wp_query, $us_grid_skip_ids;
|
||||
if ( empty ( $us_grid_index ) OR ! is_array( $us_grid_skip_ids ) ) {
|
||||
$us_grid_skip_ids = array();
|
||||
}
|
||||
$use_custom_query = isset( $query_args ) AND is_array( $query_args ) AND ! empty( $query_args );
|
||||
if ( $use_custom_query ) {
|
||||
us_open_wp_query_context();
|
||||
$wp_query = new WP_Query( $query_args );
|
||||
} else {
|
||||
$query_args = $wp_query->query;
|
||||
|
||||
// Extracting query arguments from WP_Query that are not shown but relevant
|
||||
if ( ! isset( $query_args['post_type'] ) ) {
|
||||
$request_where = substr( $wp_query->request, strpos( $wp_query->request, 'WHERE' ) );
|
||||
if ( preg_match_all( '~\.post_type = \'([a-z0-9\_\-]+)\'~', $request_where, $matches ) ) {
|
||||
$query_args['post_type'] = $matches[1];
|
||||
} elseif ( preg_match( '~\.post_type IN (\((\'([a-z0-9\_\-]+)\'(, )?)+\))~', $request_where, $matches ) ) {
|
||||
$post_types_str = substr( $matches[1], 2, - 2 );
|
||||
$post_types = explode( "', '", $post_types_str );
|
||||
$query_args['post_type'] = $post_types;
|
||||
}
|
||||
|
||||
}
|
||||
if ( ! isset( $query_args['post_status'] ) AND preg_match_all( '~\.post_status = \'([a-z]+)\'~', $wp_query->request, $matches ) ) {
|
||||
$query_args['post_status'] = $matches[1];
|
||||
}
|
||||
// Fetching additional params for WooCommerce Products
|
||||
if ( $query_args['post_type'] == 'product' ) {
|
||||
if ( ! isset( $query_args['posts_per_page'] ) AND ! empty( $wp_query->query_vars['posts_per_page'] ) ) {
|
||||
$query_args['posts_per_page'] = $wp_query->query_vars['posts_per_page'];
|
||||
}
|
||||
if ( ! isset( $query_args['order'] ) AND ! empty( $wp_query->query_vars['order'] ) ) {
|
||||
$query_args['order'] = $wp_query->query_vars['order'];
|
||||
}
|
||||
if ( ! isset( $query_args['orderby'] ) AND ! empty( $wp_query->query_vars['orderby'] ) ) {
|
||||
$query_args['orderby'] = $wp_query->query_vars['orderby'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check if the grid have items to output, separately for posts and terms
|
||||
$no_results = FALSE;
|
||||
if ( in_array( $post_type, array( 'taxonomy_terms', 'current_child_terms' ) ) ) {
|
||||
if ( empty( $terms ) ) {
|
||||
$no_results = TRUE;
|
||||
}
|
||||
} elseif ( ! have_posts() ) {
|
||||
$no_results = TRUE;
|
||||
}
|
||||
|
||||
// Output No results
|
||||
if ( $no_results ) {
|
||||
|
||||
// Output No results message if it is not empty
|
||||
if ( ! empty( $no_items_message ) ) {
|
||||
echo '<h4 class="w-grid-none">' . strip_tags( $no_items_message, '<br><strong>' ) . '</h4>';
|
||||
}
|
||||
if ( $use_custom_query ) {
|
||||
us_close_wp_query_context();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Setting global variable for Image size to use in grid elements
|
||||
if ( ! empty( $img_size ) AND $img_size != 'default' ) {
|
||||
global $us_grid_img_size;
|
||||
$us_grid_img_size = $img_size;
|
||||
}
|
||||
|
||||
// Filter Bar HTML
|
||||
$filter_html = $data_atts = '';
|
||||
$filter_classes = $filter_style . ' align_' . $filter_align;
|
||||
if ( $filter_taxonomy_name != '' AND $type != 'carousel' AND $pagination != 'regular' AND ! $is_widget ) {
|
||||
|
||||
// $categories_names already contains only the used categories
|
||||
if ( count( $filter_taxonomies ) > 1 ) {
|
||||
$filter_html .= '<div class="g-filters ' . $filter_classes . '"><div class="g-filters-list">';
|
||||
|
||||
$active_tab = ' active';
|
||||
// Output "All" item
|
||||
if ( $filter_show_all ) {
|
||||
$filter_html .= '<a class="g-filters-item' . $active_tab . '" href="javascript:void(0)" data-taxonomy="*">';
|
||||
$filter_html .= '<span>' . __( 'All', 'us' ) . '</span>';
|
||||
$filter_html .= '</a>';
|
||||
$active_tab = '';
|
||||
}
|
||||
|
||||
// Output taxonomy Items
|
||||
foreach ( $filter_taxonomies as $filter_taxonomy ) {
|
||||
$filter_html .= '<a class="g-filters-item' . $active_tab . '" href="javascript:void(0)"';
|
||||
$filter_html .= ' data-taxonomy="' . $filter_taxonomy->slug . '"';
|
||||
$filter_html .= ' data-amount="' . $filter_taxonomy->count . '"';
|
||||
$filter_html .= '>';
|
||||
$filter_html .= '<span>' . $filter_taxonomy->name . '</span>';
|
||||
$filter_html .= '<span class="g-filters-item-amount">' . $filter_taxonomy->count . '</span>';
|
||||
$filter_html .= '</a>';
|
||||
$active_tab = '';
|
||||
}
|
||||
|
||||
$filter_html .= '</div></div>';
|
||||
|
||||
$data_atts .= ' data-filter_taxonomy_name="' . $filter_taxonomy_name . '"';
|
||||
if ( ! $filter_show_all ) {
|
||||
$filter_default_taxonomies = $filter_taxonomies[0]->slug;
|
||||
$data_atts .= ' data-filter_default_taxonomies="' . $filter_default_taxonomies . '"';
|
||||
} elseif ( ! empty( $filter_default_taxonomies ) ) {
|
||||
$data_atts .= ' data-filter_default_taxonomies="' . $filter_default_taxonomies . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get all needed variables to pass into listing-start & listing-end templates
|
||||
$template_vars = array(
|
||||
'grid_layout_settings' => $grid_layout_settings,
|
||||
'us_grid_index' => $us_grid_index,
|
||||
'classes' => $classes,
|
||||
'filter_html' => $filter_html,
|
||||
'is_widget' => $is_widget,
|
||||
'data_atts' => $data_atts,
|
||||
'query_args' => $query_args,
|
||||
'post_id' => $post_id,
|
||||
'us_grid_ajax_indexes' => $us_grid_ajax_indexes,
|
||||
'wp_query' => $wp_query,
|
||||
);
|
||||
// Add default values for unset variables from Grid config
|
||||
foreach ( $default_grid_params as $param => $value ) {
|
||||
$template_vars[ $param ] = isset( $$param ) ? $$param : $value;
|
||||
}
|
||||
// Add default values for unset variables from Carousel config
|
||||
if ( $type == 'carousel' ) {
|
||||
foreach ( $default_carousel_params as $param => $value ) {
|
||||
$template_vars[ $param ] = isset( $$param ) ? $$param : $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Load listing Start
|
||||
us_load_template( 'templates/us_grid/listing-start', $template_vars );
|
||||
|
||||
// Load posts
|
||||
global $us_grid_listing_post_atts;
|
||||
$us_grid_listing_post_atts = array(
|
||||
'grid_layout_settings' => $grid_layout_settings,
|
||||
'type' => $type,
|
||||
'is_widget' => $is_widget,
|
||||
'overriding_link' => $overriding_link,
|
||||
);
|
||||
if ( empty( $terms ) ) {
|
||||
$template_vars[ 'items_count' ] = $wp_query->post_count;
|
||||
while ( have_posts() ) {
|
||||
the_post();
|
||||
$us_grid_skip_ids[] = get_the_ID();
|
||||
us_load_template( 'templates/us_grid/listing-post' );
|
||||
}
|
||||
} else {
|
||||
global $us_grid_term;
|
||||
$template_vars[ 'items_count' ] = count( $terms );
|
||||
foreach ( $terms as $term ) {
|
||||
$us_grid_term = $term;
|
||||
$us_grid_skip_ids[] = $term->term_id;
|
||||
us_load_template( 'templates/us_grid/listing-term' );
|
||||
}
|
||||
}
|
||||
|
||||
// Load listing End
|
||||
us_load_template( 'templates/us_grid/listing-end', $template_vars );
|
||||
|
||||
// If we are in front end editor mode, apply JS to the current grid
|
||||
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
|
||||
echo '<script>
|
||||
jQuery(function($){
|
||||
if (typeof $us !== "undefined" && typeof $us.WGrid === "function") {
|
||||
var $gridContainer = $("#' . $grid_elm_id . '");
|
||||
$gridContainer.wGrid();
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
if ( $use_custom_query ) {
|
||||
// Cleaning up
|
||||
us_close_wp_query_context();
|
||||
}
|
||||
|
||||
// Reset image size for the next grid element
|
||||
if ( isset( $us_grid_img_size ) ) {
|
||||
$us_grid_img_size = 'default';
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Search widget
|
||||
*
|
||||
* (!) Important: this file is not intended to be overloaded, so use the below hooks for customizing instead
|
||||
*
|
||||
* @var $layout string Search widget layout: 'simple' / 'modern' / 'fullwidth' / 'fullscreen'
|
||||
*
|
||||
* @action Before the template: 'us_before_template:templates/widgets/search'
|
||||
* @action After the template: 'us_after_template:templates/widgets/search'
|
||||
* @filter Template variables: 'us_template_vars:templates/widgets/search'
|
||||
*/
|
||||
|
||||
|
||||
$context = isset( $context ) ? $context : 'simple';
|
||||
$layout = us_get_option( 'header_search_layout', 'fullscreen' );
|
||||
|
||||
if ( $context == 'simple' OR $context == 'widget' ) {
|
||||
$layout = 'simple';
|
||||
}
|
||||
|
||||
$form_template_vars = array(
|
||||
'type' => 'search',
|
||||
'action' => home_url( '/' ),
|
||||
'method' => 'get',
|
||||
'fields' => array(
|
||||
's' => array(
|
||||
'type' => 'text',
|
||||
'name' => 's',
|
||||
'title' => ( $layout == 'fullscreen' ) ? __( 'Just type and press \'enter\'', 'us' ) : '',
|
||||
'placeholder' => us_translate( 'Search' ) . ' ...',
|
||||
),
|
||||
'submit' => array(
|
||||
'type' => 'submit',
|
||||
'title' => us_translate( 'Search' ),
|
||||
),
|
||||
),
|
||||
);
|
||||
if ( $context != 'widget' ) {
|
||||
$form_template_vars['end_html'] = '<div class="w-search-close"></div>';
|
||||
}
|
||||
if ( defined( 'ICL_LANGUAGE_CODE' ) AND ICL_LANGUAGE_CODE != '' ) {
|
||||
$form_template_vars['fields']['lang'] = array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'lang',
|
||||
'value' => ICL_LANGUAGE_CODE,
|
||||
);
|
||||
}
|
||||
|
||||
if ( $context != 'widget' ) {
|
||||
?>
|
||||
<div class="w-search layout_<?php echo $layout ?>">
|
||||
<div class="w-search-open"></div>
|
||||
<div class="w-search-background"></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
us_load_template( 'templates/form/form', $form_template_vars );
|
||||
|
||||
if ( $context != 'widget' ) {
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
Reference in new issue
Block a user