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,122 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Ultimate Addons for WPBakery Page Builder support
|
||||
*
|
||||
* @link http://codecanyon.net/item/ultimate-addons-for-visual-composer/6892199?ref=UpSolution
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'Ultimate_VC_Addons' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
defined( 'ULTIMATE_USE_BUILTIN' ) OR define( 'ULTIMATE_USE_BUILTIN', TRUE );
|
||||
defined( 'ULTIMATE_NO_EDIT_PAGE_NOTICE' ) OR define( 'ULTIMATE_NO_EDIT_PAGE_NOTICE', TRUE );
|
||||
defined( 'ULTIMATE_NO_PLUGIN_PAGE_NOTICE' ) OR define( 'ULTIMATE_NO_PLUGIN_PAGE_NOTICE', TRUE );
|
||||
|
||||
// Removing potentially dangerous functions
|
||||
if ( ! function_exists( 'bsf_grant_developer_access' ) ) {
|
||||
function bsf_grant_developer_access() {
|
||||
}
|
||||
}
|
||||
if ( ! function_exists( 'bsf_allow_developer_access' ) ) {
|
||||
function bsf_allow_developer_access() {
|
||||
}
|
||||
}
|
||||
if ( ! function_exists( 'bsf_process_developer_login' ) ) {
|
||||
function bsf_process_developer_login() {
|
||||
}
|
||||
}
|
||||
if ( ! function_exists( 'bsf_notices' ) ) {
|
||||
function bsf_notices() {
|
||||
}
|
||||
}
|
||||
add_action( 'init', 'us_sanitize_ultimate_addons', 20 );
|
||||
function us_sanitize_ultimate_addons() {
|
||||
remove_action( 'admin_init', 'bsf_update_all_product_version', 1000 );
|
||||
remove_action( 'admin_notices', 'bsf_notices', 1000 );
|
||||
remove_action( 'network_admin_notices', 'bsf_notices', 1000 );
|
||||
remove_action( 'admin_footer', 'bsf_update_counter', 999 );
|
||||
remove_action( 'wp_ajax_bsf_update_client_license', 'bsf_server_update_client_license' );
|
||||
remove_action( 'wp_ajax_nopriv_bsf_update_client_license', 'bsf_server_update_client_license' );
|
||||
}
|
||||
|
||||
// Disabling after-activation redirect to Ultimate Addons Dashboard
|
||||
if ( get_option( 'ultimate_vc_addons_redirect' ) == TRUE ) {
|
||||
update_option( 'ultimate_vc_addons_redirect', FALSE );
|
||||
}
|
||||
|
||||
add_action( 'admin_init', 'us_ultimate_addons_for_vc_integration' );
|
||||
function us_ultimate_addons_for_vc_integration() {
|
||||
if ( get_option( 'ultimate_updater' ) != 'disabled' ) {
|
||||
update_option( 'ultimate_updater', 'disabled' );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'core_upgrade_preamble', 'us_ultimate_addons_core_upgrade_preamble' );
|
||||
function us_ultimate_addons_core_upgrade_preamble() {
|
||||
remove_action( 'core_upgrade_preamble', 'list_bsf_products_updates', 999 );
|
||||
}
|
||||
|
||||
add_filter( 'pre_set_site_transient_update_plugins', 'us_ultimate_addons_update_plugins_transient', 99 );
|
||||
function us_ultimate_addons_update_plugins_transient( $_transient_data ) {
|
||||
if ( isset( $_transient_data->response['Ultimate_VC_Addons/Ultimate_VC_Addons.php'] ) AND empty( $_transient_data->response['Ultimate_VC_Addons/Ultimate_VC_Addons.php']->package ) ) {
|
||||
unset( $_transient_data->response['Ultimate_VC_Addons/Ultimate_VC_Addons.php'] );
|
||||
}
|
||||
|
||||
return $_transient_data;
|
||||
}
|
||||
|
||||
add_filter( 'ultimate_front_scripts_post_content', 'us_ultimate_front_scripts_post_content' );
|
||||
function us_ultimate_front_scripts_post_content( $content ) {
|
||||
$content .= us_get_current_page_block_content();
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'us_ult_addons_404_search_enqueue_scripts', 1 );
|
||||
function us_ult_addons_404_search_enqueue_scripts() {
|
||||
if ( is_404() OR is_search() OR is_home() ) {
|
||||
$content = '';
|
||||
if ( is_404() AND $page_404 = get_post( us_get_option( 'page_404' ) ) ) {
|
||||
$content = $page_404->post_content;
|
||||
}
|
||||
if ( is_search() AND $search_page = get_post( us_get_option( 'search_page' ) ) ) {
|
||||
$content = $search_page->post_content;
|
||||
}
|
||||
if ( is_home() AND $posts_page = get_post( us_get_option( 'posts_page' ) ) ) {
|
||||
$content = $posts_page->post_content;
|
||||
}
|
||||
$content = us_ultimate_front_scripts_post_content( $content );
|
||||
|
||||
if ( us_ult_addons_check_element_on_page( $content ) ) {
|
||||
add_filter( 'option_bsf_options', 'us_ult_addons_force_global_scripts_filter' );
|
||||
add_filter( 'default_option_bsf_options', 'us_ult_addons_force_global_scripts_filter' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function us_ult_addons_force_global_scripts_filter( $bsf_options ) {
|
||||
if ( ! is_array( $bsf_options ) ) {
|
||||
$bsf_options = array();
|
||||
}
|
||||
$bsf_options['ultimate_global_scripts'] = 'enable';
|
||||
|
||||
return $bsf_options;
|
||||
}
|
||||
|
||||
function us_ult_addons_check_element_on_page( $post_content ) {
|
||||
// check for background
|
||||
$found_ultimate_backgrounds = FALSE;
|
||||
if ( stripos( $post_content, 'bg_type=' ) ) {
|
||||
preg_match( '/bg_type="(.*?)"/', $post_content, $output );
|
||||
if ( $output[1] === 'bg_color' || $output[1] === 'grad' || $output[1] === 'image' || $output[1] === 'u_iframe' || $output[1] === 'video' ) {
|
||||
$found_ultimate_backgrounds = TRUE;
|
||||
}
|
||||
}
|
||||
if ( stripos( $post_content, '[ultimate_spacer' ) || stripos( $post_content, '[ult_buttons' ) || stripos( $post_content, '[ultimate_icon_list' ) || stripos( $post_content, '[just_icon' ) || stripos( $post_content, '[ult_animation_block' ) || stripos( $post_content, '[icon_counter' ) || stripos( $post_content, '[ultimate_google_map' ) || stripos( $post_content, '[icon_timeline' ) || stripos( $post_content, '[bsf-info-box' ) || stripos( $post_content, '[info_list' ) || stripos( $post_content, '[ultimate_info_table' ) || stripos( $post_content, '[interactive_banner_2' ) || stripos( $post_content, '[interactive_banner' ) || stripos( $post_content, '[ultimate_pricing' ) || stripos( $post_content, '[ultimate_icons' ) || stripos( $post_content, '[ultimate_heading' ) || stripos( $post_content, '[ultimate_carousel' ) || stripos( $post_content, '[ult_countdown' ) || stripos( $post_content, '[ultimate_info_banner' ) || stripos( $post_content, '[swatch_container' ) || stripos( $post_content, '[ult_ihover' ) || stripos( $post_content, '[ult_hotspot' ) || stripos( $post_content, '[ult_content_box' ) || stripos( $post_content, '[ultimate_ctation' ) || stripos( $post_content, '[stat_counter' ) || stripos( $post_content, '[ultimate_video_banner' ) || stripos( $post_content, '[ult_dualbutton' ) || stripos( $post_content, '[ult_createlink' ) || stripos( $post_content, '[ultimate_img_separator' ) || stripos( $post_content, '[ult_tab_element' ) || stripos( $post_content, '[ultimate_exp_section' ) || stripos( $post_content, '[info_circle' ) || stripos( $post_content, '[ultimate_modal' ) || stripos( $post_content, '[ult_sticky_section' ) || stripos( $post_content, '[ult_team' ) || stripos( $post_content, '[ultimate_fancytext' ) || stripos( $post_content, '[ult_range_slider' ) || $found_ultimate_backgrounds ) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* bbPress Support
|
||||
*
|
||||
* @link https://bbpress.org/
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'bbPress' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'us_bbpress_enqueue_styles', 14 );
|
||||
function us_bbpress_enqueue_styles( $styles ) {
|
||||
global $us_template_directory_uri;
|
||||
wp_dequeue_style( 'bbp-default' );
|
||||
|
||||
$min_ext = ( ! ( defined( 'US_DEV' ) AND US_DEV ) ) ? '.min' : '';
|
||||
if ( ! ( defined( 'US_DEV' ) AND US_DEV ) AND us_get_option( 'optimize_assets', 0 ) == 0 ) {
|
||||
wp_enqueue_style( 'us-bbpress', $us_template_directory_uri . '/css/plugins/bbpress' . $min_ext . '.css', array(), US_THEMEVERSION, 'all' );
|
||||
}
|
||||
}
|
||||
|
||||
// Remove Forum summaries
|
||||
add_filter( 'bbp_get_single_forum_description', '__return_false', 10, 2 );
|
||||
add_filter( 'bbp_get_single_topic_description', '__return_false', 10, 2 );
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Gravity Forms Support
|
||||
*
|
||||
* @link http://www.gravityforms.com/
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'GFForms' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! ( defined( 'US_DEV' ) AND US_DEV ) AND us_get_option( 'optimize_assets', 0 ) == 0 ) {
|
||||
add_action( 'wp_enqueue_scripts', 'us_gravityforms_enqueue_styles', 14 );
|
||||
}
|
||||
function us_gravityforms_enqueue_styles( $styles ) {
|
||||
global $us_template_directory_uri;
|
||||
$min_ext = ( ! ( defined( 'US_DEV' ) AND US_DEV ) ) ? '.min' : '';
|
||||
wp_enqueue_style( 'us-gravityforms', $us_template_directory_uri . '/css/plugins/gravityforms' . $min_ext . '.css', array(), US_THEMEVERSION, 'all' );
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
|
||||
.compose-mode .vc_controls,
|
||||
.compose-mode .vc_ui-font-open-sans {
|
||||
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif !important;
|
||||
}
|
||||
.compose-mode .vc_empty-placeholder {
|
||||
margin: 0 !important;
|
||||
}
|
||||
.compose-mode .vc_add-element-not-empty-button {
|
||||
vertical-align: top;
|
||||
}
|
||||
.compose-mode .vc_vc_row > [data-vc-full-width="true"],
|
||||
.compose-mode .vc_vc_row_inner {
|
||||
padding-top: 0;
|
||||
}
|
||||
.compose-mode .vc_vc_row_inner:first-child {
|
||||
padding-top: 32px;
|
||||
}
|
||||
.compose-mode .vc_control-btn-append:before {
|
||||
top: 3px; /* fixed value */
|
||||
}
|
||||
.compose-mode .vc_row {
|
||||
clear: both;
|
||||
}
|
||||
.compose-mode .vc_element:before {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: auto !important;
|
||||
width: auto !important;
|
||||
border: 1px solid transparent;
|
||||
outline: 1px dashed transparent !important;
|
||||
outline-offset: -1px;
|
||||
}
|
||||
.compose-mode .vc_element:hover:before {
|
||||
content: '';
|
||||
border-color: #fff !important;
|
||||
outline-color: #95ca24 !important;
|
||||
}
|
||||
.compose-mode .vc_element.vc_vc_column:hover:before,
|
||||
.compose-mode .vc_element.vc_vc_column_inner:hover:before {
|
||||
content: '';
|
||||
border-color: #fff !important;
|
||||
outline-color: #f3af1c !important;
|
||||
}
|
||||
.compose-mode .vc_element.vc_vc_row:before,
|
||||
.compose-mode .vc_element.vc_vc_row_inner:before {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.compose-mode div:not(.vc_empty-placeholder) + .vc_vc_row > .l-section {
|
||||
padding-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
.compose-mode div:not(.vc_empty-placeholder) + .vc_vc_row > .l-section .l-section-h {
|
||||
top: auto !important;
|
||||
}
|
||||
.compose-mode .vc_column_container {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.vc_empty-placeholder + .vc_vc_row > .l-section.height_auto:before {
|
||||
display: block;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.g-cols.valign_middle > div > div > .vc_column-inner {
|
||||
justify-content: center;
|
||||
}
|
||||
.g-cols.valign_bottom > div > div > .vc_column-inner {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.g-cols.type_default > div > div > .vc_column-inner {
|
||||
padding-left: 1.5rem;
|
||||
padding-right: 1.5rem;
|
||||
}
|
||||
.g-cols.type_default > div > div.has-fill > .vc_column-inner {
|
||||
padding-top: 1.5rem;
|
||||
padding-bottom: 1.5rem;
|
||||
}
|
||||
.g-cols.type_boxes > div > div > .vc_column-inner {
|
||||
background-position: center center !important;
|
||||
background-size: cover !important;
|
||||
padding: 4rem;
|
||||
}
|
||||
|
||||
.vc_element > .w-image {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.wpb_column.align_center .vc_element.vc_us_btn {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
! function( $ ) {
|
||||
var USDOSetValue = function( $container ) {
|
||||
var $value = $container.find( '.us-design-options-value' ),
|
||||
value = '',
|
||||
$inputs = $container.find( '.us-design-options-input' ),
|
||||
withPosition = false;
|
||||
$inputs.each( function( index, input ) {
|
||||
var $input = $( input ),
|
||||
name = $input.attr( 'name' ).replace( '_', '-' ),
|
||||
trimmedValue = $input.val().trim();
|
||||
// If parameter is empty, do not add it to the value
|
||||
if ( trimmedValue == '' ) {
|
||||
return;
|
||||
}
|
||||
if ( name.substr( 0, 8 ) == 'position' ) {
|
||||
name = name.replace( 'position-', '' );
|
||||
withPosition = true;
|
||||
}
|
||||
// If a plain number is entered, add 'px' to it's end
|
||||
if ( trimmedValue.match( /^\d+$/ ) && trimmedValue != 0 ) {
|
||||
trimmedValue += 'px';
|
||||
}
|
||||
value += ' ' + name + ': ' + trimmedValue + ';';
|
||||
}.bind( this ) );
|
||||
|
||||
if ( withPosition ) {
|
||||
value = 'position: absolute;' + value;
|
||||
}
|
||||
|
||||
$value.val( value.trim() );
|
||||
};
|
||||
|
||||
$( '#usdo_pos_abs' ).change( function() {
|
||||
var $this = $( this ),
|
||||
$posWrapper = $( '.usof-design-position' ),
|
||||
$container = $this.closest( '.usof-design' );
|
||||
$posWrapper.toggleClass( 'pos_off', ! $this.is( ':checked' ) );
|
||||
if ( ! $this.is( ':checked' ) ) {
|
||||
// Clearing all values
|
||||
$container.find( '.us-design-options-input.for-position' ).val( '' );
|
||||
}
|
||||
USDOSetValue( $container );
|
||||
} );
|
||||
|
||||
$( '.us-design-options-input' ).off( 'blur' ).live( 'blur', function( e ) {
|
||||
var $target = $( e.target ),
|
||||
trimmedValue = $target.val().trim(),
|
||||
$container = $target.closest( '.usof-design' );
|
||||
if ( trimmedValue != '' ) {
|
||||
$target.val( trimmedValue );
|
||||
USDOSetValue( $container );
|
||||
}
|
||||
} );
|
||||
}( window.jQuery );
|
||||
@@ -0,0 +1,19 @@
|
||||
! function( $ ) {
|
||||
$( '.us-grid-layout-select' ).off( 'change' ).live( 'change', function() {
|
||||
var $select = $( this ),
|
||||
$container = $select.closest( '.us-grid-layout' ),
|
||||
$descEdit = $container.find( '.us-grid-layout-desc-edit' ),
|
||||
$descAdd = $container.find( '.us-grid-layout-desc-add' ),
|
||||
$selectedOption = $select.find( ":selected" ),
|
||||
$editLink = $descEdit.find( '.edit-link' );
|
||||
if ( $selectedOption.length && $selectedOption.data( 'edit-url' ) != undefined ) {
|
||||
$editLink.attr( 'href', $selectedOption.data( 'edit-url' ) );
|
||||
$descEdit.show();
|
||||
$descAdd.hide();
|
||||
} else {
|
||||
$descAdd.show();
|
||||
$descEdit.hide();
|
||||
}
|
||||
|
||||
} ).change();
|
||||
}( window.jQuery );
|
||||
@@ -0,0 +1,50 @@
|
||||
! function( $ ) {
|
||||
var USIconSetValue = function( $container ) {
|
||||
var $select = $container.find( '.us-icon-select' ),
|
||||
$input = $container.find( '.us-icon-text' ),
|
||||
$value = $container.find( '.us-icon-value' ),
|
||||
$preview = $container.find( '.us-icon-preview > i' ),
|
||||
icon_set = $select.val(),
|
||||
icon_name = $.trim( $input.val() ),
|
||||
icon_no_resize = icon_name.replace( /fa-\dx/gi, ' ' ),
|
||||
icon_val = '';
|
||||
|
||||
if ( icon_name != '' ) {
|
||||
if ( icon_set == 'material' ) {
|
||||
icon_name = icon_name.replace( / +/g, '_' );
|
||||
$preview.attr( 'class', 'material-icons' ).html( icon_name );
|
||||
} else {
|
||||
$preview.attr( 'class', icon_set + ' fa-' + icon_no_resize ).html( '' );
|
||||
}
|
||||
icon_val = icon_set + '|' + icon_name;
|
||||
} else {
|
||||
// Case when removing all text in input at a time, "Crtl + A + Del", for instance
|
||||
$preview.attr( 'class', '' ).html( '' );
|
||||
}
|
||||
|
||||
$value.val( icon_val );
|
||||
|
||||
};
|
||||
$( '.us-icon-select' ).off( 'change' ).live( 'change', function() {
|
||||
var $select = $( this ),
|
||||
$container = $select.closest( '.us-icon' ),
|
||||
$descContainer = $container.siblings( '.us-icon-desc' ).first(),
|
||||
$selectedOption = $select.find( ":selected" ),
|
||||
$setLink = $descContainer.find( '.us-icon-set-link' );
|
||||
if ( $selectedOption.length ) {
|
||||
$setLink.attr( 'href', $selectedOption.data( 'info-url' ) );
|
||||
}
|
||||
|
||||
USIconSetValue( $container );
|
||||
} );
|
||||
$( '.us-icon-text' ).off( 'change keyup' ).live( 'change keyup', function() {
|
||||
var $input = $( this ),
|
||||
$container = $input.closest( '.us-icon' ),
|
||||
val = $input.val();
|
||||
if ( val.toLowerCase().replace( /^\s+/g, '' ) !== val ) {
|
||||
$input.val( $.trim( val.toLowerCase() ) );
|
||||
}
|
||||
|
||||
USIconSetValue( $container );
|
||||
} );
|
||||
}( window.jQuery );
|
||||
@@ -0,0 +1,96 @@
|
||||
! function( $ ) {
|
||||
window.ViewUsIcon = vc.shortcode_view.extend( {
|
||||
// Render method called after element is added( cloned ), and on first initialisation
|
||||
render: function() {
|
||||
window.ViewUsIcon.__super__.render.call( this );
|
||||
this.addedClasses = '';
|
||||
return this;
|
||||
},
|
||||
// Add either FontAwesome of Material icons
|
||||
changeIcons: function() {
|
||||
var $icon = this.$el.find( '.vc_element-icon' ),
|
||||
$button = this.$el.find( 'button' ),
|
||||
$addedIcon = '',
|
||||
shortcode = this.currentShortcode,
|
||||
iconPos = this.model.attributes.params.iconpos,
|
||||
matchesFa,
|
||||
matchesMa;
|
||||
|
||||
// Catch icon names
|
||||
matchesFa = this.model.attributes.params.icon.match( /^(fa\w?)\|(.+)$/ );
|
||||
matchesMa = this.model.attributes.params.icon.match( /^(material)\|(.+)$/ );
|
||||
|
||||
// Do only for found elements
|
||||
if ( $icon.length || $button.length ) {
|
||||
if ( matchesFa || matchesMa ) {
|
||||
if ( this.addedClasses.length ) {
|
||||
$icon.removeClass( this.addedClasses ).html( '' );
|
||||
}
|
||||
if ( matchesFa ) {
|
||||
if ( shortcode == 'us_iconbox' ) {
|
||||
this.addedClasses = matchesFa[ 1 ] + ' fa-' + matchesFa[ 2 ];
|
||||
$icon.addClass( this.addedClasses );
|
||||
} else if ( shortcode == 'us_btn' ) {
|
||||
$addedIcon = '<i class="' + matchesFa[ 1 ] + ' fa-' + matchesFa[ 2 ] + '"></i>';
|
||||
if ( iconPos == 'left' ) {
|
||||
$( $addedIcon ).prependTo( $button );
|
||||
} else {
|
||||
// Remove new line from the title to append icon properly
|
||||
$button.html( $button.html().trim() );
|
||||
$( $addedIcon ).appendTo( $button );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( shortcode == 'us_iconbox' ) {
|
||||
this.addedClasses = 'material-icons';
|
||||
$icon.addClass( this.addedClasses ).html( matchesMa[ 2 ] );
|
||||
} else if ( shortcode == 'us_btn' ) {
|
||||
$addedIcon = '<i class="material-icons">' + matchesMa[ 2 ] + '</i>';
|
||||
if ( iconPos == 'left' ) {
|
||||
$( $addedIcon ).prependTo( $button );
|
||||
} else {
|
||||
// Remove new line from the title to append icon properly
|
||||
$button.html( $button.html().trim() );
|
||||
$( $addedIcon ).appendTo( $button );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// Add default title if empty
|
||||
checkButtonTitle: function() {
|
||||
this.currentShortcode = this.model.attributes.shortcode;
|
||||
if ( this.currentShortcode != 'us_btn' ) {
|
||||
return;
|
||||
}
|
||||
if ( this.currentShortcode == 'us_btn' ) {
|
||||
if ( ! this.model.attributes.params.label.length && ! this.model.attributes.params.icon.length ) {
|
||||
$( this.$el.find( 'button' ) ).html( '<p>' + this.params.label.std + '</p>' );
|
||||
}
|
||||
}
|
||||
},
|
||||
ready: function( e ) {
|
||||
window.ViewUsIcon.__super__.ready.call( this, e );
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
// Called every time when params is changed/appended. Also on first initialisation
|
||||
changeShortcodeParams: function( model ) {
|
||||
window.ViewUsIcon.__super__.changeShortcodeParams.call( this, model );
|
||||
this.checkButtonTitle();
|
||||
this.changeIcons();
|
||||
},
|
||||
deleteShortcode: function( e ) {
|
||||
this.addedClasses = '';
|
||||
window.ViewUsIcon.__super__.deleteShortcode.call( this, e );
|
||||
},
|
||||
editElement: function( e ) {
|
||||
window.ViewUsIcon.__super__.editElement.call( this, e );
|
||||
},
|
||||
clone: function( e ) {
|
||||
window.ViewUsIcon.__super__.clone.call( this, e );
|
||||
}
|
||||
} );
|
||||
}( window.jQuery );
|
||||
@@ -0,0 +1,12 @@
|
||||
! function( $ ) {
|
||||
$( '.usof-example' ).live( 'click', function( ev ) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
|
||||
var $target = $( ev.target ).closest( 'span' ),
|
||||
$input = $target.closest( '.edit_form_line' ).find( 'input[type="text"]' ),
|
||||
value = $target.html();
|
||||
|
||||
$input.val( value ).trigger( 'change' );
|
||||
} );
|
||||
}( window.jQuery );
|
||||
@@ -0,0 +1,998 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* WPBakery Page Builder support
|
||||
*
|
||||
* @link http://codecanyon.net/item/visual-composer-page-builder-for-wordpress/242431?ref=UpSolution
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'Vc_Manager' ) ) {
|
||||
|
||||
/**
|
||||
* @param $width
|
||||
*
|
||||
* @since 4.2
|
||||
* @return bool|string
|
||||
*/
|
||||
function us_wpb_translateColumnWidthToSpan( $width ) {
|
||||
preg_match( '/(\d+)\/(\d+)/', $width, $matches );
|
||||
if ( ! empty( $matches ) ) {
|
||||
$part_x = (int) $matches[1];
|
||||
$part_y = (int) $matches[2];
|
||||
if ( $part_x > 0 AND $part_y > 0 ) {
|
||||
$value = ceil( $part_x / $part_y * 12 );
|
||||
if ( $value > 0 AND $value <= 12 ) {
|
||||
$width = 'vc_col-sm-' . $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $column_offset
|
||||
* @param $width
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
function us_vc_column_offset_class_merge( $column_offset, $width ) {
|
||||
if ( preg_match( '/vc_col\-sm\-\d+/', $column_offset ) ) {
|
||||
return $column_offset;
|
||||
}
|
||||
|
||||
return $width . ( empty( $column_offset ) ? '' : ' ' . $column_offset );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $subject
|
||||
* @param $property
|
||||
* @param bool|false $strict
|
||||
*
|
||||
* @since 4.9
|
||||
* @return bool
|
||||
*/
|
||||
function us_vc_shortcode_custom_css_has_property( $subject, $property, $strict = FALSE ) {
|
||||
$styles = array();
|
||||
$pattern = '/\{([^\}]*?)\}/i';
|
||||
preg_match( $pattern, $subject, $styles );
|
||||
if ( array_key_exists( 1, $styles ) ) {
|
||||
$styles = explode( ';', $styles[1] );
|
||||
}
|
||||
$new_styles = array();
|
||||
foreach ( $styles as $val ) {
|
||||
$val = explode( ':', $val );
|
||||
if ( is_array( $property ) ) {
|
||||
foreach ( $property as $prop ) {
|
||||
$pos = strpos( $val[0], $prop );
|
||||
$full = ( $strict ) ? ( $pos === 0 AND strlen( $val[0] ) === strlen( $prop ) ) : TRUE;
|
||||
if ( $pos !== FALSE AND $full ) {
|
||||
$new_styles[] = $val;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$pos = strpos( $val[0], $property );
|
||||
$full = ( $strict ) ? ( $pos === 0 AND strlen( $val[0] ) === strlen( $property ) ) : TRUE;
|
||||
if ( $pos !== FALSE AND $full ) {
|
||||
$new_styles[] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ! empty( $new_styles );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'vc_before_init', 'us_vc_set_as_theme' );
|
||||
function us_vc_set_as_theme() {
|
||||
vc_set_as_theme();
|
||||
}
|
||||
|
||||
add_action( 'vc_after_init', 'us_vc_after_init' );
|
||||
function us_vc_after_init() {
|
||||
$updater = vc_manager()->updater();
|
||||
$updateManager = $updater->updateManager();
|
||||
|
||||
remove_filter( 'upgrader_pre_download', array( $updater, 'preUpgradeFilter' ) );
|
||||
remove_filter( 'pre_set_site_transient_update_plugins', array( $updateManager, 'check_update' ) );
|
||||
remove_filter( 'plugins_api', array( $updateManager, 'check_info' ) );
|
||||
remove_action( 'in_plugin_update_message-' . vc_plugin_name(), array( $updateManager, 'addUpgradeMessageLink' ) );
|
||||
}
|
||||
|
||||
add_action( 'vc_after_set_mode', 'us_vc_after_set_mode' );
|
||||
function us_vc_after_set_mode() {
|
||||
|
||||
do_action( 'us_before_js_composer_mappings' );
|
||||
|
||||
// Remove VC Font Awesome style in admin pages
|
||||
add_action( 'admin_head', 'us_remove_js_composer_admin_assets', 1 );
|
||||
function us_remove_js_composer_admin_assets() {
|
||||
wp_dequeue_style( 'font-awesome' );
|
||||
wp_deregister_style( 'font-awesome' );
|
||||
if ( us_get_option( 'disable_extra_vc', 1 ) ) {
|
||||
wp_dequeue_style( 'animate-css' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! vc_is_page_editable() ) {
|
||||
|
||||
// Remove original VC styles and scripts
|
||||
add_action( 'wp_enqueue_scripts', 'us_remove_vc_base_css_js', 15 );
|
||||
function us_remove_vc_base_css_js() {
|
||||
if ( wp_style_is( 'font-awesome', 'registered' ) ) {
|
||||
wp_dequeue_style( 'font-awesome' );
|
||||
wp_deregister_style( 'font-awesome' );
|
||||
}
|
||||
if ( us_get_option( 'disable_extra_vc', 1 ) ) {
|
||||
if ( wp_style_is( 'js_composer_front', 'registered' ) ) {
|
||||
wp_dequeue_style( 'js_composer_front' );
|
||||
wp_deregister_style( 'js_composer_front' );
|
||||
}
|
||||
if ( wp_script_is( 'wpb_composer_front_js', 'registered' ) ) {
|
||||
wp_deregister_script( 'wpb_composer_front_js' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( vc_is_page_editable() ) {
|
||||
|
||||
// Disable some of the shortcodes for frontend editor
|
||||
US_Shortcodes::instance()->vc_front_end_compatibility();
|
||||
|
||||
// Add theme CSS for frontend editor
|
||||
add_action( 'wp_enqueue_scripts', 'us_process_css_for_frontend_js_composer', 15 );
|
||||
function us_process_css_for_frontend_js_composer() {
|
||||
global $us_template_directory_uri;
|
||||
wp_enqueue_style( 'us_js_composer_front', $us_template_directory_uri . '/framework/plugins-support/js_composer/css/us_frontend_editor.css' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_admin() AND us_get_option( 'disable_extra_vc', 1 ) ) {
|
||||
// Removing grid elements
|
||||
add_action( 'admin_menu', 'us_remove_vc_grid_elements_submenu' );
|
||||
function us_remove_vc_grid_elements_submenu() {
|
||||
remove_submenu_page( VC_PAGE_MAIN_SLUG, 'edit.php?post_type=vc_grid_item' );
|
||||
}
|
||||
}
|
||||
|
||||
// Disable Frontend Editor for Page Blocks
|
||||
add_action( 'current_screen', 'us_disable_frontend_for_page_blocks' );
|
||||
|
||||
// Disable Icon Picker assets
|
||||
if ( us_get_option( 'disable_extra_vc', 1 ) ) {
|
||||
remove_action( 'vc_backend_editor_enqueue_js_css', 'vc_iconpicker_editor_jscss' );
|
||||
remove_action( 'vc_frontend_editor_enqueue_js_css', 'vc_iconpicker_editor_jscss' );
|
||||
}
|
||||
|
||||
do_action( 'us_after_js_composer_mappings' );
|
||||
}
|
||||
|
||||
add_action( 'init', 'us_vc_init_shortcodes', 11 );
|
||||
function us_vc_init_shortcodes() {
|
||||
if ( ! function_exists( 'vc_mode' ) OR ! function_exists( 'vc_map' ) OR ! function_exists( 'vc_remove_element' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$shortcodes_config = us_config( 'shortcodes', array(), TRUE );
|
||||
|
||||
// Mapping WPBakery Page Builder backend behaviour for used shortcodes
|
||||
if ( vc_mode() != 'page' ) {
|
||||
|
||||
function us_vc_param( $param_name, $param ) {
|
||||
$related_types = array(
|
||||
'text' => 'textfield',
|
||||
'slider' => 'textfield',
|
||||
'textarea' => 'textarea',
|
||||
'select' => 'dropdown',
|
||||
'radio' => 'dropdown',
|
||||
'color' => 'colorpicker',
|
||||
'link' => 'vc_link',
|
||||
'icon' => 'us_icon',
|
||||
'switch' => 'checkbox',
|
||||
'checkboxes' => 'checkbox',
|
||||
'upload' => 'attach_image',
|
||||
'editor' => 'textarea_html',
|
||||
'html' => 'textarea_raw_html',
|
||||
'group' => 'param_group',
|
||||
'wrapper_start' => 'param_to_delete',
|
||||
'wrapper_end' => 'param_to_delete',
|
||||
'heading' => 'param_to_delete',
|
||||
'ult_param_heading' => 'ult_param_heading',
|
||||
'autocomplete' => 'autocomplete',
|
||||
'us_grid_layout' => 'us_grid_layout',
|
||||
'css_editor' => 'css_editor',
|
||||
'design_options' => 'us_design_options',
|
||||
);
|
||||
|
||||
$type = ( isset( $param['type'] ) AND isset( $related_types[ $param['type'] ] ) ) ? $related_types[ $param['type'] ] : 'textfield';
|
||||
|
||||
if ( $type == 'param_to_delete' ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$attributes_with_prefixes = array(
|
||||
'title',
|
||||
'description',
|
||||
'options',
|
||||
'classes',
|
||||
'cols',
|
||||
'std',
|
||||
'show_if',
|
||||
);
|
||||
foreach ( $attributes_with_prefixes as $attribute ) {
|
||||
if ( isset( $param[ 'shortcode_' . $attribute ] ) ) {
|
||||
$param[ $attribute ] = $param[ 'shortcode_' . $attribute ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( $param['type'] == 'checkboxes' AND ! empty( $param['std'] ) AND is_array( $param['std'] ) ) {
|
||||
$param['std'] = implode( ',', $param['std'] );
|
||||
}
|
||||
|
||||
$vc_param = array(
|
||||
'type' => $type,
|
||||
'param_name' => $param_name,
|
||||
'heading' => isset( $param['title'] ) ? $param['title'] : '',
|
||||
'description' => isset( $param['description'] ) ? $param['description'] : '',
|
||||
'std' => isset( $param['std'] ) ? $param['std'] : '',
|
||||
'holder' => isset( $param['holder'] ) ? $param['holder'] : '',
|
||||
'admin_label' => isset( $param['admin_label'] ) ? $param['admin_label'] : FALSE,
|
||||
'settings' => isset( $param['settings'] ) ? $param['settings'] : NULL,
|
||||
);
|
||||
|
||||
// Add option CSS classes based on "cols" param
|
||||
if ( isset( $param['cols'] ) ) {
|
||||
if ( $param['cols'] == 2 ) {
|
||||
$vc_param['edit_field_class'] = 'vc_col-sm-6';
|
||||
} elseif ( $param['cols'] == 3 ) {
|
||||
$vc_param['edit_field_class'] = 'vc_col-sm-4';
|
||||
}
|
||||
} elseif ( isset( $param['classes'] ) AND ! empty( $param['classes'] ) ) {
|
||||
$vc_param['edit_field_class'] = $param['classes'];
|
||||
}
|
||||
|
||||
if ( isset( $param['group'] ) AND ! empty( $param['group'] ) ) {
|
||||
$vc_param['group'] = $param['group'];
|
||||
}
|
||||
|
||||
if ( $vc_param['type'] == 'attach_image' AND isset( $param['is_multiple'] ) AND $param['is_multiple'] ) {
|
||||
$vc_param['type'] = 'attach_images';
|
||||
}
|
||||
|
||||
if ( $vc_param['type'] == 'dropdown' AND isset( $param['options'] ) ) {
|
||||
$vc_param['value'] = array();
|
||||
foreach ( $param['options'] as $option_val => $option_name ) {
|
||||
$vc_param['value'][ $option_name . ' ' ] = $option_val;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $vc_param['type'] == 'checkbox' ) {
|
||||
if ( isset( $param['options'] ) ) {
|
||||
$vc_param['value'] = array_flip( $param['options'] );
|
||||
} elseif ( isset( $param['switch_text'] ) ) {
|
||||
$vc_param['value'] = array( $param['switch_text'] => TRUE );
|
||||
}
|
||||
if ( is_array( $vc_param['std'] ) ) {
|
||||
$vc_param['std'] = implode( ',', $vc_param['std'] );
|
||||
} elseif ( $vc_param['std'] === TRUE ) {
|
||||
$vc_param['std'] = '1';
|
||||
} elseif ( $vc_param['std'] === FALSE ) {
|
||||
$vc_param['std'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Proper dependency rules
|
||||
if ( isset( $param['show_if'] ) AND count( $param['show_if'] ) == 3 ) {
|
||||
$vc_param['dependency'] = array(
|
||||
'element' => $param['show_if'][0],
|
||||
);
|
||||
if ( $param['show_if'][1] == '=' AND $param['show_if'][2] == '' ) {
|
||||
$vc_param['dependency']['is_empty'] = TRUE;
|
||||
} elseif ( $param['show_if'][1] == '!=' AND $param['show_if'][2] == '' ) {
|
||||
$vc_param['dependency']['not_empty'] = TRUE;
|
||||
} elseif ( $param['show_if'][1] == '!=' AND ! empty( $param['show_if'][2] ) ) {
|
||||
$vc_param['dependency']['value_not_equal_to'] = $param['show_if'][2];
|
||||
} else {
|
||||
$vc_param['dependency']['value'] = $param['show_if'][2];
|
||||
}
|
||||
}
|
||||
|
||||
// Proper group rules
|
||||
if ( $vc_param['type'] == 'param_group' ) {
|
||||
if ( isset( $param['params'] ) AND is_array( $param['params'] ) ) {
|
||||
$group_params = $param['params'];
|
||||
$param['params'] = array();
|
||||
foreach ( $group_params as $group_param_name => $group_param ) {
|
||||
$group_vc_param = us_vc_param( $group_param_name, $group_param );
|
||||
if ( $group_vc_param != NULL ) {
|
||||
$vc_param['params'][] = $group_vc_param;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $vc_param;
|
||||
}
|
||||
|
||||
// Adding theme elements maps
|
||||
foreach ( $shortcodes_config['theme_elements'] as $elm_name ) {
|
||||
$shortcode = 'us_' . $elm_name;
|
||||
$elm = us_config( 'elements/' . $elm_name );
|
||||
|
||||
$vc_elm = array(
|
||||
'name' => isset( $elm['title'] ) ? $elm['title'] : $shortcode,
|
||||
'base' => $shortcode,
|
||||
'description' => isset( $elm['description'] ) ? $elm['description'] : '',
|
||||
'class' => 'elm-' . $shortcode,
|
||||
'category' => isset( $elm['category'] ) ? $elm['category'] : us_translate( 'Content', 'js_composer' ),
|
||||
'icon' => isset( $elm['icon'] ) ? $elm['icon'] : '',
|
||||
'weight' => 370, // all elements go after "Text Block" element
|
||||
'admin_enqueue_js' => isset( $elm['admin_enqueue_js'] ) ? $elm['admin_enqueue_js'] : NULL,
|
||||
'js_view' => isset( $elm['js_view'] ) ? $elm['js_view'] : NULL,
|
||||
'as_parent' => isset( $elm['as_parent'] ) ? $elm['as_parent'] : NULL,
|
||||
'show_settings_on_create' => isset( $elm['show_settings_on_create'] ) ? $elm['show_settings_on_create'] : NULL,
|
||||
'params' => array(),
|
||||
);
|
||||
|
||||
if ( isset( $elm['params'] ) AND is_array( $elm['params'] ) ) {
|
||||
foreach ( $elm['params'] as $param_name => &$param ) {
|
||||
if ( isset( $param['context'] ) AND is_array( $param['context'] ) AND ! in_array( 'shortcode', $param['context'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$vc_param = us_vc_param( $param_name, $param );
|
||||
if ( $vc_param != NULL ) {
|
||||
$vc_elm['params'][] = $vc_param;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vc_map( $vc_elm );
|
||||
|
||||
}
|
||||
|
||||
// Include custom map files based on shortcodes name. Only for vc_ shortcodes
|
||||
global $us_template_directory;
|
||||
|
||||
foreach ( $shortcodes_config['modified'] as $shortcode => $config ) {
|
||||
if ( file_exists( $us_template_directory . '/plugins-support/js_composer/map/' . $shortcode . '.php' ) ) {
|
||||
require $us_template_directory . '/plugins-support/js_composer/map/' . $shortcode . '.php';
|
||||
} elseif ( file_exists( $us_template_directory . '/framework/plugins-support/js_composer/map/' . $shortcode . '.php' ) ) {
|
||||
require $us_template_directory . '/framework/plugins-support/js_composer/map/' . $shortcode . '.php';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( us_get_option( 'disable_extra_vc', 1 ) ) {
|
||||
|
||||
// Removing the elements that are not supported at the moment by the theme
|
||||
if ( is_admin() ) {
|
||||
foreach ( $shortcodes_config['disabled'] as $shortcode ) {
|
||||
vc_remove_element( $shortcode );
|
||||
}
|
||||
} else {
|
||||
add_action( 'template_redirect', 'us_vc_disable_extra_sc', 100 );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'current_screen', 'us_disable_post_type_specific_elements' );
|
||||
function us_disable_post_type_specific_elements() {
|
||||
if ( function_exists( 'get_current_screen' ) ) {
|
||||
$screen = get_current_screen();
|
||||
$shortcodes_config = us_config( 'shortcodes', array(), TRUE );
|
||||
|
||||
foreach ( $shortcodes_config['theme_elements'] as $elm_name ) {
|
||||
$shortcode = 'us_' . $elm_name;
|
||||
$elm = us_config( 'elements/' . $elm_name );
|
||||
|
||||
if ( isset( $elm['shortcode_post_type'] ) ) {
|
||||
if ( ! in_array( $screen->post_type, $elm['shortcode_post_type'] ) ) {
|
||||
vc_remove_element( $shortcode );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function us_disable_frontend_for_page_blocks() {
|
||||
if ( function_exists( 'get_current_screen' ) ) {
|
||||
$screen = get_current_screen();
|
||||
if ( $screen->post_type == 'us_page_block' ) {
|
||||
vc_disable_frontend();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function us_vc_disable_extra_sc() {
|
||||
$disabled_shortcodes = us_config( 'shortcodes.disabled', array() );
|
||||
|
||||
foreach ( $disabled_shortcodes as $shortcode ) {
|
||||
remove_shortcode( $shortcode );
|
||||
}
|
||||
}
|
||||
|
||||
// Disable redirect to VC welcome page
|
||||
remove_action( 'init', 'vc_page_welcome_redirect' );
|
||||
|
||||
add_action( 'after_setup_theme', 'us_vc_init_vendor_woocommerce', 99 );
|
||||
function us_vc_init_vendor_woocommerce() {
|
||||
remove_action( 'wp_enqueue_scripts', 'vc_woocommerce_add_to_cart_script' );
|
||||
}
|
||||
|
||||
// Add autocomplete for us_grid
|
||||
add_action( 'vc_after_mapping', 'us_grid_map_shortcodes' );
|
||||
function us_grid_map_shortcodes() {
|
||||
add_filter( 'vc_autocomplete_us_carousel_ids_callback', 'us_grid_ids_autocomplete_suggester', 10, 1 );
|
||||
add_filter( 'vc_autocomplete_us_grid_ids_callback', 'us_grid_ids_autocomplete_suggester', 10, 1 );
|
||||
function us_grid_ids_autocomplete_suggester( $query ) {
|
||||
global $wpdb;
|
||||
$item_id = (int) $query;
|
||||
|
||||
// Fetching the available post types to choose from
|
||||
$available_posts_types = us_grid_available_post_types();
|
||||
if ( count( $available_posts_types ) > 0 ) {
|
||||
$available_posts_types = array_keys( $available_posts_types );
|
||||
$where_post_type = " a.post_type IN ('" . implode( "','", $available_posts_types ) . "') AND ";
|
||||
} else {
|
||||
$where_post_type = "";
|
||||
}
|
||||
|
||||
$post_meta_infos = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"SELECT a.ID AS id, a.post_title AS title, a.post_type AS post_type
|
||||
FROM {$wpdb->posts} AS a
|
||||
WHERE post_status = 'publish' AND {$where_post_type} ( a.ID = '%d' OR a.post_title LIKE '%%%s%%' )", $item_id > 0 ? $item_id : - 1, stripslashes( $query )
|
||||
), ARRAY_A
|
||||
);
|
||||
|
||||
$results = array();
|
||||
if ( is_array( $post_meta_infos ) AND ! empty( $post_meta_infos ) ) {
|
||||
foreach ( $post_meta_infos as $value ) {
|
||||
$data = array();
|
||||
$data['value'] = $value['id'];
|
||||
$post_type = get_post_type_object( $value['post_type'] );
|
||||
|
||||
if ( strlen( $value['title'] ) > 0 ) {
|
||||
$post_title = $value['title'];
|
||||
} else {
|
||||
$post_title = us_translate( '(no title)' );
|
||||
}
|
||||
$post_title .= ' <i>' . $post_type->labels->singular_name . '</i>';
|
||||
$data['label'] = $post_title;
|
||||
$results[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
add_filter( 'vc_autocomplete_us_carousel_ids_render', 'us_grid_ids_render', 10, 1 );
|
||||
add_filter( 'vc_autocomplete_us_grid_ids_render', 'us_grid_ids_render', 10, 1 );
|
||||
function us_grid_ids_render( $query ) {
|
||||
$query = trim( $query['value'] ); // get value from requested
|
||||
if ( ! empty( $query ) ) {
|
||||
// get post
|
||||
$post_object = get_post( (int) $query );
|
||||
if ( is_object( $post_object ) ) {
|
||||
$post_type = get_post_type_object( $post_object->post_type );
|
||||
|
||||
if ( strlen( $post_object->post_title ) > 0 ) {
|
||||
$post_title = $post_object->post_title;
|
||||
} else {
|
||||
$post_title = us_translate( '(no title)' );
|
||||
}
|
||||
$post_title .= ' <i>' . $post_type->labels->singular_name . '</i>';
|
||||
|
||||
$post_id = $post_object->ID;
|
||||
$data = array();
|
||||
$data['value'] = $post_id;
|
||||
$data['label'] = $post_title;
|
||||
|
||||
return ! empty( $data ) ? $data : FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'us_page_block_the_content', 'us_VC_fixPContent', 11 );
|
||||
function us_VC_fixPContent( $content = NULL ) {
|
||||
if ( $content ) {
|
||||
$s = array(
|
||||
'/' . preg_quote( '</div>', '/' ) . '[\s\n\f]*' . preg_quote( '</p>', '/' ) . '/i',
|
||||
'/' . preg_quote( '<p>', '/' ) . '[\s\n\f]*' . preg_quote( '<div ', '/' ) . '/i',
|
||||
'/' . preg_quote( '<p>', '/' ) . '[\s\n\f]*' . preg_quote( '<section ', '/' ) . '/i',
|
||||
'/' . preg_quote( '</section>', '/' ) . '[\s\n\f]*' . preg_quote( '</p>', '/' ) . '/i',
|
||||
);
|
||||
$r = array(
|
||||
'</div>',
|
||||
'<div ',
|
||||
'<section ',
|
||||
'</section>',
|
||||
);
|
||||
$content = preg_replace( $s, $r, $content );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Hide activation notice
|
||||
add_action( 'admin_notices', 'us_hide_js_composer_activation_notice', 100 );
|
||||
function us_hide_js_composer_activation_notice() {
|
||||
?>
|
||||
<script>
|
||||
( function( $ ) {
|
||||
var setCookie = function( c_name, value, exdays ) {
|
||||
var exdate = new Date();
|
||||
exdate.setDate( exdate.getDate() + exdays );
|
||||
var c_value = encodeURIComponent( value ) + ( ( null === exdays ) ? "" : "; expires=" + exdate.toUTCString() );
|
||||
document.cookie = c_name + "=" + c_value;
|
||||
};
|
||||
setCookie( 'vchideactivationmsg_vc11', '100', 30 );
|
||||
$( '#vc_license-activation-notice' ).remove();
|
||||
} )( window.jQuery );
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
// Set Backend Editor as default for post types
|
||||
$list = array(
|
||||
'page',
|
||||
'us_portfolio',
|
||||
'us_page_block',
|
||||
);
|
||||
vc_set_default_editor_post_types( $list );
|
||||
|
||||
// Remove Backend Editor for Headers & Grid Layouts
|
||||
add_filter( 'vc_settings_exclude_post_type', 'us_vc_settings_exclude_post_type' );
|
||||
function us_vc_settings_exclude_post_type( $types ) {
|
||||
$types = array(
|
||||
'us_header',
|
||||
'us_grid_layout',
|
||||
);
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
||||
add_filter( 'vc_is_valid_post_type_be', 'us_vc_is_valid_post_type_be', 10, 2 );
|
||||
function us_vc_is_valid_post_type_be( $result, $type ) {
|
||||
if ( in_array( $type, array( 'us_header', 'us_grid_layout', ) ) ) {
|
||||
$result = FALSE;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
add_action( 'current_screen', 'us_header_vc_check_post_type_validation_fix' );
|
||||
function us_header_vc_check_post_type_validation_fix( $current_screen ) {
|
||||
global $pagenow;
|
||||
if ( $pagenow == 'post.php' AND $current_screen->post_type == 'us_header' ) {
|
||||
add_filter( 'vc_check_post_type_validation', '__return_false', 12 );
|
||||
}
|
||||
}
|
||||
|
||||
global $us_template_directory_uri;
|
||||
if ( ! function_exists( 'us_design_options_settings_field' ) ) {
|
||||
vc_add_shortcode_param( 'us_design_options', 'us_design_options_settings_field', $us_template_directory_uri . '/framework/plugins-support/js_composer/js/us_design_options.js' );
|
||||
function us_design_options_settings_field( $settings, $value ) {
|
||||
$directions = array( 'top', 'right', 'bottom', 'left' );
|
||||
|
||||
$with_position = TRUE; // TODO: should we add Position setting?
|
||||
|
||||
$output = '<div class="usof-design">';
|
||||
$output .= '<input name="' . esc_attr( $settings['param_name'] ) . '" class="us-design-options-value wpb_vc_param_value wpb-textinput ' . esc_attr( $settings['param_name'] ) . ' ' . esc_attr( $settings['type'] ) . '_field' . '" type="hidden" value="' . esc_attr( $value ) . '">';
|
||||
|
||||
$output .= '<div class="usof-design-control for_default">';
|
||||
|
||||
$css_values = array();
|
||||
$value_pairs = explode( ';', $value );
|
||||
if ( is_array( $value_pairs ) AND count( $value_pairs ) > 0 ) {
|
||||
foreach ( $value_pairs as $value_pair ) {
|
||||
$value_pair_arr = explode( ':', $value_pair );
|
||||
if ( is_array( $value_pair_arr ) AND count( $value_pair_arr ) == 2 ) {
|
||||
$_css_name = trim( str_replace( '-', '_', $value_pair_arr[0] ) );
|
||||
$_css_value = trim( $value_pair_arr[1] );
|
||||
if ( $_css_name == 'position' ) {
|
||||
continue;
|
||||
}
|
||||
if ( in_array( $_css_name, array( 'top', 'bottom', 'left', 'right', ) ) ) {
|
||||
$_css_name = 'position_' . $_css_name;
|
||||
}
|
||||
$css_values[ $_css_name ] = $_css_value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $with_position ) {
|
||||
// Checking if position is enabled
|
||||
$pos_enabled = FALSE;
|
||||
foreach ( $directions as $part ) {
|
||||
$subname = 'position_' . $part;
|
||||
if ( isset( $css_values[ $subname ] ) AND $css_values[ $subname ] !== '' ) {
|
||||
$pos_enabled = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Positioning Switcher
|
||||
$output .= '<div class="usof-switcher">';
|
||||
$output .= '<input type="hidden" name="pos_abs" value="0" />';
|
||||
$output .= '<input type="checkbox" id="usdo_pos_abs" name="pos_abs" value="1"' . ( $pos_enabled ? ' checked="checked"' : '' ) . '>';
|
||||
$output .= '<label for="usdo_pos_abs">';
|
||||
$output .= '<span class="usof-switcher-box"><i></i></span>';
|
||||
$output .= '<span class="usof-switcher-text">' . __( 'Absolute Positioning', 'us' ) . '</span>';
|
||||
$output .= '</label></div>';
|
||||
|
||||
// Position
|
||||
$output .= '<div class="usof-design-position' . ( $pos_enabled ? '' : ' pos_off' ) . '">';
|
||||
$output .= '<div class="usof-design-attr">Position</div>';
|
||||
foreach ( $directions as $part ) {
|
||||
$subname = 'position_' . $part;
|
||||
$subvalue = isset( $css_values[ $subname ] ) ? $css_values[ $subname ] : '';
|
||||
if ( preg_match( '~^\d+$~', $subvalue ) ) {
|
||||
$subvalue = $subvalue . 'px';
|
||||
}
|
||||
$output .= '<input class="us-design-options-input for-position ' . $part . '" type="text" name="' . esc_attr( $subname ) . '" value="' . esc_attr( $subvalue ) . '">';
|
||||
}
|
||||
}
|
||||
|
||||
// Margin
|
||||
$output .= '<div class="usof-design-margin">';
|
||||
$output .= '<div class="usof-design-attr">Margin</div>';
|
||||
foreach ( $directions as $part ) {
|
||||
$subname = 'margin_' . $part;
|
||||
$subvalue = isset( $css_values[ $subname ] ) ? $css_values[ $subname ] : '';
|
||||
if ( preg_match( '~^\d+$~', $subvalue ) ) {
|
||||
$subvalue = $subvalue . 'px';
|
||||
}
|
||||
$output .= '<input class="us-design-options-input ' . $part . '" type="text" name="' . esc_attr( $subname ) . '" value="' . esc_attr( $subvalue ) . '">';
|
||||
}
|
||||
|
||||
// Border
|
||||
$output .= '<div class="usof-design-border">';
|
||||
$output .= '<div class="usof-design-attr">Border</div>';
|
||||
foreach ( $directions as $part ) {
|
||||
$subname = 'border_' . $part;
|
||||
$subvalue = isset( $css_values[ $subname ] ) ? $css_values[ $subname ] : '';
|
||||
if ( preg_match( '~^\d+$~', $subvalue ) ) {
|
||||
$subvalue = $subvalue . 'px';
|
||||
}
|
||||
$output .= '<input class="us-design-options-input ' . $part . '" type="text" name="' . esc_attr( $subname ) . '" value="' . esc_attr( $subvalue ) . '">';
|
||||
}
|
||||
|
||||
// Padding
|
||||
$output .= '<div class="usof-design-padding">';
|
||||
$output .= '<div class="usof-design-attr">Padding</div>';
|
||||
foreach ( $directions as $part ) {
|
||||
$subname = 'padding_' . $part;
|
||||
$subvalue = isset( $css_values[ $subname ] ) ? $css_values[ $subname ] : '';
|
||||
if ( preg_match( '~^\d+$~', $subvalue ) ) {
|
||||
$subvalue = $subvalue . 'px';
|
||||
}
|
||||
$output .= '<input class="us-design-options-input ' . $part . '" type="text" name="' . esc_attr( $subname ) . '" value="' . esc_attr( $subvalue ) . '">';
|
||||
}
|
||||
$output .= '</div>';
|
||||
|
||||
// .usof-design-border
|
||||
$output .= '</div>';
|
||||
|
||||
// .usof-design-margin
|
||||
$output .= '</div>';
|
||||
|
||||
if ( $with_position ) {
|
||||
// .usof-design-position
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
// .usof-design-control
|
||||
$output .= '</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
// Add parameter for icon selection
|
||||
if ( ! function_exists( 'us_icon_settings_field' ) ) {
|
||||
vc_add_shortcode_param( 'us_icon', 'us_icon_settings_field', $us_template_directory_uri . '/framework/plugins-support/js_composer/js/us_icon.js' );
|
||||
function us_icon_settings_field( $settings, $value ) {
|
||||
$icon_sets = us_config( 'icon-sets', array() );
|
||||
reset( $icon_sets );
|
||||
$value = trim( $value );
|
||||
if ( ! preg_match( '/(fas|far|fal|fab|material)\|[a-z0-9-]/i', $value ) ) {
|
||||
$value = $settings['std'];
|
||||
}
|
||||
$select_value = $input_value = '';
|
||||
$value_arr = explode( '|', $value );
|
||||
if ( count( $value_arr ) == 2 ) {
|
||||
$select_value = $value_arr[0];
|
||||
$input_value = $value_arr[1];
|
||||
}
|
||||
if ( empty( $select_value ) ) {
|
||||
$select_value = key( $icon_sets );
|
||||
}
|
||||
ob_start();
|
||||
?>
|
||||
<div class="us-icon">
|
||||
<input name="<?php echo esc_attr( $settings['param_name'] ); ?>"
|
||||
class="us-icon-value wpb_vc_param_value wpb-textinput <?php echo esc_attr( $settings['param_name'] ) . ' ' . esc_attr( $settings['type'] ) . '_field'; ?>"
|
||||
type="hidden" value="<?php echo esc_attr( $value ); ?>">
|
||||
<select name="icon_set" class="us-icon-select">
|
||||
<?php foreach ( $icon_sets as $set_slug => $set_info ) { ?>
|
||||
<option value="<?php echo $set_slug ?>"<?php if ( $select_value == $set_slug ) {
|
||||
echo ' selected="selected"';
|
||||
} ?> data-info-url="<?php echo $set_info['set_url'] ?>"><?php echo $set_info['set_name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="us-icon-preview">
|
||||
<?php
|
||||
$icon_preview_html = preg_replace( '/fa-\dx/', '', us_prepare_icon_tag( $value ) );
|
||||
echo ( $icon_preview_html ) ? $icon_preview_html : '<i class="material-icons"></i>';
|
||||
?>
|
||||
</div>
|
||||
<div class="us-icon-input">
|
||||
<input name="icon_name" class="wpb-textinput us-icon-text" type="text"
|
||||
value="<?php echo esc_attr( $input_value ); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="us-icon-desc">
|
||||
<?php echo '<a class="us-icon-set-link" href="' . $icon_sets[ $select_value ]['set_url'] . '" target="_blank">' . __( 'Enter icon name from the list', 'us' ) . '</a>. ' . __( 'Examples:', 'us' ) . ' <span class="usof-example">star</span>, <span class="usof-example">edit</span>, <span class="usof-example">code</span>'; ?>
|
||||
</div>
|
||||
<?php
|
||||
$result = ob_get_clean();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Add parameter for Grid Layout selection
|
||||
if ( ! function_exists( 'us_grid_layout_field' ) ) {
|
||||
vc_add_shortcode_param( 'us_grid_layout', 'us_grid_layout_field', $us_template_directory_uri . '/framework/plugins-support/js_composer/js/us_grid_layout.js' );
|
||||
function us_grid_layout_field( $settings, $value ) {
|
||||
$templates_config = us_config( 'grid-templates', array(), TRUE );
|
||||
|
||||
$custom_layouts = array_flip( us_get_posts_titles_for( 'us_grid_layout' ) );
|
||||
ob_start();
|
||||
?>
|
||||
<div class="us-grid-layout">
|
||||
<select name="<?php echo esc_attr( $settings['param_name'] ); ?>"
|
||||
class="wpb_vc_param_value wpb-input wpb-select <?php echo esc_attr( $settings['param_name'] ) ?> dropdown us-grid-layout-select">
|
||||
<optgroup label="<?php _e( 'Grid Layouts', 'us' ); ?>">
|
||||
<?php foreach ( $custom_layouts as $title => $id ) { ?>
|
||||
<option value="<?php echo $id ?>"<?php if ( $value == $id ) {
|
||||
echo ' selected="selected"';
|
||||
} ?>
|
||||
data-edit-url="<?php echo admin_url( '/post.php?post=' . $id . '&action=edit' ); ?>"><?php echo $title; ?></option>
|
||||
<?php }
|
||||
$current_tmpl_group = '';
|
||||
foreach ( $templates_config as $template_name => $template ) {
|
||||
if ( ! empty( $template['group'] ) AND $current_tmpl_group != $template['group'] ) {
|
||||
$current_tmpl_group = $template['group'];
|
||||
?>
|
||||
</optgroup>
|
||||
<optgroup label="<?php echo $template['group']; ?>">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<option value="<?php echo $template_name ?>"<?php if ( $value == $template_name ) {
|
||||
echo ' selected="selected"';
|
||||
} ?>><?php echo $template['title']; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</optgroup>
|
||||
</select>
|
||||
<div class="us-grid-layout-desc-edit">
|
||||
<?php echo sprintf( _x( '%sEdit selected%s or %screate a new one%s.', 'Grid Layout', 'us' ), '<a href="#" class="edit-link" target="_blank">', '</a>', '<a href="' . admin_url() . 'post-new.php?post_type=us_grid_layout" target="_blank">', '</a>' ); ?>
|
||||
</div>
|
||||
<div class="us-grid-layout-desc-add">
|
||||
<a href="<?php admin_url() ?>post-new.php?post_type=us_grid_layout"
|
||||
target="_blank"><?php _e( 'Add Grid Layout', 'us' ) ?></a>.
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$result = ob_get_clean();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Add script to fill inputs with examples from description
|
||||
add_action( 'admin_enqueue_scripts', 'us_input_examples' );
|
||||
function us_input_examples() {
|
||||
global $pagenow;
|
||||
$screen = get_current_screen();
|
||||
$current_post_type = $screen->post_type;
|
||||
$excluded_post_types = array(
|
||||
'us_header',
|
||||
'us_grid_layout',
|
||||
);
|
||||
|
||||
if ( $pagenow != 'post.php' OR in_array( $current_post_type, $excluded_post_types ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $us_template_directory_uri;
|
||||
wp_enqueue_script( 'us_input_examples_vc', $us_template_directory_uri . '/framework/plugins-support/js_composer/js/us_input_examples.js', array( 'jquery' ), US_THEMEVERSION );
|
||||
}
|
||||
|
||||
// Add Theme Color Palette to Iris color pickers, mostly used by WPBakery Page Builder
|
||||
add_action( 'admin_print_scripts', 'us_override_iris_colorpalette', 100 );
|
||||
function us_override_iris_colorpalette() {
|
||||
$screen = get_current_screen();
|
||||
if ( wp_script_is( 'wp-color-picker', 'enqueued' ) AND $screen->id != 'toplevel_page_us-theme-options' ) {
|
||||
|
||||
$palette = get_option( 'usof_color_palette_' . US_THEMENAME );
|
||||
|
||||
if ( is_array( $palette ) AND ! empty( $palette ) ) {
|
||||
$json_palette = array();
|
||||
$default_color = "#ffffff";
|
||||
$palette_length = count( $palette );
|
||||
// Convert all colors to HEX since Page Builder doesn't support transparency in its palette
|
||||
foreach ( $palette as $color ) {
|
||||
$color = us_gradient2hex( $color );
|
||||
$json_palette[] = us_rgba2hex( $color );
|
||||
}
|
||||
// Fill till it comes 8 colors
|
||||
if ( $palette_length !== 8 ) {
|
||||
for ( $i = 0; $i < 8 - $palette_length; $i ++ ) {
|
||||
$json_palette[] = $default_color;
|
||||
}
|
||||
}
|
||||
$json_palette = json_encode( $json_palette );
|
||||
?>
|
||||
<script>
|
||||
// Add palette to WordPress iris color pickers
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
if ( ! $.wp ) {
|
||||
return;
|
||||
}
|
||||
$.wp.wpColorPicker.prototype.options = {
|
||||
palettes: <?php echo $json_palette; ?>, width: 255, hide: true,
|
||||
};
|
||||
} );
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add design options CSS for shortcodes in custom pages and page blocks
|
||||
function us_add_page_shortcodes_custom_css( $id ) {
|
||||
global $wp_query, $vc_manager;
|
||||
$wp_query = new WP_Query(
|
||||
array(
|
||||
'p' => $id,
|
||||
'post_type' => 'any',
|
||||
)
|
||||
);
|
||||
if ( ! empty( $vc_manager ) AND is_object( $vc_manager ) ) {
|
||||
$vc_manager->vc()->addPageCustomCss( $id );
|
||||
$vc_manager->vc()->addShortcodesCustomCss( $id );
|
||||
}
|
||||
}
|
||||
|
||||
// Add image preview for Image shortcode
|
||||
if ( ! class_exists( 'WPBakeryShortCode_us_image' ) ) {
|
||||
class WPBakeryShortCode_us_image extends WPBakeryShortCode {
|
||||
public function singleParamHtmlHolder( $param, $value ) {
|
||||
$output = '';
|
||||
// Compatibility fixes
|
||||
$param_name = isset( $param['param_name'] ) ? $param['param_name'] : '';
|
||||
$type = isset( $param['type'] ) ? $param['type'] : '';
|
||||
$class = isset( $param['class'] ) ? $param['class'] : '';
|
||||
if ( $type == 'attach_image' AND $param_name == 'image' ) {
|
||||
$output .= '<input type="hidden" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '" />';
|
||||
$element_icon = $this->settings( 'icon' );
|
||||
$img = wpb_getImageBySize(
|
||||
array(
|
||||
'attach_id' => (int) preg_replace( '/[^\d]/', '', $value ),
|
||||
'thumb_size' => 'thumbnail',
|
||||
)
|
||||
);
|
||||
$logo_html = '';
|
||||
if ( $img ) {
|
||||
$logo_html .= $img['thumbnail'];
|
||||
} else {
|
||||
$logo_html .= '<img width="150" height="150" class="attachment-thumbnail icon-wpb-single-image vc_element-icon" data-name="' . $param_name . '" alt="' . $param_name . '" style="display: none;" />';
|
||||
}
|
||||
$logo_html .= '<span class="no_image_image vc_element-icon' . ( ! empty( $element_icon ) ? ' ' . $element_icon : '' ) . ( $img && ! empty( $img['p_img_large'][0] ) ? ' image-exists' : '' ) . '" />';
|
||||
$this->setSettings( 'logo', $logo_html );
|
||||
$output .= $this->outputTitleTrue( $this->settings['name'] );
|
||||
} elseif ( ! empty( $param['holder'] ) ) {
|
||||
if ( $param['holder'] == 'input' ) {
|
||||
$output .= '<' . $param['holder'] . ' readonly="true" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '">';
|
||||
} elseif ( in_array( $param['holder'], array( 'img', 'iframe' ) ) ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" src="' . $value . '">';
|
||||
} elseif ( $param['holder'] !== 'hidden' ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $param['admin_label'] ) && $param['admin_label'] === TRUE ) {
|
||||
$output .= '<span class="vc_admin_label admin_label_' . $param['param_name'] . ( empty( $value ) ? ' hidden-label' : '' ) . '"><label>' . __( $param['heading'], 'js_composer' ) . '</label>: ' . $value . '</span>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
protected function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function outputTitleTrue( $title ) {
|
||||
return '<h4 class="wpb_element_title">' . __( $title, 'us' ) . ' ' . $this->settings( 'logo' ) . '</h4>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add image preview for Person shortcode
|
||||
if ( ! class_exists( 'WPBakeryShortCode_us_person' ) ) {
|
||||
class WPBakeryShortCode_us_person extends WPBakeryShortCode {
|
||||
public function singleParamHtmlHolder( $param, $value ) {
|
||||
$output = '';
|
||||
// Compatibility fixes
|
||||
$param_name = isset( $param['param_name'] ) ? $param['param_name'] : '';
|
||||
$type = isset( $param['type'] ) ? $param['type'] : '';
|
||||
$class = isset( $param['class'] ) ? $param['class'] : '';
|
||||
if ( $type == 'attach_image' AND $param_name == 'image' ) {
|
||||
$output .= '<input type="hidden" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '" />';
|
||||
$element_icon = $this->settings( 'icon' );
|
||||
$img = wpb_getImageBySize(
|
||||
array(
|
||||
'attach_id' => (int) preg_replace( '/[^\d]/', '', $value ),
|
||||
'thumb_size' => 'thumbnail',
|
||||
)
|
||||
);
|
||||
$logo_html = '';
|
||||
if ( $img ) {
|
||||
$logo_html .= $img['thumbnail'];
|
||||
} else {
|
||||
$logo_html .= '<img width="150" height="150" class="attachment-thumbnail ' . $element_icon . ' vc_element-icon" data-name="' . $param_name . '" alt="' . $param_name . '" style="display: none;" />';
|
||||
}
|
||||
$logo_html .= '<span class="no_image_image vc_element-icon ' . $element_icon . ( $img AND ! empty( $img['p_img_large'][0] ) ? ' image-exists' : '' ) . '" />';
|
||||
$this->setSettings( 'logo', $logo_html );
|
||||
$output .= $this->outputTitleTrue( $this->settings['name'] );
|
||||
} elseif ( ! empty( $param['holder'] ) ) {
|
||||
if ( $param['holder'] == 'input' ) {
|
||||
$output .= '<' . $param['holder'] . ' readonly="true" class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" value="' . $value . '">';
|
||||
} elseif ( in_array( $param['holder'], array( 'img', 'iframe' ) ) ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '" src="' . $value . '">';
|
||||
} elseif ( $param['holder'] !== 'hidden' ) {
|
||||
$output .= '<' . $param['holder'] . ' class="wpb_vc_param_value ' . $param_name . ' ' . $type . ' ' . $class . '" name="' . $param_name . '">' . $value . '</' . $param['holder'] . '>';
|
||||
}
|
||||
}
|
||||
if ( ! empty( $param['admin_label'] ) AND $param['admin_label'] === TRUE ) {
|
||||
$output .= '<span class="vc_admin_label admin_label_' . $param['param_name'] . ( empty( $value ) ? ' hidden-label' : '' ) . '"><label>' . __( $param['heading'], 'js_composer' ) . '</label>: ' . $value . '</span>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
protected function outputTitle( $title ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function outputTitleTrue( $title ) {
|
||||
return '<h4 class="wpb_element_title">' . __( $title, 'us' ) . ' ' . $this->settings( 'logo' ) . '</h4>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add wrapper behavior for us_hwrapper shortcode
|
||||
if ( ! class_exists( 'WPBakeryShortCode_us_hwrapper' ) ) {
|
||||
class WPBakeryShortCode_us_hwrapper extends WPBakeryShortCodesContainer {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Extending shortcode: vc_column
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*
|
||||
* @param $config ['atts'] array Shortcode's attributes and default values
|
||||
*/
|
||||
vc_remove_param( 'vc_column', 'css_animation' );
|
||||
vc_remove_param( 'vc_column', 'video_bg' );
|
||||
vc_remove_param( 'vc_column', 'video_bg_url' );
|
||||
vc_remove_param( 'vc_column', 'video_bg_parallax' );
|
||||
vc_remove_param( 'vc_column', 'parallax' );
|
||||
vc_remove_param( 'vc_column', 'parallax_image' );
|
||||
vc_remove_param( 'vc_column', 'parallax_speed_video' );
|
||||
vc_remove_param( 'vc_column', 'parallax_speed_bg' );
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_column', array(
|
||||
'param_name' => 'width',
|
||||
'description' => '',
|
||||
'value' => array(
|
||||
'1/12 — 8.33%' => '1/12',
|
||||
'1/6 — 16.66%'=> '1/6',
|
||||
'1/5 — 20%'=> '1/5',
|
||||
'1/4 — 25%'=> '1/4',
|
||||
'1/3 — 33.33%'=> '1/3',
|
||||
'2/5 — 40%'=> '2/5',
|
||||
'5/12 — 41.66%'=> '5/12',
|
||||
'1/2 — 50%'=> '1/2',
|
||||
'7/12 — 58.33%'=> '7/12',
|
||||
'3/5 — 60%'=> '3/5',
|
||||
'2/3 — 66.66%'=> '2/3',
|
||||
'3/4 — 75%'=> '3/4',
|
||||
'4/5 — 80%'=> '4/5',
|
||||
'5/6 — 83.33%'=> '5/6',
|
||||
'11/12 — 91.66%'=> '11/12',
|
||||
'1/1 — 100%'=> '1/1',
|
||||
),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_column', array(
|
||||
'param_name' => 'offset',
|
||||
'heading' => '',
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_column', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 20,
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_column', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
vc_add_params( 'vc_column', array(
|
||||
array(
|
||||
'param_name' => 'link',
|
||||
'heading' => us_translate( 'Link' ),
|
||||
'type' => 'vc_link',
|
||||
'std' => $config['atts']['link'],
|
||||
'weight' => 40,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'text_color',
|
||||
'heading' => __( 'Text Color', 'us' ),
|
||||
'type' => 'colorpicker',
|
||||
'std' => $config['atts']['text_color'],
|
||||
'weight' => 30,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'animate',
|
||||
'heading' => __( 'Animation', 'us' ),
|
||||
'description' => __( 'Selected animation will be applied to this element, when it enters into the browsers viewport.', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'None' ) => '',
|
||||
__( 'Fade', 'us' ) => 'fade',
|
||||
__( 'Appear From Center', 'us' ) => 'afc',
|
||||
__( 'Appear From Left', 'us' ) => 'afl',
|
||||
__( 'Appear From Right', 'us' ) => 'afr',
|
||||
__( 'Appear From Bottom', 'us' ) => 'afb',
|
||||
__( 'Appear From Top', 'us' ) => 'aft',
|
||||
__( 'Height From Center', 'us' ) => 'hfc',
|
||||
__( 'Width From Center', 'us' ) => 'wfc',
|
||||
),
|
||||
'std' => $config['atts']['animate'],
|
||||
'admin_label' => TRUE,
|
||||
'weight' => 20,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'animate_delay',
|
||||
'heading' => __( 'Animation Delay (in seconds)', 'us' ),
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['animate_delay'],
|
||||
'dependency' => array( 'element' => 'animate', 'not_empty' => TRUE ),
|
||||
'admin_label' => TRUE,
|
||||
'weight' => 10,
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Extending shortcode: vc_column_inner
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*
|
||||
* @param $config ['atts'] array Shortcode's attributes and default values
|
||||
*/
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_column_inner', array(
|
||||
'param_name' => 'width',
|
||||
'description' => '',
|
||||
'value' => array(
|
||||
'1/12 — 8.33%' => '1/12',
|
||||
'1/6 — 16.66%'=> '1/6',
|
||||
'1/5 — 20%'=> '1/5',
|
||||
'1/4 — 25%'=> '1/4',
|
||||
'1/3 — 33.33%'=> '1/3',
|
||||
'2/5 — 40%'=> '2/5',
|
||||
'5/12 — 41.66%'=> '5/12',
|
||||
'1/2 — 50%'=> '1/2',
|
||||
'7/12 — 58.33%'=> '7/12',
|
||||
'3/5 — 60%'=> '3/5',
|
||||
'2/3 — 66.66%'=> '2/3',
|
||||
'3/4 — 75%'=> '3/4',
|
||||
'4/5 — 80%'=> '4/5',
|
||||
'5/6 — 83.33%'=> '5/6',
|
||||
'11/12 — 91.66%'=> '11/12',
|
||||
'1/1 — 100%'=> '1/1',
|
||||
),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_column_inner', array(
|
||||
'param_name' => 'offset',
|
||||
'heading' => '',
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_column_inner', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 20,
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_column_inner', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
vc_add_params( 'vc_column_inner', array(
|
||||
array(
|
||||
'param_name' => 'link',
|
||||
'heading' => us_translate( 'Link' ),
|
||||
'type' => 'vc_link',
|
||||
'std' => $config['atts']['link'],
|
||||
'weight' => 40,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'text_color',
|
||||
'heading' => __( 'Text Color', 'us' ),
|
||||
'type' => 'colorpicker',
|
||||
'std' => $config['atts']['text_color'],
|
||||
'weight' => 30,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'animate',
|
||||
'heading' => __( 'Animation', 'us' ),
|
||||
'description' => __( 'Selected animation will be applied to this element, when it enters into the browsers viewport.', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'None' ) => '',
|
||||
__( 'Fade', 'us' ) => 'fade',
|
||||
__( 'Appear From Center', 'us' ) => 'afc',
|
||||
__( 'Appear From Left', 'us' ) => 'afl',
|
||||
__( 'Appear From Right', 'us' ) => 'afr',
|
||||
__( 'Appear From Bottom', 'us' ) => 'afb',
|
||||
__( 'Appear From Top', 'us' ) => 'aft',
|
||||
__( 'Height From Center', 'us' ) => 'hfc',
|
||||
__( 'Width From Center', 'us' ) => 'wfc',
|
||||
),
|
||||
'std' => $config['atts']['animate'],
|
||||
'admin_label' => TRUE,
|
||||
'weight' => 20,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'animate_delay',
|
||||
'heading' => __( 'Animation Delay (in seconds)', 'us' ),
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['animate_delay'],
|
||||
'dependency' => array( 'element' => 'animate', 'not_empty' => TRUE ),
|
||||
'admin_label' => TRUE,
|
||||
'weight' => 10,
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Modifying shortcode: vc_column_text
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*/
|
||||
|
||||
vc_remove_param( 'vc_column_text', 'css_animation' );
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_column_text', array(
|
||||
'param_name' => 'content',
|
||||
'heading' => '',
|
||||
'weight' => 20,
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_column_text', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 10,
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_column_text', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Setting proper shortcode order in VC shortcodes listing
|
||||
vc_map_update( 'vc_column_text', array( 'weight' => 380 ) );
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Modifying shortcode: vc_custom_heading
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*/
|
||||
vc_remove_param( 'vc_custom_heading', 'css_animation' );
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_custom_heading', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_custom_heading', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
// We are removing css_animation param for custom heading, but we are not redefying it's template, so we need to set a default value for css_animation param for front end editor compatibility
|
||||
add_filter( 'vc_map_get_attributes', 'us_css_animation_default_value_for_vc_custom_heading', 100, 2 );
|
||||
function us_css_animation_default_value_for_vc_custom_heading( $atts, $tag ) {
|
||||
if ( $tag == 'vc_custom_heading' ) {
|
||||
$atts['css_animation'] = '';
|
||||
}
|
||||
return $atts;
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Extending shortcode: vc_row
|
||||
*/
|
||||
|
||||
vc_remove_param( 'vc_row', 'full_width' );
|
||||
vc_remove_param( 'vc_row', 'full_height' );
|
||||
vc_remove_param( 'vc_row', 'content_placement' );
|
||||
vc_remove_param( 'vc_row', 'video_bg' );
|
||||
vc_remove_param( 'vc_row', 'video_bg_url' );
|
||||
vc_remove_param( 'vc_row', 'video_bg_parallax' );
|
||||
vc_remove_param( 'vc_row', 'columns_placement' );
|
||||
vc_remove_param( 'vc_row', 'equal_height' );
|
||||
vc_remove_param( 'vc_row', 'parallax_speed_video' );
|
||||
vc_remove_param( 'vc_row', 'parallax_speed_bg' );
|
||||
vc_remove_param( 'vc_row', 'css_animation' );
|
||||
vc_remove_param( 'vc_row', 'rtl_reverse' );
|
||||
|
||||
if ( ! vc_is_page_editable() ) {
|
||||
vc_remove_param( 'vc_row', 'parallax' );
|
||||
vc_remove_param( 'vc_row', 'parallax_image' );
|
||||
}
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_row', array(
|
||||
'heading' => __( 'Additional gap', 'us' ),
|
||||
'param_name' => 'gap',
|
||||
'type' => 'textfield',
|
||||
'description' => __( 'Examples:', 'us' ) . ' <span class="usof-example">2px</span>, <span class="usof-example">1.5rem</span>, <span class="usof-example">1vw</span>',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 9,
|
||||
'group' => us_translate( 'Columns' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_row', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 1,
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_row', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
vc_add_params(
|
||||
'vc_row', array(
|
||||
array(
|
||||
'param_name' => 'content_placement',
|
||||
'heading' => __( 'Columns Content Position', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Top' ) => 'top',
|
||||
us_translate( 'Middle' ) => 'middle',
|
||||
us_translate( 'Bottom' ) => 'bottom',
|
||||
),
|
||||
'std' => $config['atts']['content_placement'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 10,
|
||||
'group' => us_translate( 'Columns' ),
|
||||
),
|
||||
array(
|
||||
'param_name' => 'columns_type',
|
||||
'description' => __( 'Improves apperance of columns with background', 'us' ),
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Add extra padding around columns content', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['columns_type'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['columns_type'],
|
||||
'weight' => 8,
|
||||
'group' => us_translate( 'Columns' ),
|
||||
),
|
||||
array(
|
||||
'param_name' => 'columns_reverse',
|
||||
'description' => __( 'The last column will be shown on the top.', 'us' ) . ' ' . sprintf( __( 'Applied when the screen width is less than %s', 'us' ), '<a target="_blank" href="' . admin_url( 'admin.php?page=us-theme-options' ) . '#layout" title="' . __( 'edit in Theme Options', 'us' ) . '">' . us_get_option( 'columns_stacking_width' ) . '</a>' ),
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Reverse order for columns stacking', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['columns_reverse'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['columns_reverse'],
|
||||
'weight' => 7,
|
||||
'group' => us_translate( 'Columns' ),
|
||||
),
|
||||
array(
|
||||
'param_name' => 'height',
|
||||
'heading' => __( 'Row Height', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
__( 'Default from Theme Options', 'us' ) => 'default',
|
||||
__( 'Equals the content height', 'us' ) => 'auto',
|
||||
__( 'Small', 'us' ) => 'small',
|
||||
__( 'Medium', 'us' ) => 'medium',
|
||||
__( 'Large', 'us' ) => 'large',
|
||||
__( 'Huge', 'us' ) => 'huge',
|
||||
__( 'Full Screen', 'us' ) => 'full',
|
||||
),
|
||||
'std' => $config['atts']['height'],
|
||||
'weight' => 170,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'valign',
|
||||
'heading' => __( 'Row Content Position', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Top' ) => 'top',
|
||||
us_translate( 'Middle' ) => 'center',
|
||||
us_translate( 'Bottom' ) => 'bottom',
|
||||
),
|
||||
'std' => $config['atts']['valign'],
|
||||
'dependency' => array( 'element' => 'height', 'value' => 'full' ),
|
||||
'weight' => 160,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'width',
|
||||
'heading' => __( 'Full Width Content', 'us' ),
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Stretch content of this row to the screen width', 'us' ) => 'full' ),
|
||||
( ( $config['atts']['width'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['width'],
|
||||
'weight' => 150,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'color_scheme',
|
||||
'heading' => __( 'Row Color Style', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
__( 'Content colors', 'us' ) => '',
|
||||
__( 'Alternate Content colors', 'us' ) => 'alternate',
|
||||
__( 'Primary bg & White text', 'us' ) => 'primary',
|
||||
__( 'Secondary bg & White text', 'us' ) => 'secondary',
|
||||
__( 'Top Footer colors', 'us' ) => 'footer-top',
|
||||
__( 'Bottom Footer colors', 'us' ) => 'footer-bottom',
|
||||
__( 'Custom colors', 'us' ) => 'custom',
|
||||
),
|
||||
'std' => $config['atts']['color_scheme'],
|
||||
'weight' => 140,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_color',
|
||||
'heading' => __( 'Background Color', 'us' ),
|
||||
'type' => 'colorpicker',
|
||||
'std' => $config['atts']['us_bg_color'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'dependency' => array( 'element' => 'color_scheme', 'value' => 'custom' ),
|
||||
'weight' => 130,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_text_color',
|
||||
'heading' => __( 'Text Color', 'us' ),
|
||||
'type' => 'colorpicker',
|
||||
'std' => $config['atts']['us_text_color'],
|
||||
'dependency' => array( 'element' => 'color_scheme', 'value' => 'custom' ),
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 120,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_image_source',
|
||||
'heading' => __( 'Background Image', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'None' ) => 'none',
|
||||
us_translate( 'Custom' ) => 'media',
|
||||
us_translate( 'Featured Image' ) => 'featured',
|
||||
),
|
||||
'std' => $config['atts']['us_bg_image_source'],
|
||||
'weight' => 110,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_image',
|
||||
'type' => 'attach_image',
|
||||
'std' => $config['atts']['us_bg_image'],
|
||||
'dependency' => array( 'element' => 'us_bg_image_source', 'value' => 'media' ),
|
||||
'weight' => 100,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_size',
|
||||
'heading' => __( 'Background Image Size', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
__( 'Fill Area', 'us' ) => 'cover',
|
||||
__( 'Fit to Area', 'us' ) => 'contain',
|
||||
__( 'Initial', 'us' ) => 'initial',
|
||||
),
|
||||
'std' => $config['atts']['us_bg_size'],
|
||||
'dependency' => array( 'element' => 'us_bg_image_source', 'value' => array( 'media', 'custom', 'featured' ) ),
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 90,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_pos',
|
||||
'heading' => __( 'Background Image Position', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Top Left' ) => 'top left',
|
||||
us_translate( 'Top' ) => 'top center',
|
||||
us_translate( 'Top Right' ) => 'top right',
|
||||
us_translate( 'Left' ) => 'center left',
|
||||
us_translate( 'Center' ) => 'center center',
|
||||
us_translate( 'Right' ) => 'center right',
|
||||
us_translate( 'Bottom Left' ) => 'bottom left',
|
||||
us_translate( 'Bottom' ) => 'bottom center',
|
||||
us_translate( 'Bottom Right' ) => 'bottom right',
|
||||
),
|
||||
'std' => $config['atts']['us_bg_pos'],
|
||||
'dependency' => array( 'element' => 'us_bg_image_source', 'value' => array( 'media', 'custom', 'featured' ) ),
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 85,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_parallax',
|
||||
'heading' => __( 'Parallax Effect', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'None' ) => '',
|
||||
__( 'Vertical Parallax', 'us' ) => 'vertical',
|
||||
__( 'Horizontal Parallax', 'us' ) => 'horizontal',
|
||||
__( 'Fixed', 'us' ) => 'still',
|
||||
),
|
||||
'std' => $config['atts']['us_bg_parallax'],
|
||||
'dependency' => array( 'element' => 'us_bg_image_source', 'value' => array( 'media', 'custom', 'featured' ) ),
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 82,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_repeat',
|
||||
'heading' => __( 'Background Image Repeat', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
__( 'Repeat', 'us' ) => 'repeat',
|
||||
__( 'Horizontally', 'us' ) => 'repeat-x',
|
||||
__( 'Vertically', 'us' ) => 'repeat-y',
|
||||
us_translate( 'None' ) => 'no-repeat',
|
||||
),
|
||||
'std' => $config['atts']['us_bg_repeat'],
|
||||
'dependency' => array( 'element' => 'us_bg_image_source', 'value' => array( 'media', 'custom', 'featured' ) ),
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 80,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_parallax_width',
|
||||
'heading' => __( 'Parallax Background Width', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
'110%' => '110',
|
||||
'120%' => '120',
|
||||
'130%' => '130',
|
||||
'140%' => '140',
|
||||
'150%' => '150',
|
||||
),
|
||||
'std' => $config['atts']['us_bg_parallax_width'],
|
||||
'dependency' => array( 'element' => 'us_bg_parallax', 'value' => 'horizontal' ),
|
||||
'weight' => 70,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_parallax_reverse',
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Reverse Vertical Parallax Effect', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['us_bg_parallax_reverse'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['us_bg_parallax_reverse'],
|
||||
'dependency' => array( 'element' => 'us_bg_parallax', 'value' => 'vertical' ),
|
||||
'weight' => 60,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_video',
|
||||
'heading' => __( 'Background Video', 'us' ),
|
||||
'description' => __( 'Link to YouTube, Vimeo or video file (mp4, webm, ogg)', 'us' ),
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['us_bg_video'],
|
||||
'weight' => 50,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'us_bg_overlay_color',
|
||||
'heading' => __( 'Background Overlay', 'us' ),
|
||||
'type' => 'colorpicker',
|
||||
'std' => $config['atts']['us_bg_overlay_color'],
|
||||
'holder' => 'div',
|
||||
'weight' => 40,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'sticky',
|
||||
'heading' => __( 'Sticky Row', 'us' ),
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Fix this row at the top of a page during scroll', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['sticky'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['sticky'],
|
||||
'weight' => 30,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'sticky_disable_width',
|
||||
'heading' => __( 'Disable Sticky Row at width', 'us' ),
|
||||
'description' => __( 'When screen width is less than this value, sticky row becomes not sticky.', 'us' ),
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['sticky_disable_width'],
|
||||
'dependency' => array( 'element' => 'sticky', 'not_empty' => TRUE ),
|
||||
'weight' => 20,
|
||||
),
|
||||
)
|
||||
);
|
||||
if ( class_exists( 'Ultimate_VC_Addons' ) ) {
|
||||
vc_add_param(
|
||||
'vc_row', array(
|
||||
'param_name' => 'us_notification',
|
||||
'type' => 'ult_param_heading',
|
||||
'text' => __( 'Background Image, Background Video, Background Overlay settings located below will override the settings located at "Background" and "Effect" tabs.', 'us' ),
|
||||
'edit_field_class' => 'ult-param-important-wrapper ult-dashicon vc_column vc_col-sm-12',
|
||||
'weight' => 110,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Add option to set Rev Slider as row background
|
||||
if ( class_exists( 'RevSlider' ) ) {
|
||||
$slider = new RevSlider();
|
||||
$arrSliders = $slider->getArrSliders();
|
||||
$revsliders = array();
|
||||
if ( $arrSliders ) {
|
||||
foreach ( $arrSliders as $slider ) {
|
||||
$revsliders[ $slider->getTitle() ] = $slider->getAlias();
|
||||
}
|
||||
}
|
||||
vc_add_param(
|
||||
'vc_row', array(
|
||||
'param_name' => 'us_bg_slider',
|
||||
'heading' => __( 'Background Slider', 'us' ),
|
||||
'description' => us_translate( 'Select your Revolution Slider.', 'js_composer' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array_merge( array( '– ' . us_translate( 'None' ) . ' –' => '' ), $revsliders ),
|
||||
'std' => $config['atts']['us_bg_slider'],
|
||||
'weight' => 45,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Setting proper shortcode order in VC shortcodes listing
|
||||
vc_map_update( 'vc_row', array( 'weight' => 390 ) );
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Extending shortcode: vc_row_inner
|
||||
*/
|
||||
|
||||
vc_remove_param( 'vc_row_inner', 'equal_height' );
|
||||
vc_remove_param( 'vc_row_inner', 'content_placement' );
|
||||
vc_remove_param( 'vc_row_inner', 'rtl_reverse' );
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_row_inner', array(
|
||||
'heading' => __( 'Additional gap', 'us' ),
|
||||
'param_name' => 'gap',
|
||||
'type' => 'textfield',
|
||||
'description' => __( 'Examples:', 'us' ) . ' <span class="usof-example">2px</span>, <span class="usof-example">1.5rem</span>, <span class="usof-example">1vw</span>',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 9,
|
||||
'group' => us_translate( 'Columns' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_row_inner', array(
|
||||
'param_name' => 'disable_element',
|
||||
'heading' => '',
|
||||
'value' => array( us_translate( 'Disable row', 'js_composer' ) => 'yes' ),
|
||||
'weight' => 1,
|
||||
'group' => us_translate( 'Columns' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_row_inner', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 1,
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_row_inner', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
vc_add_params(
|
||||
'vc_row_inner', array(
|
||||
array(
|
||||
'param_name' => 'content_placement',
|
||||
'heading' => __( 'Columns Content Position', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Top' ) => 'top',
|
||||
us_translate( 'Middle' ) => 'middle',
|
||||
us_translate( 'Bottom' ) => 'bottom',
|
||||
),
|
||||
'std' => $config['atts']['content_placement'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 10,
|
||||
'group' => us_translate( 'Columns' ),
|
||||
),
|
||||
array(
|
||||
'param_name' => 'columns_type',
|
||||
'description' => __( 'Improves apperance of columns with background', 'us' ),
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Add extra padding around columns content', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['columns_type'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['columns_type'],
|
||||
'weight' => 8,
|
||||
'group' => us_translate( 'Columns' ),
|
||||
),
|
||||
array(
|
||||
'param_name' => 'columns_reverse',
|
||||
'description' => __( 'The last column will be shown on the top.', 'us' ) . ' ' . sprintf( __( 'Applied when the screen width is less than %s', 'us' ), '<a target="_blank" href="' . admin_url( 'admin.php?page=us-theme-options' ) . '#layout" title="' . __( 'edit in Theme Options', 'us' ) . '">' . us_get_option( 'columns_stacking_width' ) . '</a>' ),
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Reverse order for columns stacking', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['columns_reverse'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['columns_reverse'],
|
||||
'weight' => 7,
|
||||
'group' => us_translate( 'Columns' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Modifying shortcode: vc_tta_accordion
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*
|
||||
* @param $config ['atts'] array Shortcode's attributes and default values
|
||||
*/
|
||||
|
||||
$misc = us_config( 'elements_misc' );
|
||||
|
||||
if ( version_compare( WPB_VC_VERSION, '4.6', '<' ) ) {
|
||||
// Oops: the modified shorcode doesn't exist in current VC version. Doing nothing.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! vc_is_page_editable() ) {
|
||||
vc_remove_param( 'vc_tta_accordion', 'title' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'style' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'shape' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'color' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'no_fill' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'spacing' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'gap' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'autoplay' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'collapsible_all' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'active_section' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'c_align' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'c_icon' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'c_position' );
|
||||
vc_remove_param( 'vc_tta_accordion', 'css_animation' );
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_tta_accordion', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 10,
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_tta_accordion', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
vc_add_params(
|
||||
'vc_tta_accordion', array(
|
||||
array(
|
||||
'param_name' => 'toggle',
|
||||
'heading' => __( 'Act as Toggles', 'us' ),
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Allow several sections to be opened at the same time', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['toggle'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['toggle'],
|
||||
'weight' => 60,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'c_align',
|
||||
'heading' => __( 'Title Alignment', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Left' ) => 'left',
|
||||
us_translate( 'Right' ) => 'right',
|
||||
us_translate( 'Center' ) => 'center',
|
||||
),
|
||||
'std' => $config['atts']['c_align'],
|
||||
'weight' => 50,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_tag',
|
||||
'heading' => __( 'Title HTML tag', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => $misc['html_tag_values'],
|
||||
'std' => $config['atts']['title_tag'],
|
||||
'weight' => 40,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_size',
|
||||
'heading' => __( 'Title Size', 'us' ),
|
||||
'description' => $misc['desc_font_size'],
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['title_size'],
|
||||
'weight' => 30,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'c_icon',
|
||||
'heading' => __( 'Icon', 'us' ),
|
||||
'description' => __( 'Select accordion navigation icon.', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'None' ) => '',
|
||||
__( 'Chevron', 'us' ) => 'chevron',
|
||||
__( 'Plus', 'us' ) => 'plus',
|
||||
__( 'Triangle', 'us' ) => 'triangle',
|
||||
),
|
||||
'std' => $config['atts']['c_icon'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 20,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'c_position',
|
||||
'heading' => __( 'Icon Position', 'us' ),
|
||||
'description' => __( 'Select accordion navigation icon position.', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Left' ) => 'left',
|
||||
us_translate( 'Right' ) => 'right',
|
||||
),
|
||||
'std' => $config['atts']['c_position'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 10,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Setting proper shortcode order in VC shortcodes listing
|
||||
vc_map_update( 'vc_tta_accordion', array( 'weight' => 310 ) );
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Modifying shortcode: vc_tta_section
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*
|
||||
* @param $config ['atts'] array Shortcode's attributes and default values
|
||||
*/
|
||||
if ( version_compare( WPB_VC_VERSION, '4.6', '<' ) ) {
|
||||
// Oops: the modified shorcode doesn't exist in current VC version. Doing nothing.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! vc_is_page_editable() ) {
|
||||
vc_remove_param( 'vc_tta_section', 'add_icon' );
|
||||
vc_remove_param( 'vc_tta_section', 'i_type' );
|
||||
vc_remove_param( 'vc_tta_section', 'i_icon_fontawesome' );
|
||||
vc_remove_param( 'vc_tta_section', 'i_icon_openiconic' );
|
||||
vc_remove_param( 'vc_tta_section', 'i_icon_typicons' );
|
||||
vc_remove_param( 'vc_tta_section', 'i_icon_entypo' );
|
||||
vc_remove_param( 'vc_tta_section', 'i_icon_linecons' );
|
||||
vc_remove_param( 'vc_tta_section', 'i_icon_monosocial' );
|
||||
vc_remove_param( 'vc_tta_section', 'i_icon_material' );
|
||||
vc_remove_param( 'vc_tta_section', 'i_position' );
|
||||
vc_update_shortcode_param(
|
||||
'vc_tta_section', array(
|
||||
'param_name' => 'title',
|
||||
'weight' => 90,
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_tta_section', array(
|
||||
'param_name' => 'tab_id',
|
||||
'weight' => 80,
|
||||
)
|
||||
);
|
||||
vc_add_params(
|
||||
'vc_tta_section', array(
|
||||
array(
|
||||
'param_name' => 'active',
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Show this section after page loading', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['active'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['active'],
|
||||
'weight' => 70,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'indents',
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Stretch this section content to the full available area', 'us' ) => 'none' ),
|
||||
( ( $config['atts']['indents'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['indents'],
|
||||
'weight' => 60,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'icon',
|
||||
'heading' => __( 'Icon', 'us' ),
|
||||
'type' => 'us_icon',
|
||||
'std' => $config['atts']['icon'],
|
||||
'weight' => 50,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'i_position',
|
||||
'heading' => __( 'Icon Position', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
__( 'Before title', 'us' ) => 'left',
|
||||
__( 'After title', 'us' ) => 'right',
|
||||
),
|
||||
'std' => $config['atts']['i_position'],
|
||||
'weight' => 40,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'bg_color',
|
||||
'heading' => __( 'Background Color', 'us' ),
|
||||
'type' => 'colorpicker',
|
||||
'value' => '',
|
||||
'std' => $config['atts']['bg_color'],
|
||||
'holder' => 'div',
|
||||
'weight' => 30,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'text_color',
|
||||
'heading' => __( 'Text Color', 'us' ),
|
||||
'type' => 'colorpicker',
|
||||
'value' => '',
|
||||
'std' => $config['atts']['text_color'],
|
||||
'holder' => 'div',
|
||||
'weight' => 20,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Modifying shortcode: vc_tta_tabs
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*
|
||||
* @param $config ['atts'] array Shortcode's attributes and default values
|
||||
*/
|
||||
|
||||
$misc = us_config( 'elements_misc' );
|
||||
|
||||
if ( version_compare( WPB_VC_VERSION, '4.6', '<' ) ) {
|
||||
// Oops: the modified shorcode doesn't exist in current VC version. Doing nothing.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! vc_is_page_editable() ) {
|
||||
vc_remove_param( 'vc_tta_tabs', 'title' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'style' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'shape' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'color' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'no_fill_content_area' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'spacing' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'gap' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'tab_position' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'alignment' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'autoplay' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'active_section' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'pagination_style' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'pagination_color' );
|
||||
vc_remove_param( 'vc_tta_tabs', 'css_animation' );
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_tta_tabs', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 10,
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_tta_tabs', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
vc_add_params(
|
||||
'vc_tta_tabs', array(
|
||||
array(
|
||||
'param_name' => 'layout',
|
||||
'heading' => us_translate( 'Layout' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
__( 'Simple', 'us' ) => 'default',
|
||||
__( 'Modern', 'us' ) => 'modern',
|
||||
__( 'Trendy', 'us' ) => 'trendy',
|
||||
__( 'Timeline', 'us' ) => 'timeline',
|
||||
),
|
||||
'std' => $config['atts']['layout'],
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 180,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'stretch',
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Stretch tabs to the full available width', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['stretch'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['stretch'],
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 170,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_font',
|
||||
'heading' => __( 'Font', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array_flip( us_get_fonts( 'without_groups' ) ),
|
||||
'std' => $config['atts']['title_font'],
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 160,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_weight',
|
||||
'heading' => __( 'Font Weight', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Default' ) => '',
|
||||
'100 ' . __( 'thin', 'us' ) => '100',
|
||||
'200 ' . __( 'extra-light', 'us' ) => '200',
|
||||
'300 ' . __( 'light', 'us' ) => '300',
|
||||
'400 ' . __( 'normal', 'us' ) => '400',
|
||||
'500 ' . __( 'medium', 'us' ) => '500',
|
||||
'600 ' . __( 'semi-bold', 'us' ) => '600',
|
||||
'700 ' . __( 'bold', 'us' ) => '700',
|
||||
'800 ' . __( 'extra-bold', 'us' ) => '800',
|
||||
'900 ' . __( 'ultra-bold', 'us' ) => '900',
|
||||
),
|
||||
'std' => $config['atts']['title_weight'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 142,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_transform',
|
||||
'heading' => __( 'Text Transform', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Default' ) => '',
|
||||
us_translate( 'None' ) => 'none',
|
||||
'UPPERCASE' => 'uppercase',
|
||||
'lowercase' => 'lowercase',
|
||||
'Capitalize' => 'capitalize',
|
||||
),
|
||||
'std' => $config['atts']['title_transform'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 142,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_size',
|
||||
'heading' => __( 'Font Size', 'us' ),
|
||||
'description' => $misc['desc_font_size'],
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['title_size'],
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 140,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_tag',
|
||||
'heading' => __( 'Sections Title HTML tag', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => $misc['html_tag_values'],
|
||||
'std' => $config['atts']['title_tag'],
|
||||
'weight' => 130,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Setting proper shortcode order in VC shortcodes listing
|
||||
vc_map_update( 'vc_tta_tabs', array( 'weight' => 320 ) );
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Modifying shortcode: vc_tta_tour
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*
|
||||
* @param $config ['atts'] array Shortcode's attributes and default values
|
||||
*/
|
||||
|
||||
$misc = us_config( 'elements_misc' );
|
||||
|
||||
if ( version_compare( WPB_VC_VERSION, '4.6', '<' ) ) {
|
||||
// Oops: the modified shorcode doesn't exist in current VC version. Doing nothing.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! vc_is_page_editable() ) {
|
||||
vc_remove_param( 'vc_tta_tour', 'title' );
|
||||
vc_remove_param( 'vc_tta_tour', 'style' );
|
||||
vc_remove_param( 'vc_tta_tour', 'shape' );
|
||||
vc_remove_param( 'vc_tta_tour', 'color' );
|
||||
vc_remove_param( 'vc_tta_tour', 'no_fill_content_area' );
|
||||
vc_remove_param( 'vc_tta_tour', 'spacing' );
|
||||
vc_remove_param( 'vc_tta_tour', 'gap' );
|
||||
vc_remove_param( 'vc_tta_tour', 'tab_position' );
|
||||
vc_remove_param( 'vc_tta_tour', 'alignment' );
|
||||
vc_remove_param( 'vc_tta_tour', 'controls_size' );
|
||||
vc_remove_param( 'vc_tta_tour', 'autoplay' );
|
||||
vc_remove_param( 'vc_tta_tour', 'active_section' );
|
||||
vc_remove_param( 'vc_tta_tour', 'pagination_style' );
|
||||
vc_remove_param( 'vc_tta_tour', 'pagination_color' );
|
||||
vc_remove_param( 'vc_tta_tour', 'css_animation' );
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_tta_tour', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 10,
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_tta_tour', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
vc_add_params(
|
||||
'vc_tta_tour', array(
|
||||
array(
|
||||
'param_name' => 'tab_position',
|
||||
'heading' => __( 'Position', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Left' ) => 'left',
|
||||
us_translate( 'Right' ) => 'right',
|
||||
),
|
||||
'std' => $config['atts']['tab_position'],
|
||||
'edit_field_class' => 'vc_col-sm-4',
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 170,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'c_align',
|
||||
'heading' => us_translate( 'Alignment' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Left' ) => 'left',
|
||||
us_translate( 'Center' ) => 'center',
|
||||
us_translate( 'Right' ) => 'right',
|
||||
),
|
||||
'std' => $config['atts']['c_align'],
|
||||
'edit_field_class' => 'vc_col-sm-4',
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 160,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'controls_size',
|
||||
'heading' => us_translate( 'Width' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate_x( 'Auto', 'auto preload' ) => 'auto',
|
||||
'10%' => '10',
|
||||
'20%' => '20',
|
||||
'30%' => '30',
|
||||
'40%' => '40',
|
||||
'50%' => '50',
|
||||
),
|
||||
'std' => $config['atts']['controls_size'],
|
||||
'edit_field_class' => 'vc_col-sm-4',
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 150,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_font',
|
||||
'heading' => __( 'Font', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array_flip( us_get_fonts( 'without_groups' ) ),
|
||||
'std' => $config['atts']['title_font'],
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 140,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_weight',
|
||||
'heading' => __( 'Font Weight', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Default' ) => '',
|
||||
'100 ' . __( 'thin', 'us' ) => '100',
|
||||
'200 ' . __( 'extra-light', 'us' ) => '200',
|
||||
'300 ' . __( 'light', 'us' ) => '300',
|
||||
'400 ' . __( 'normal', 'us' ) => '400',
|
||||
'500 ' . __( 'medium', 'us' ) => '500',
|
||||
'600 ' . __( 'semi-bold', 'us' ) => '600',
|
||||
'700 ' . __( 'bold', 'us' ) => '700',
|
||||
'800 ' . __( 'extra-bold', 'us' ) => '800',
|
||||
'900 ' . __( 'ultra-bold', 'us' ) => '900',
|
||||
),
|
||||
'std' => $config['atts']['title_weight'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 130,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_transform',
|
||||
'heading' => __( 'Text Transform', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Default' ) => '',
|
||||
us_translate( 'None' ) => 'none',
|
||||
'UPPERCASE' => 'uppercase',
|
||||
'lowercase' => 'lowercase',
|
||||
'Capitalize' => 'capitalize',
|
||||
),
|
||||
'std' => $config['atts']['title_transform'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 125,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_size',
|
||||
'heading' => __( 'Font Size', 'us' ),
|
||||
'description' => $misc['desc_font_size'],
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['title_size'],
|
||||
'group' => us_translate( 'Tabs', 'js_composer' ),
|
||||
'weight' => 120,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'title_tag',
|
||||
'heading' => __( 'Sections Title HTML tag', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => $misc['html_tag_values'],
|
||||
'std' => $config['atts']['title_tag'],
|
||||
'weight' => 110,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Setting proper shortcode order in VC shortcodes listing
|
||||
vc_map_update( 'vc_tta_tour', array( 'weight' => 300 ) );
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Modifying shortcode: vc_video
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*
|
||||
* @param $config ['atts'] array Shortcode's attributes and default values
|
||||
*/
|
||||
|
||||
$misc = us_config( 'elements_misc' );
|
||||
|
||||
vc_remove_param( 'vc_video', 'title' );
|
||||
vc_remove_param( 'vc_video', 'el_width' );
|
||||
vc_remove_param( 'vc_video', 'el_aspect' );
|
||||
vc_remove_param( 'vc_video', 'css_animation' );
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_video', array(
|
||||
'param_name' => 'el_class',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 10,
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
vc_update_shortcode_param(
|
||||
'vc_video', array(
|
||||
'param_name' => 'el_id',
|
||||
'description' => '',
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'group' => us_translate( 'Design Options', 'js_composer' ),
|
||||
)
|
||||
);
|
||||
|
||||
vc_add_params(
|
||||
'vc_video', array(
|
||||
array(
|
||||
'param_name' => 'link',
|
||||
'heading' => __( 'Video link', 'us' ),
|
||||
'description' => sprintf( __( 'Check supported formats on %s', 'us' ), '<a href="http://codex.wordpress.org/Embeds#Okay.2C_So_What_Sites_Can_I_Embed_From.3F" target="_blank">WordPress Codex</a>' ),
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['link'],
|
||||
'admin_label' => TRUE,
|
||||
'weight' => 60,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'hide_controls',
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Hide YouTube controls while watching', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['hide_controls'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['hide_controls'],
|
||||
'weight' => 52,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'hide_video_title',
|
||||
'type' => 'checkbox',
|
||||
'value' => array( __( 'Hide Vimeo video title (only if the owner allows)', 'us' ) => TRUE ),
|
||||
( ( $config['atts']['hide_video_title'] !== FALSE ) ? 'std' : '_std' ) => $config['atts']['hide_video_title'],
|
||||
'weight' => 53,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'ratio',
|
||||
'heading' => __( 'Aspect Ratio', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
'21:9' => '21x9',
|
||||
'16:9' => '16x9',
|
||||
'4:3' => '4x3',
|
||||
'3:2' => '3x2',
|
||||
'1:1' => '1x1',
|
||||
),
|
||||
'std' => $config['atts']['ratio'],
|
||||
'weight' => 50,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'max_width',
|
||||
'heading' => __( 'Max Width in pixels', 'us' ),
|
||||
'description' => $misc['desc_width'],
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['max_width'],
|
||||
'admin_label' => TRUE,
|
||||
'weight' => 40,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'align',
|
||||
'heading' => __( 'Video Alignment', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'value' => array(
|
||||
us_translate( 'Left' ) => 'left',
|
||||
us_translate( 'Center' ) => 'center',
|
||||
us_translate( 'Right' ) => 'right',
|
||||
),
|
||||
'std' => $config['atts']['align'],
|
||||
'dependency' => array( 'element' => 'max_width', 'not_empty' => TRUE ),
|
||||
'weight' => 30,
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Modifying shortcode: vc_wp_custommenu
|
||||
*
|
||||
* @var $shortcode string Current shortcode name
|
||||
* @var $config array Shortcode's config
|
||||
*
|
||||
* @param $config ['atts'] array Shortcode's attributes and default values
|
||||
*/
|
||||
|
||||
$misc = us_config( 'elements_misc' );
|
||||
|
||||
vc_update_shortcode_param(
|
||||
'vc_wp_custommenu', array(
|
||||
'param_name' => 'title',
|
||||
'weight' => 50,
|
||||
)
|
||||
);
|
||||
|
||||
vc_add_params(
|
||||
'vc_wp_custommenu', array(
|
||||
array(
|
||||
'param_name' => 'layout',
|
||||
'heading' => __( 'Layout', 'us' ),
|
||||
'type' => 'dropdown',
|
||||
'admin_label' => TRUE,
|
||||
'value' => array(
|
||||
__( 'Vertical', 'us' ) => 'ver',
|
||||
__( 'Horizontal', 'us' ) => 'hor',
|
||||
),
|
||||
'std' => $config['atts']['layout'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 40,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'align',
|
||||
'heading' => us_translate( 'Alignment' ),
|
||||
'type' => 'dropdown',
|
||||
'admin_label' => TRUE,
|
||||
'value' => array(
|
||||
us_translate( 'Left' ) => 'left',
|
||||
us_translate( 'Center' ) => 'center',
|
||||
us_translate( 'Right' ) => 'right',
|
||||
),
|
||||
'std' => $config['atts']['align'],
|
||||
'edit_field_class' => 'vc_col-sm-6',
|
||||
'weight' => 30,
|
||||
),
|
||||
array(
|
||||
'param_name' => 'font_size',
|
||||
'heading' => __( 'Font Size', 'us' ),
|
||||
'description' => $misc['desc_font_size'],
|
||||
'type' => 'textfield',
|
||||
'std' => $config['atts']['font_size'],
|
||||
'weight' => 20,
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
return array(
|
||||
array(
|
||||
'name' => 'Fullwidth Accordion Sections',
|
||||
'content' => '[vc_row height="auto" width="full"][vc_column width="1/1"][vc_tta_accordion c_align="center"][vc_tta_section title="Targeted Branding" icon="fa-bullseye"][vc_row_inner][vc_column_inner width="1/3"][us_iconbox icon="fa-globe" color="light" iconpos="left" title="Set Goals" external="" style="circle" link=""]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet ut elit tellus.[/us_iconbox][/vc_column_inner][vc_column_inner width="1/3"][us_iconbox icon="fa-plane" color="light" iconpos="left" title="Reach" style="circle"]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet ut elit tellus.[/us_iconbox][/vc_column_inner][vc_column_inner width="1/3"][us_iconbox icon="fa-repeat" color="light" iconpos="left" title="Repeat" style="circle"]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet ut elit tellus.[/us_iconbox][/vc_column_inner][/vc_row_inner][/vc_tta_section][vc_tta_section title="Geolocating Features" icon="fa-map-marker"][vc_row_inner][vc_column_inner width="1/2"][vc_column_text]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi non enim suscipit, dignissim diam at, laoreet eros. Aenean vitae orci nisi. Curabitur luctus ligula vel orci bibendum accumsan. Fusce ac tortor quis nisl posuere accumsan ut sit amet nisl. Pellentesque quis ultricies lacus, et lobortis libero. Quisque consectetur euismod egestas. Praesent hendrerit fringilla.
|
||||
|
||||
Donec id mattis velit. Vivamus viverra, erat tempus commodo sagittis, nibh arcu varius enim, sit amet congue eros magna dictum nibh. Praesent tristique lectus sed lorem scelerisque, vel vestibulum tortor varius. Vivamus vestibulum nisl mauris, nec bibendum eros vulputate vitae. Donec rutrum sem ut mi tempor suscipit id quam tristique auctor.[/vc_column_text][/vc_column_inner][vc_column_inner width="1/2"][vc_column_text]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi non enim suscipit, dignissim diam at, laoreet eros. Aenean vitae orci nisi. Curabitur luctus ligula vel orci bibendum accumsan. Fusce ac tortor quis nisl posuere accumsan ut sit amet nisl. Pellentesque quis ultricies lacus, et lobortis libero. Quisque consectetur euismod egestas. Praesent hendrerit fringilla.
|
||||
|
||||
Donec id mattis velit. Vivamus viverra, erat tempus commodo sagittis, nibh arcu varius enim, sit amet congue eros magna dictum nibh. Praesent tristique lectus sed lorem scelerisque, vel vestibulum tortor varius. Vivamus vestibulum nisl mauris, nec bibendum eros vulputate vitae. Donec rutrum sem ut mi tempor suscipit id quam tristique auctor.[/vc_column_text][/vc_column_inner][/vc_row_inner][/vc_tta_section][vc_tta_section title="Marketing Strategy" icon="fa-diamond"][vc_row_inner][vc_column_inner width="1/3"][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[/vc_column_text][/vc_column_inner][vc_column_inner width="1/3"][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[/vc_column_text][/vc_column_inner][vc_column_inner width="1/3"][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[/vc_column_text][/vc_column_inner][/vc_row_inner][/vc_tta_section][/vc_tta_accordion][/vc_column][/vc_row]',
|
||||
),
|
||||
array(
|
||||
'name' => '3 Boxes Features Columns',
|
||||
'content' => '[vc_row columns_type="1" height="auto" width="full"][vc_column width="1/3" css=".vc_custom_1426762592726{background-image: url() !important;background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;}" text_color="#ffffff"][vc_column_text]
|
||||
<h3>Fully Featured & Flexible</h3>
|
||||
I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[/vc_column_text][us_btn text="Tell me more" color="white" style="outlined" link="url:%23"][/vc_column][vc_column width="1/3" text_color="#ffffff" css=".vc_custom_1426688097558{background-image: url() !important;background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;}"][vc_column_text]
|
||||
<h3>Modern Design & Trendy Look</h3>
|
||||
I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[/vc_column_text][us_btn text="Tell me more" color="white" style="outlined" link="url:%23"][/vc_column][vc_column width="1/3" text_color="#ffffff" css=".vc_custom_1426688491496{background-image: url() !important;background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;}"][vc_column_text]
|
||||
<h3>Wonderful Digital Things</h3>
|
||||
I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[/vc_column_text][us_btn text="Tell me more" color="white" style="outlined" link="url:%23"][/vc_column][/vc_row]',
|
||||
),
|
||||
array(
|
||||
'name' => 'Hero Section 1',
|
||||
'content' => '[vc_row height="huge" color_scheme="secondary" us_bg_image="66" us_bg_parallax="vertical"][vc_column el_class="align_center"][vc_custom_heading text="THINK LIKE A
|
||||
<strong>CUSTOMER</strong>" font_container="tag:h2|font_size:60|text_align:center" use_theme_fonts="yes"][us_btn text="More Info" color="white"][us_btn text="Purchase"][/vc_column][/vc_row]',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* polylang Support
|
||||
*
|
||||
* @link https://polylang.pro/
|
||||
*/
|
||||
|
||||
if (! (function_exists ( 'pll_languages_list' ))) {
|
||||
return;
|
||||
}
|
||||
if ( pll_current_language() != pll_default_language() ) {
|
||||
global $pagenow;
|
||||
// Exception: do not add class on Theme Options page
|
||||
if ( ! ( ( $pagenow == 'admin.php' ) AND ( $_GET['page'] == 'us-theme-options' ) ) ) {
|
||||
function us_admin_add_wpml_nondefault_class( $class ) {
|
||||
return $class . ' us_wpml_non_default';
|
||||
}
|
||||
|
||||
add_filter( 'admin_body_class', 'us_admin_add_wpml_nondefault_class' );
|
||||
} else {
|
||||
// For Theme Options page adding redirect to default language
|
||||
wp_redirect( admin_url() . 'admin.php?page=us-theme-options&lang=' . pll_default_language() );
|
||||
}
|
||||
}
|
||||
function cpt__labels ( $cpts ) {
|
||||
$args = array(
|
||||
'public' => TRUE,
|
||||
'publicly_queryable' => TRUE,
|
||||
'_builtin' => FALSE,
|
||||
);
|
||||
$types = get_post_types( $args, 'objects' );
|
||||
if ( ! empty ( $types ) AND function_exists ( 'pll_register_string' )) {
|
||||
foreach ( $types as $type ){
|
||||
pll_register_string ( 'themes' , $type->name );
|
||||
pll_register_string ( 'themes' , $type->label );
|
||||
if ( ! empty ( $type->description )) {
|
||||
pll_register_string ( 'themes' , $type->description);
|
||||
}
|
||||
foreach ( $type->labels as $label ) {
|
||||
pll_register_string ( 'themes' , $label );
|
||||
}
|
||||
}
|
||||
}
|
||||
return $cpts ;
|
||||
}
|
||||
|
||||
add_action('init', 'cpt__labels');
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Revolution Slider Support
|
||||
*
|
||||
* @link http://codecanyon.net/item/slider-revolution-responsive-wordpress-plugin/2751380?ref=UpSolution
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'RevSliderFront' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( function_exists( 'set_revslider_as_theme' ) ) {
|
||||
if ( ! defined( 'REV_SLIDER_AS_THEME' ) ) {
|
||||
define( 'REV_SLIDER_AS_THEME', TRUE );
|
||||
}
|
||||
set_revslider_as_theme();
|
||||
}
|
||||
// Actually the revslider's code above doesn't work as expected, so turning off the notifications manually
|
||||
if ( get_option( 'revslider-valid-notice', 'true' ) != 'false' ) {
|
||||
update_option( 'revslider-valid-notice', 'false' );
|
||||
}
|
||||
if ( get_option( 'revslider-notices', array() ) != array() ) {
|
||||
update_option( 'revslider-notices', array() );
|
||||
}
|
||||
// Remove plugins page notices
|
||||
if ( $pagenow == 'plugins.php' ) {
|
||||
remove_action( 'admin_notices', array( 'RevSliderAdmin', 'add_plugins_page_notices' ) );
|
||||
}
|
||||
|
||||
// Move js for Admin Bar lower so it is not echoed before jquery core in footer
|
||||
add_action( 'wp_enqueue_scripts', 'us_move_revslider_js_footer' );
|
||||
function us_move_revslider_js_footer() {
|
||||
remove_action( 'wp_footer', array( 'RevSliderFront', 'putAdminBarMenus' ) );
|
||||
add_action( 'wp_footer', array( 'RevSliderFront', 'putAdminBarMenus' ), 99 );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'us_include_revslider_js_for_row_bg', 5 );
|
||||
function us_include_revslider_js_for_row_bg() {
|
||||
$operations = new RevSliderOperations();
|
||||
$arrValues = $operations->getGeneralSettingsValues();
|
||||
|
||||
$strPutIn = RevSliderFunctions::getVal( $arrValues, "pages_for_includes" );
|
||||
|
||||
$isPutIn = RevSliderOutput::isPutIn( $strPutIn, TRUE );
|
||||
$includesGlobally = RevSliderFunctions::getVal( $arrValues, "includes_globally", "on" );
|
||||
|
||||
if ( $isPutIn == FALSE AND $includesGlobally == "off" ) {
|
||||
$post_content = '';
|
||||
$page_blocks_content = us_get_current_page_block_content();
|
||||
if ( is_singular() ) {
|
||||
$post = get_post( get_the_ID() );
|
||||
$post_content = $post->post_content;
|
||||
}
|
||||
|
||||
if ( ( $post_content != '' AND stripos( $post_content, 'us_bg_slider=' ) !== FALSE ) OR ( $page_blocks_content != '' AND ( stripos( $page_blocks_content, 'us_bg_slider=' ) !== FALSE OR stripos( $page_blocks_content, '[rev_slider' ) !== FALSE ) ) ) {
|
||||
add_filter( 'revslider_include_libraries', '__return_true' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* TablePress Support
|
||||
*
|
||||
* @link https://tablepress.org/
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'TablePress' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'us_dequeue_tablepress_default', 15 );
|
||||
|
||||
function us_dequeue_tablepress_default() {
|
||||
wp_dequeue_style( 'tablepress-default' );
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* The Events Calendar Support
|
||||
*
|
||||
* @link https://theeventscalendar.com/
|
||||
*/
|
||||
|
||||
if ( function_exists( 'tribe_get_option' ) ) {
|
||||
$style_option = tribe_get_option( 'stylesheetOption', 'tribe' );
|
||||
if ( $style_option == 'skeleton' ) {
|
||||
add_action( 'wp_enqueue_scripts', 'us_dequeue_the_events_calendar_skeleton', 14 );
|
||||
}
|
||||
}
|
||||
|
||||
function us_dequeue_the_events_calendar_skeleton() {
|
||||
wp_dequeue_style( 'tribe-events-bootstrap-datepicker-css' );
|
||||
wp_deregister_style( 'tribe-events-bootstrap-datepicker-css' );
|
||||
|
||||
wp_dequeue_style( 'tribe-events-custom-jquery-styles' );
|
||||
wp_deregister_style( 'tribe-events-custom-jquery-styles' );
|
||||
|
||||
wp_dequeue_style( 'tribe-accessibility-css' );
|
||||
wp_deregister_style( 'tribe-accessibility-css' );
|
||||
|
||||
wp_dequeue_style( 'tribe-events-calendar-style' );
|
||||
wp_deregister_style( 'tribe-events-calendar-style' );
|
||||
|
||||
if ( ! ( defined( 'US_DEV' ) AND US_DEV ) AND us_get_option( 'optimize_assets', 0 ) == 0 ) {
|
||||
global $us_template_directory_uri;
|
||||
$min_ext = ( ! ( defined( 'US_DEV' ) AND US_DEV ) ) ? '.min' : '';
|
||||
wp_register_style( 'us-tribe-events', $us_template_directory_uri . '/css/plugins/tribe-events' . $min_ext . '.css', array(), US_THEMEVERSION, 'all' );
|
||||
wp_enqueue_style( 'us-tribe-events' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* TinyMCE Support
|
||||
*
|
||||
* @link https://www.tinymce.com
|
||||
*/
|
||||
|
||||
function us_tiny_mce_color_pickers( $init ) {
|
||||
|
||||
$palette = get_option( 'usof_color_palette_' . US_THEMENAME );
|
||||
|
||||
$custom_colours = '';
|
||||
if ( is_array( $palette ) AND ! empty( $palette ) ) {
|
||||
foreach ( $palette as $color ) {
|
||||
$color = us_rgba2hex( $color );
|
||||
$color = substr( $color, 1 );
|
||||
if ( $color == '000000' OR $color == 'ffffff' ) {
|
||||
continue;
|
||||
}
|
||||
$custom_colours .= "\"$color\", \"#$color\",";
|
||||
}
|
||||
}
|
||||
|
||||
$default_colors = '
|
||||
"000000", "Black",
|
||||
"993300", "Burnt orange",
|
||||
"333300", "Dark olive",
|
||||
"003300", "Dark green",
|
||||
"003366", "Dark azure",
|
||||
"000080", "Navy Blue",
|
||||
"333399", "Indigo",
|
||||
"333333", "Very dark gray",
|
||||
"800000", "Maroon",
|
||||
"FF6600", "Orange",
|
||||
"808000", "Olive",
|
||||
"008000", "Green",
|
||||
"008080", "Teal",
|
||||
"0000FF", "Blue",
|
||||
"666699", "Grayish blue",
|
||||
"808080", "Gray",
|
||||
"FF0000", "Red",
|
||||
"FF9900", "Amber",
|
||||
"99CC00", "Yellow green",
|
||||
"339966", "Sea green",
|
||||
"33CCCC", "Turquoise",
|
||||
"3366FF", "Royal blue",
|
||||
"800080", "Purple",
|
||||
"999999", "Medium gray",
|
||||
"FF00FF", "Magenta",
|
||||
"FFCC00", "Gold",
|
||||
"FFFF00", "Yellow",
|
||||
"00FF00", "Lime",
|
||||
"00FFFF", "Aqua",
|
||||
"00CCFF", "Sky blue",
|
||||
"993366", "Red violet",
|
||||
"FFFFFF", "White",
|
||||
"FF99CC", "Pink",
|
||||
"FFCC99", "Peach",
|
||||
"FFFF99", "Light yellow",
|
||||
"CCFFCC", "Pale green",
|
||||
"CCFFFF", "Pale cyan",
|
||||
"99CCFF", "Light sky blue",
|
||||
"CC99FF", "Plum"
|
||||
';
|
||||
|
||||
$init['textcolor_map'] = '[' . $custom_colours . $default_colors . ']';
|
||||
$init['textcolor_rows'] = 6;
|
||||
|
||||
return $init;
|
||||
}
|
||||
|
||||
add_filter( 'tiny_mce_before_init', 'us_tiny_mce_color_pickers' );
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* Header Builder support
|
||||
*
|
||||
* Show alert message when the plugin version is not compatible with the current theme version
|
||||
*/
|
||||
|
||||
if ( defined( 'US_HB_VERSION' ) AND version_compare( US_HB_VERSION, '2.5', '<' ) ) {
|
||||
|
||||
add_filter( 'us_config_theme-options', 'us_remove_old_ushb_options' );
|
||||
function us_remove_old_ushb_options( $config ) {
|
||||
if ( is_admin() ) {
|
||||
unset( $config['header'] );
|
||||
unset( $config['hb'] );
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
add_action( 'admin_notices', 'us_update_ushb_notice', 1 );
|
||||
function us_update_ushb_notice() {
|
||||
$output = '<div class="error us-migration for-hb">';
|
||||
$output .= '<h2>Update Header Builder</h2>';
|
||||
$output .= '<p>For correct work of your website header you need to update "Header Builder" on the <a href="' . admin_url( 'plugins.php' ) . '">Plugins page</a>.<br>If you don\'t see the update notification there, just delete "Header Builder" plugin and install it again via ' . US_THEMENAME . ' > Addons page.</p>';
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* The Template for displaying product archives, including the main shop page which is a post type archive
|
||||
*
|
||||
* Required for "Content template" option
|
||||
*/
|
||||
|
||||
get_header( 'shop' );
|
||||
|
||||
?>
|
||||
<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' ) );
|
||||
}
|
||||
|
||||
us_load_template( 'templates/content' );
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
// AFTER wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'after' ) );
|
||||
}
|
||||
|
||||
?>
|
||||
</main>
|
||||
<?php
|
||||
|
||||
get_footer( 'shop' );
|
||||
@@ -0,0 +1,324 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* WooCommerce Theme Support
|
||||
*
|
||||
* @link http://www.woothemes.com/woocommerce/
|
||||
*/
|
||||
|
||||
add_action( 'after_setup_theme', 'us_woocommerce_support' );
|
||||
function us_woocommerce_support() {
|
||||
add_theme_support(
|
||||
'woocommerce', array(
|
||||
'gallery_thumbnail_image_width' => 150, // changed gallery thumbnail size to default WP 'thumbnail'
|
||||
)
|
||||
);
|
||||
if ( in_array( 'zoom', us_get_option( 'product_gallery', array() ) ) ) {
|
||||
add_theme_support( 'wc-product-gallery-zoom' );
|
||||
}
|
||||
if ( in_array( 'lightbox', us_get_option( 'product_gallery', array() ) ) ) {
|
||||
add_theme_support( 'wc-product-gallery-lightbox' );
|
||||
}
|
||||
if ( in_array( 'slider', us_get_option( 'product_gallery', array() ) ) ) {
|
||||
add_theme_support( 'wc-product-gallery-slider' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'woocommerce' ) ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Change size of "Product gallery" thumbnails, when "Slider" is OFF, for showing like 1 column gallery
|
||||
if ( ! in_array( 'slider', us_get_option( 'product_gallery', array() ) ) ) {
|
||||
add_filter( 'woocommerce_gallery_thumbnail_size', 'us_woocommerce_gallery_thumbnail_size' );
|
||||
function us_woocommerce_gallery_thumbnail_size() {
|
||||
return 'woocommerce_single';
|
||||
}
|
||||
}
|
||||
|
||||
// Disable WooCommerce front CSS
|
||||
add_filter( 'woocommerce_enqueue_styles', '__return_false' );
|
||||
|
||||
// Disable select2 CSS on Checkout page
|
||||
add_action( 'wp_enqueue_scripts', 'us_woocomerce_dequeue_checkout_styles', 100 );
|
||||
function us_woocomerce_dequeue_checkout_styles() {
|
||||
wp_dequeue_style( 'select2' );
|
||||
wp_deregister_style( 'select2' );
|
||||
}
|
||||
|
||||
// Enqueue theme CSS
|
||||
if ( ! ( defined( 'US_DEV' ) AND US_DEV ) AND us_get_option( 'optimize_assets', 0 ) == 0 ) {
|
||||
add_action( 'wp_enqueue_scripts', 'us_woocommerce_enqueue_styles', 14 );
|
||||
}
|
||||
function us_woocommerce_enqueue_styles( $styles ) {
|
||||
global $us_template_directory_uri;
|
||||
$min_ext = ( ! ( defined( 'US_DEV' ) AND US_DEV ) ) ? '.min' : '';
|
||||
wp_enqueue_style( 'us-woocommerce', $us_template_directory_uri . '/css/plugins/woocommerce' . $min_ext . '.css', array(), US_THEMEVERSION, 'all' );
|
||||
}
|
||||
|
||||
// Add classes to <body> of WooCommerce pages
|
||||
add_action( 'body_class', 'us_wc_body_class' );
|
||||
function us_wc_body_class( $classes ) {
|
||||
$classes[] = 'us-woo-cart_' . us_get_option( 'shop_cart', 'standard' );
|
||||
if ( us_get_option( 'shop_catalog', 0 ) == 1 ) {
|
||||
$classes[] = 'us-woo-catalog';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/*
|
||||
*************** Adjust HTML markup for all WooCommerce pages ***************
|
||||
*/
|
||||
add_action( 'template_redirect', 'us_maybe_change_woocommerce_template_path' );
|
||||
function us_maybe_change_woocommerce_template_path() {
|
||||
if ( ( ( is_shop() OR is_product_tag() OR is_product_category() ) AND us_get_option( 'content_shop_id', '' ) != '' )
|
||||
OR ( is_product_category() AND us_get_option( 'content_tax_product_cat_id', '__defaults__' ) != '__defaults__' )
|
||||
OR ( is_product_tag() AND us_get_option( 'content_tax_product_tag_id', '__defaults__' ) != '__defaults__' ) ) {
|
||||
|
||||
add_filter( 'woocommerce_template_path', 'us_woocommerce_template_path' );
|
||||
function us_woocommerce_template_path() {
|
||||
return 'framework/plugins-support/woocommerce/';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
||||
if ( ! function_exists( 'us_woocommerce_before_main_content' ) ) {
|
||||
add_action( 'woocommerce_before_main_content', 'us_woocommerce_before_main_content', 10 );
|
||||
function us_woocommerce_before_main_content() {
|
||||
|
||||
$show_shop_section = TRUE;
|
||||
|
||||
if ( is_single() ) {
|
||||
$content_area_id = us_get_page_area_id( 'content' );
|
||||
if ( $content_area_id != '' AND get_post_status( $content_area_id ) != FALSE ) {
|
||||
$show_shop_section = FALSE;
|
||||
add_filter( 'wc_get_template_part', 'us_wc_get_template_part_content_single_product', 10, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
echo '<main class="l-main">';
|
||||
|
||||
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' ) );
|
||||
}
|
||||
|
||||
// Output content of Shop page in a first separate section
|
||||
if ( is_post_type_archive( 'product' ) AND ! is_search() AND 0 === absint( get_query_var( 'paged' ) ) ) {
|
||||
|
||||
$shop_page = get_post( wc_get_page_id( 'shop' ) );
|
||||
if ( $shop_page ) {
|
||||
$shop_page_content = apply_filters( 'the_content', $shop_page->post_content );
|
||||
if ( $shop_page_content ) {
|
||||
if ( strpos( $shop_page_content, ' class="l-section' ) === FALSE ) {
|
||||
$shop_page_content = '<section class="l-section for_shop_description"><div class="l-section-h i-cf">' . $shop_page_content . '</div></section>';
|
||||
}
|
||||
echo $shop_page_content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $show_shop_section ) {
|
||||
echo '<section id="shop" class="l-section for_shop">';
|
||||
echo '<div class="l-section-h i-cf">';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function us_wc_get_template_part_content_single_product( $template, $slug, $name = '' ) {
|
||||
if ( ! ( $slug == 'content' AND $name == 'single-product' ) ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
return us_locate_file( 'templates/content.php' );
|
||||
}
|
||||
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
||||
if ( ! function_exists( 'us_woocommerce_after_main_content' ) ) {
|
||||
add_action( 'woocommerce_after_main_content', 'us_woocommerce_after_main_content', 20 );
|
||||
function us_woocommerce_after_main_content() {
|
||||
$show_shop_section = TRUE;
|
||||
|
||||
if ( is_single() ) {
|
||||
$content_area_id = us_get_page_area_id( 'content' );
|
||||
if ( $content_area_id != '' AND get_post_status( $content_area_id ) != FALSE ) {
|
||||
$show_shop_section = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $show_shop_section ) {
|
||||
echo '</div></section>';
|
||||
}
|
||||
|
||||
if ( us_get_option( 'enable_sidebar_titlebar', 0 ) ) {
|
||||
// AFTER wrapper for Sidebar
|
||||
us_load_template( 'templates/sidebar', array( 'place' => 'after' ) );
|
||||
}
|
||||
echo '</main>';
|
||||
}
|
||||
}
|
||||
|
||||
// Change columns number on Shop page (from Theme Options > Shop)
|
||||
add_filter( 'loop_shop_columns', 'loop_columns' );
|
||||
if ( ! function_exists( 'loop_columns' ) ) {
|
||||
function loop_columns() {
|
||||
return us_get_option( 'shop_columns', 4 );
|
||||
}
|
||||
}
|
||||
|
||||
// Change items number on Shop page (from Theme Options > Shop)
|
||||
add_filter( 'loop_shop_per_page', 'us_loop_shop_per_page' );
|
||||
if ( ! function_exists( 'us_loop_shop_per_page' ) ) {
|
||||
function us_loop_shop_per_page() {
|
||||
return get_option( 'posts_per_page' );
|
||||
}
|
||||
}
|
||||
|
||||
// Change Related Products quantity (from Theme Options > Shop)
|
||||
function woo_related_products_limit() {
|
||||
global $product;
|
||||
|
||||
$args['posts_per_page'] = us_get_option( 'product_related_qty', 4 );
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
add_filter( 'woocommerce_output_related_products_args', 'us_related_products_args' );
|
||||
function us_related_products_args( $args ) {
|
||||
$args['posts_per_page'] = us_get_option( 'product_related_qty', 4 );
|
||||
$args['columns'] = us_get_option( 'product_related_qty', 4 );
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
// Change Cross-sells quantity (from Theme Options > Shop)
|
||||
add_filter( 'woocommerce_cross_sells_total', 'us_woocommerce_cross_sells_total' );
|
||||
add_filter( 'woocommerce_cross_sells_columns', 'us_woocommerce_cross_sells_total' );
|
||||
function us_woocommerce_cross_sells_total( $count ) {
|
||||
return us_get_option( 'product_related_qty', 4 );
|
||||
}
|
||||
|
||||
// Remove default woocommerce sidebar
|
||||
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
|
||||
|
||||
// Move cross sells bellow the shipping
|
||||
remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
|
||||
add_action( 'woocommerce_after_cart', 'woocommerce_cross_sell_display', 10 );
|
||||
|
||||
// Move breadcrumbs before product title on Products default template
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
|
||||
add_action( 'woocommerce_single_product_summary', 'woocommerce_breadcrumb', 3 );
|
||||
|
||||
// Alter Cart - add total number
|
||||
add_filter( 'woocommerce_add_to_cart_fragments', 'us_add_to_cart_fragments' );
|
||||
function us_add_to_cart_fragments( $fragments ) {
|
||||
global $woocommerce;
|
||||
|
||||
$fragments['a.cart-contents'] = '<a class="cart-contents" href="' . esc_url( wc_get_cart_url() ) . '">' . $woocommerce->cart->get_cart_total() . '</a>';
|
||||
|
||||
return $fragments;
|
||||
}
|
||||
|
||||
// Correct pagination
|
||||
if ( ! function_exists( 'woocommerce_pagination' ) ) {
|
||||
function woocommerce_pagination() {
|
||||
global $us_woo_disable_pagination;
|
||||
if ( isset( $us_woo_disable_pagination ) AND $us_woo_disable_pagination ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $wp_query;
|
||||
if ( $wp_query->max_num_pages <= 1 ) {
|
||||
return;
|
||||
}
|
||||
the_posts_pagination(
|
||||
array(
|
||||
'mid_size' => 3,
|
||||
'before_page_number' => '<span>',
|
||||
'after_page_number' => '</span>',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove focus state on Checkout page
|
||||
add_filter( 'woocommerce_checkout_fields', 'us_woocommerce_disable_autofocus_billing_firstname' );
|
||||
function us_woocommerce_disable_autofocus_billing_firstname( $fields ) {
|
||||
$fields['shipping']['shipping_first_name']['autofocus'] = FALSE;
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
// Wrap attributes <select> for better styling
|
||||
add_filter( 'woocommerce_dropdown_variation_attribute_options_html', 'us_woocommerce_dropdown_variation_attribute_options_html' );
|
||||
function us_woocommerce_dropdown_variation_attribute_options_html( $html ) {
|
||||
$html = '<div class="woocommerce-select">' . $html . '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
// Add amount of products in cart to show in Header element
|
||||
add_action( 'woocommerce_after_mini_cart', 'us_woocommerce_after_mini_cart' );
|
||||
function us_woocommerce_after_mini_cart() {
|
||||
global $woocommerce;
|
||||
|
||||
echo '<span class="us_mini_cart_amount" style="display: none;">' . $woocommerce->cart->cart_contents_count . '</span>';
|
||||
}
|
||||
|
||||
// Wrap "Add To Cart" button's text with placehoders.
|
||||
add_action( 'woocommerce_before_template_part', 'us_woocommerce_before_loop_add_to_cart_template_part', 10, 4 );
|
||||
function us_woocommerce_before_loop_add_to_cart_template_part( $template_name, $template_path, $located, $args ) {
|
||||
if ( $template_name == 'loop/add-to-cart.php' ) {
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'woocommerce_after_template_part', 'us_woocommerce_after_loop_add_to_cart_template_part', 10, 4 );
|
||||
function us_woocommerce_after_loop_add_to_cart_template_part( $template_name, $template_path, $located, $args ) {
|
||||
if ( $template_name == 'loop/add-to-cart.php' ) {
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
// Use placeholders instead of actual HTML semantics, because after this filter the esc_html() function is applied
|
||||
function us_add_to_cart_text( $text, $product ) {
|
||||
$text = '{{us_add_to_cart_start}}' . $text . '{{us_add_to_cart_end}}';
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
// Replace placeholders with actual HTML wrapper for "Add To Cart" buttons
|
||||
function us_add_to_cart_text_replace( $html, $product, $args ) {
|
||||
$html = str_replace( '{{us_add_to_cart_start}}', '<i class="g-preloader type_1"></i><span class="w-btn-label">', $html );
|
||||
$html = str_replace( '{{us_add_to_cart_end}}', '</span>', $html );
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
// Remove metaboxes from Shop page
|
||||
add_filter( 'us_config_meta-boxes', 'us_remove_meta_for_shop_page' );
|
||||
function us_remove_meta_for_shop_page( $config ) {
|
||||
$post_id = isset( $_GET['post'] ) ? intval( $_GET['post'] ) : NULL;
|
||||
if ( $post_id !== NULL AND $post_id == get_option( 'woocommerce_shop_page_id' ) ) {
|
||||
foreach ( $config as $metabox_key => $metabox ) {
|
||||
if ( $metabox['id'] == 'us_portfolio_settings' ) {
|
||||
unset( $config[ $metabox_key ] );
|
||||
}
|
||||
if ( $metabox['id'] == 'us_page_settings' ) {
|
||||
unset( $config[ $metabox_key ]['fields']['us_content_id'] );
|
||||
unset( $config[ $metabox_key ]['fields']['us_footer_id'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
|
||||
|
||||
/**
|
||||
* WPML Support
|
||||
*
|
||||
* @link https://wpml.org/
|
||||
*/
|
||||
|
||||
if ( ! ( class_exists( 'SitePress' ) AND defined( 'ICL_LANGUAGE_CODE' ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add class to body in admin pages in non-default language
|
||||
global $sitepress;
|
||||
$default_language = $sitepress->get_default_language();
|
||||
|
||||
if ( $default_language != ICL_LANGUAGE_CODE ) {
|
||||
global $pagenow;
|
||||
// Exception: do not add class on Theme Options page
|
||||
if ( ! ( ( $pagenow == 'admin.php' ) AND ( $_GET['page'] == 'us-theme-options' ) ) ) {
|
||||
function us_admin_add_wpml_nondefault_class( $class ) {
|
||||
return $class . ' us_wpml_non_default';
|
||||
}
|
||||
|
||||
add_filter( 'admin_body_class', 'us_admin_add_wpml_nondefault_class' );
|
||||
} else {
|
||||
// For Theme Options page adding redirect to default language
|
||||
wp_redirect( admin_url() . 'admin.php?page=us-theme-options&lang=' . $default_language );
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
// Remove select2 CSS to avoid overlapping with theme styles
|
||||
add_action( 'admin_init', 'us_dequeue_wpml_select2' );
|
||||
function us_dequeue_wpml_select2() {
|
||||
global $pagenow;
|
||||
|
||||
if ( ( ( $pagenow == 'admin.php' ) AND ( $_GET['page'] == 'us-theme-options' ) ) OR ( $pagenow === 'post.php' AND isset( $_GET['post'] ) AND ( get_post_type( $_GET['post'] ) === 'us_header' OR get_post_type( $_GET['post'] ) === 'us_grid_layout' ) ) ) {
|
||||
wp_dequeue_style( 'wpml-select-2' );
|
||||
}
|
||||
}
|
||||
|
||||
// Add support for encoded shortcodes
|
||||
add_filter( 'wpml_pb_shortcode_encode', 'wpml_pb_shortcode_encode_us_urlencoded_json', 10, 3 );
|
||||
function wpml_pb_shortcode_encode_us_urlencoded_json( $string, $encoding, $original_string ) {
|
||||
if ( $encoding !== 'us_urlencoded_json' ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
$output = array();
|
||||
foreach ( $original_string as $combined_key => $value ) {
|
||||
$parts = explode( '_', $combined_key );
|
||||
$i = array_pop( $parts );
|
||||
$key = implode( '_', $parts );
|
||||
$output[ $i ][ $key ] = $value;
|
||||
}
|
||||
|
||||
return urlencode( json_encode( $output ) );
|
||||
|
||||
}
|
||||
|
||||
add_filter( 'wpml_pb_shortcode_decode', 'wpml_pb_shortcode_decode_us_urlencoded_json', 10, 3 );
|
||||
function wpml_pb_shortcode_decode_us_urlencoded_json( $string, $encoding, $original_string ) {
|
||||
if ( $encoding !== 'us_urlencoded_json' ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
$fields_to_translate = array(
|
||||
'title',
|
||||
'label',
|
||||
'description',
|
||||
'placeholder',
|
||||
'price',
|
||||
'substring',
|
||||
'features',
|
||||
'btn_text',
|
||||
'btn_link',
|
||||
'image',
|
||||
'link',
|
||||
'url',
|
||||
);
|
||||
$rows = json_decode( urldecode( $original_string ), TRUE );
|
||||
$result = array();
|
||||
foreach ( $rows as $i => $row ) {
|
||||
foreach ( $row as $key => $value ) {
|
||||
if ( in_array( $key, $fields_to_translate ) ) {
|
||||
$result[ $key . '_' . $i ] = array( 'value' => $value, 'translate' => TRUE );
|
||||
} else {
|
||||
$result[ $key . '_' . $i ] = array( 'value' => $value, 'translate' => FALSE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user