This commit is contained in:
nguyen dung
2022-02-18 16:43:41 +07:00
commit 39b8cb3612
4470 changed files with 1378320 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
<?php
/**
* Display placeholder with tooltip message on header elements when they miss a resource.
*
* @param string $resource Name of the resource.
*/
function fl_header_element_error( $resource ) {
$title = '';
switch ( $resource ) {
case 'woocommerce':
$title = 'WooCommerce needed';
}
echo '<li><a class="element-error tooltip" title="' . esc_attr( $title ) . '">-</a></li>';
}
/**
* Get flatsome_breadcrumb hooked content.
*
* @param string|array $class One or more classes to add to the class list.
* @param bool $display Whether to display the breadcrumb (true) or return it (false).
*/
function flatsome_breadcrumb( $class = '', $display = true ) {
do_action( 'flatsome_breadcrumb', $class, $display );
}
/**
* Outputs the beginning markup of a sticky column.
*
* Outputs the markup directly if no theme modification name has been
* given. Else based on the return value of the mod.
*
* @param string $name Theme modification name.
*/
function flatsome_sticky_column_open( $name = '' ) {
if ( empty( $name ) || get_theme_mod( $name ) ) {
echo '<div class="is-sticky-column">';
echo '<div class="is-sticky-column__inner">';
}
}
/**
* Outputs the end markup of a sticky column.
*
* Outputs the markup directly if no theme modification name has been
* given. Else based on the return value of the mod.
*
* @param string $name Theme modification name.
*/
function flatsome_sticky_column_close( $name = '' ) {
if ( empty( $name ) || get_theme_mod( $name ) ) {
echo '</div></div>';
}
}
/**
* @deprecated 3.7
*/
function get_flatsome_breadcrumbs() {
_deprecated_function( __FUNCTION__, '3.7', 'flatsome_breadcrumb' );
flatsome_breadcrumb();
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* Flatsome Conditional Functions
*
* @author UX Themes
* @package Flatsome/Functions
*/
if ( ! function_exists( 'is_nextend_facebook_login' ) ) {
/**
* Returns true if Nextend facebook provider is enabled for v3
*
* @return bool
*/
function is_nextend_facebook_login() {
if ( class_exists( 'NextendSocialLogin', false ) && ! class_exists( 'NextendSocialLoginPRO', false ) ) {
return NextendSocialLogin::isProviderEnabled( 'facebook' );
}
return false;
}
}
if ( ! function_exists( 'is_nextend_google_login' ) ) {
/**
* Returns true if Nextend google provider is enabled for v3
*
* @return bool
*/
function is_nextend_google_login() {
if ( class_exists( 'NextendSocialLogin', false ) && ! class_exists( 'NextendSocialLoginPRO', false ) ) {
return NextendSocialLogin::isProviderEnabled( 'google' );
}
return false;
}
}
if ( ! function_exists( 'is_yith_wishlist_premium' ) ) {
/**
* Returns true if YITH Wishlist Premium is installed and free version is not activated.
*
* @return bool
*/
function is_yith_wishlist_premium() {
return ! defined( 'YITH_WCWL_FREE_INIT' ) && file_exists( WP_PLUGIN_DIR . '/yith-woocommerce-wishlist-premium/init.php' );
}
}
if ( ! function_exists( 'is_woocommerce_activated' ) ) {
/**
* Returns true if WooCommerce plugin is activated
*
* @return bool
*/
function is_woocommerce_activated() {
return class_exists( 'woocommerce' );
}
}
if ( ! function_exists( 'is_portfolio_activated' ) ) {
/**
* Returns "1" if Flatsome Portfolio option is enabled
*
* @return string
*/
function is_portfolio_activated() {
return get_theme_mod( 'fl_portfolio', 1 );
}
}
if ( ! function_exists( 'is_extension_activated' ) ) {
/**
* Returns true if extension is activated
*
* @param string $extension The class name. The name is matched in a case-insensitive manner.
* @param bool $autoload Whether or not to call __autoload by default.
*
* @return bool
*/
function is_extension_activated( $extension, $autoload = true ) {
return class_exists( $extension, $autoload );
}
}

View File

@@ -0,0 +1,686 @@
<?php
/* CUSTOM CSS */
function flatsome_custom_css() {
ob_start();
?>
<style id="custom-css" type="text/css">
:root {
--primary-color: <?php echo get_theme_mod('color_primary', Flatsome_Default::COLOR_PRIMARY ); ?>;
}
<?php
// Screen sizes
$small_screen = '550px';
$small_screen_max = '549px';
$medium_screen = '850px';
$medium_screen_max = '849px';
$admin_bar = 0;
if(is_admin_bar_showing()){
$admin_bar = 32;
}
// Layout backgrounds
if ( get_theme_mod( 'body_bg_image' ) ) echo 'html{background-image: url(\'' . get_theme_mod( 'body_bg_image' ) . '\');}';
if ( get_theme_mod( 'body_bg' ) ) echo 'html{background-color:' . get_theme_mod( 'body_bg' ) . '!important;}';
/* Site Width */
if(get_theme_mod('site_width')) {
$site_width = intval(get_theme_mod('site_width')); ?>
.full-width .ubermenu-nav, .container, .row{max-width: <?php echo $site_width - 30; ?>px}
.row.row-collapse{max-width: <?php echo $site_width - 60; ?>px}
.row.row-small{max-width: <?php echo $site_width - 37.5; ?>px}
.row.row-large{max-width: <?php echo $site_width; ?>px}
<?php } ?>
<?php if(get_theme_mod('body_layout') !== 'full-width' && get_theme_mod('site_width_boxed')){ ?>
body.framed, body.framed header, body.framed .header-wrapper, body.boxed, body.boxed header, body.boxed .header-wrapper, body.boxed .is-sticky-section{ max-width: <?php echo get_theme_mod('site_width_boxed'); ?>px
}
<?php } ?>
<?php
$content_bg = get_theme_mod('content_bg');
if($content_bg){ ?>
.sticky-add-to-cart--active, #wrapper,#main,#main.dark{background-color: <?php echo $content_bg; ?>}
<?php } ?>
<?php
$cookie_notice_bg_color = get_theme_mod( 'cookie_notice_bg_color' );
if ( $cookie_notice_bg_color ) { ?>
.flatsome-cookies {background-color: <?php echo $cookie_notice_bg_color; ?>}
<?php } ?>
<?php
$header_height = get_theme_mod('header_height', 90); ?>
.header-main{height: <?php echo $header_height; ?>px}
#logo img{max-height: <?php echo $header_height; ?>px}
#logo{width:<?php echo get_theme_mod('logo_width', 200); ?>px;}
<?php if(get_theme_mod('logo_padding')) echo '#logo img{padding:'.get_theme_mod('logo_padding').'px 0;}'; ?>
<?php if(get_theme_mod('logo_max_width')) echo '#logo a{max-width:'.get_theme_mod('logo_max_width').'px;}'; ?>
<?php if(get_theme_mod('sticky_logo_padding')) echo '.stuck #logo img{padding:'.get_theme_mod('sticky_logo_padding').'px 0;}'; ?>
<?php if(get_theme_mod('header_bottom_height')){ ?>
.header-bottom{min-height: <?php echo get_theme_mod('header_bottom_height'); ?>px}
<?php } ?>
.header-top{min-height: <?php echo get_theme_mod('header_top_height', 30); ?>px}
<?php $header_height_transparent = get_theme_mod( 'header_height_transparent', 90 ); ?>
.transparent .header-main{height: <?php echo $header_height_transparent; ?>px}
.transparent #logo img{max-height: <?php echo $header_height_transparent; ?>px}
<?php
$height = 0;
$height = $height + $header_height_transparent;
if(flatsome_has_top_bar()['large_or_mobile']) $height = $height + '30';
if(flatsome_has_bottom_bar()['large_or_mobile']) $height = $height + '50';
$mob_height = 0;
?>
.has-transparent + .page-title:first-of-type,
.has-transparent + #main > .page-title,
.has-transparent + #main > div > .page-title,
.has-transparent + #main .page-header-wrapper:first-of-type .page-title{
padding-top: <?php echo $height; ?>px;
}
<?php if(get_theme_mod('header_bg_transparent')){ ?>
.transparent .header-wrapper{background-color: <?php echo get_theme_mod('header_bg_transparent'); ?>!important;}
.transparent .top-divider{display: none;}
<?php } ?>
<?php
$header_height_sticky = get_theme_mod('header_height_sticky', 70); ?>
.header.show-on-scroll,
.stuck .header-main{height:<?php echo $header_height_sticky; ?>px!important}
.stuck #logo img{max-height: <?php echo $header_height_sticky; ?>px!important}
<?php if(get_theme_mod('header_search_width')){ ?>
.search-form{ width: <?php echo get_theme_mod('header_search_width')?>%;}
<?php } ?>
<?php if(get_theme_mod('header_bg')){ ?>
.header-bg-color {background-color: <?php echo get_theme_mod('header_bg', 'rgba(255,255,255,0.9)'); ?>}
<?php } ?>
<?php if(get_theme_mod('header_bg_img')){ ?>
.header-bg-image {background-image: url('<?php echo get_theme_mod('header_bg_img'); ?>');}
.header-bg-image {background-repeat: <?php echo get_theme_mod('header_bg_img_repeat','repeat') ?>;}
<?php } ?>
.header-bottom {background-color: <?php echo get_theme_mod('nav_position_bg','#f1f1f1'); ?>}
<?php if(get_theme_mod('nav_height_top')){ ?>
.top-bar-nav > li > a{line-height: <?php echo get_theme_mod('nav_height_top').'px';?> }
<?php } ?>
<?php if(get_theme_mod('nav_height')){ ?>
.header-main .nav > li > a{line-height: <?php echo get_theme_mod('nav_height').'px';?> }
<?php } ?>
<?php if(get_theme_mod('nav_push')){ ?>
.header-wrapper:not(.stuck) .header-main .header-nav{margin-top: <?php echo get_theme_mod('nav_push').'px';?> }
<?php } ?>
<?php if(get_theme_mod('nav_height_sticky')){ ?>
.stuck .header-main .nav > li > a{line-height: <?php echo get_theme_mod('nav_height_sticky').'px';?> }
<?php } ?>
<?php if(get_theme_mod('nav_height_bottom')){ ?>
.header-bottom-nav > li > a{line-height: <?php echo get_theme_mod('nav_height_bottom').'px';?> }
<?php } ?>
<?php
$header_height_mobile = get_theme_mod('header_height_mobile', 70);
if($header_height_mobile){ ?>
@media (max-width: <?php echo $small_screen_max ?>) {
.header-main{height: <?php echo $header_height_mobile;?>px}
#logo img{max-height: <?php echo $header_height_mobile; ?>px}
}
<?php } ?>
<?php if(get_theme_mod('mobile_overlay_bg')){ ?>
.main-menu-overlay{
background-color: <?php echo get_theme_mod('mobile_overlay_bg'); ?>
}
<?php } ?>
<?php if ( get_theme_mod( 'dropdown_border_enabled', 1 ) && get_theme_mod( 'dropdown_border' ) ) { ?>
.nav-dropdown-has-arrow.nav-dropdown-has-border li.has-dropdown:before{border-bottom-color: <?php echo get_theme_mod('dropdown_border'); ?>;}
.nav .nav-dropdown{ border-color: <?php echo get_theme_mod('dropdown_border'); ?> }
<?php } ?>
<?php if(get_theme_mod('dropdown_radius')){ ?>
.nav-dropdown{border-radius:<?php echo get_theme_mod('dropdown_radius'); ?>}
<?php } ?>
<?php if(get_theme_mod('dropdown_nav_size', 100) !== 100){ ?>
.nav-dropdown{font-size:<?php echo get_theme_mod('dropdown_nav_size'); ?>%}
<?php } ?>
<?php if(get_theme_mod('dropdown_bg')){ ?>
.nav-dropdown-has-arrow li.has-dropdown:after{border-bottom-color: <?php echo get_theme_mod('dropdown_bg'); ?>;}
.nav .nav-dropdown{background-color: <?php echo get_theme_mod('dropdown_bg'); ?>}
<?php } ?>
<?php if(get_theme_mod('topbar_bg')){ ?>
.header-top{background-color: <?php echo get_theme_mod('topbar_bg'); ?>!important;}
<?php } ?>
<?php if(get_theme_mod('blog_bg_color')){ ?>
.blog-wrapper{background-color: <?php echo get_theme_mod('blog_bg_color'); ?>;}
<?php } ?>
<?php
$color_primary = get_theme_mod('color_primary', Flatsome_Default::COLOR_PRIMARY );
if($color_primary && $color_primary !== Flatsome_Default::COLOR_PRIMARY){ ?>
/* Color */
.accordion-title.active, .has-icon-bg .icon .icon-inner,.logo a, .primary.is-underline, .primary.is-link, .badge-outline .badge-inner, .nav-outline > li.active> a,.nav-outline >li.active > a, .cart-icon strong,[data-color='primary'], .is-outline.primary{color: <?php echo $color_primary; ?>;}
/* Color !important */
[data-text-color="primary"]{color: <?php echo $color_primary; ?>!important;}
/* Background Color */
[data-text-bg="primary"]{background-color: <?php echo $color_primary; ?>;}
/* Background */
.scroll-to-bullets a,.featured-title, .label-new.menu-item > a:after, .nav-pagination > li > .current,.nav-pagination > li > span:hover,.nav-pagination > li > a:hover,.has-hover:hover .badge-outline .badge-inner,button[type="submit"], .button.wc-forward:not(.checkout):not(.checkout-button), .button.submit-button, .button.primary:not(.is-outline),.featured-table .title,.is-outline:hover, .has-icon:hover .icon-label,.nav-dropdown-bold .nav-column li > a:hover, .nav-dropdown.nav-dropdown-bold > li > a:hover, .nav-dropdown-bold.dark .nav-column li > a:hover, .nav-dropdown.nav-dropdown-bold.dark > li > a:hover, .header-vertical-menu__opener ,.is-outline:hover, .tagcloud a:hover,.grid-tools a, input[type='submit']:not(.is-form), .box-badge:hover .box-text, input.button.alt,.nav-box > li > a:hover,.nav-box > li.active > a,.nav-pills > li.active > a ,.current-dropdown .cart-icon strong, .cart-icon:hover strong, .nav-line-bottom > li > a:before, .nav-line-grow > li > a:before, .nav-line > li > a:before,.banner, .header-top, .slider-nav-circle .flickity-prev-next-button:hover svg, .slider-nav-circle .flickity-prev-next-button:hover .arrow, .primary.is-outline:hover, .button.primary:not(.is-outline), input[type='submit'].primary, input[type='submit'].primary, input[type='reset'].button, input[type='button'].primary, .badge-inner{background-color: <?php echo $color_primary; ?>;}
/* Border */
.nav-vertical.nav-tabs > li.active > a,.scroll-to-bullets a.active,.nav-pagination > li > .current,.nav-pagination > li > span:hover,.nav-pagination > li > a:hover,.has-hover:hover .badge-outline .badge-inner,.accordion-title.active,.featured-table,.is-outline:hover, .tagcloud a:hover,blockquote, .has-border, .cart-icon strong:after,.cart-icon strong,.blockUI:before, .processing:before,.loading-spin, .slider-nav-circle .flickity-prev-next-button:hover svg, .slider-nav-circle .flickity-prev-next-button:hover .arrow, .primary.is-outline:hover{border-color: <?php echo get_theme_mod('color_primary', Flatsome_Default::COLOR_PRIMARY ); ?>}
.nav-tabs > li.active > a{border-top-color: <?php echo $color_primary; ?>}
.widget_shopping_cart_content .blockUI.blockOverlay:before { border-left-color: <?php echo $color_primary; ?> }
.woocommerce-checkout-review-order .blockUI.blockOverlay:before { border-left-color: <?php echo $color_primary; ?> }
/* Fill */
.slider .flickity-prev-next-button:hover svg,
.slider .flickity-prev-next-button:hover .arrow{fill: <?php echo $color_primary; ?>;}
<?php } ?>
<?php
$color_secondary = get_theme_mod('color_secondary', Flatsome_Default::COLOR_SECONDARY);
if( $color_secondary && $color_secondary !== Flatsome_Default::COLOR_SECONDARY ){ ?>
/* Background Color */
[data-icon-label]:after, .secondary.is-underline:hover,.secondary.is-outline:hover,.icon-label,.button.secondary:not(.is-outline),.button.alt:not(.is-outline), .badge-inner.on-sale, .button.checkout, .single_add_to_cart_button, .current .breadcrumb-step{ background-color: <?php echo $color_secondary; ?>; }
[data-text-bg="secondary"]{background-color: <?php echo $color_secondary; ?>;}
/* Color */
.secondary.is-underline,.secondary.is-link, .secondary.is-outline,.stars a.active, .star-rating:before, .woocommerce-page .star-rating:before,.star-rating span:before, .color-secondary{color: <?php echo $color_secondary ;?>}
/* Color !important */
[data-text-color="secondary"]{color: <?php echo $color_secondary; ?>!important;}
/* Border */
.secondary.is-outline:hover{
border-color: <?php echo $color_secondary; ?>
}
<?php } ?>
<?php
$color_success = get_theme_mod( 'color_success' , Flatsome_Default::COLOR_SUCCESS );
if( $color_success && $color_success !== Flatsome_Default::COLOR_SUCCESS ){ ?>
.success.is-underline:hover,.success.is-outline:hover,
.success{background-color: <?php echo $color_success;?>}
.success-color, .success.is-link, .success.is-outline{
color: <?php echo $color_success;?>;
}
.success-border{
border-color: <?php echo $color_success;?>!important;
}
/* Color !important */
[data-text-color="success"]{color: <?php echo $color_success; ?>!important;}
/* Background Color */
[data-text-bg="success"]{background-color: <?php echo $color_success; ?>;}
<?php } ?>
<?php
$alert_color = get_theme_mod('color_alert', Flatsome_Default::COLOR_ALERT);
if($alert_color && $alert_color !== Flatsome_Default::COLOR_ALERT){ ?>
.alert.is-underline:hover,.alert.is-outline:hover,
.alert{background-color: <?php echo $alert_color;?>}
.alert.is-link, .alert.is-outline, .color-alert{
color: <?php echo $alert_color; ?>;
}
/* Color !important */
[data-text-color="alert"]{color: <?php echo $alert_color; ?>!important;}
/* Background Color */
[data-text-bg="alert"]{background-color: <?php echo $alert_color; ?>;}
<?php } ?>
<?php
// Get Type options
$type_nav = get_theme_mod('type_nav', array('font-family'=> 'Lato','variant' => '700'));
$type_texts = get_theme_mod('type_texts', array('font-family'=> 'Lato','variant' => '400'));
$type_headings = get_theme_mod('type_headings',array('font-family'=> 'Lato','variant' => '700'));
$type_alt = get_theme_mod('type_alt', array('font-family'=> 'Dancing Script','variant' => '400'));
// Type sizes
if(get_theme_mod('type_size', 100) !== 100){
echo 'body{font-size: '.get_theme_mod('type_size').'%;}';
}
if(get_theme_mod('type_size_mobile', 100) !== 100){
echo '@media screen and (max-width: ' . $small_screen_max . '){body{font-size: '.get_theme_mod('type_size_mobile').'%;}}';
}
// Fix old
if(!is_array($type_nav)) {
$type_nav = array('font-family' => $type_nav, 'variant' => '700');
}
if(!is_array($type_texts)) {
$type_texts = array('font-family' => $type_texts, 'variant' => '400');
}
if(!is_array($type_alt)) {
$type_alt = array('font-family' => $type_alt, 'variant' => '400');
}
if(!is_array($type_headings)) {
$type_headings = array('font-family' => $type_headings, 'variant' => '700');
}
// Type Base
if(!empty($type_texts['font-family'])) {
echo 'body{font-family: "'.$type_texts['font-family'].'", sans-serif}';
}
if(!empty($type_texts['variant'])) {
echo 'body{font-weight: '.intval($type_texts['variant']).'}';
}
if(get_theme_mod('color_texts')){
echo 'body{color: '.get_theme_mod('color_texts').'}';
}
// Type Navigations
if(!empty($type_nav['font-family'])) {
echo '.nav > li > a {font-family: "'.$type_nav['font-family'].'", sans-serif;}';
echo '.mobile-sidebar-levels-2 .nav > li > ul > li > a {font-family: "'.$type_nav['font-family'].'", sans-serif;}';
}
if(!empty($type_nav['variant'])) {
echo '.nav > li > a {font-weight: '.intval($type_nav['variant']).';}';
echo '.mobile-sidebar-levels-2 .nav > li > ul > li > a {font-weight: '.intval($type_nav['variant']).';}';
}
// Type Headings
if(!empty($type_headings['font-family'])) {
echo 'h1,h2,h3,h4,h5,h6,.heading-font, .off-canvas-center .nav-sidebar.nav-vertical > li > a{font-family: "'.$type_headings['font-family'].'", sans-serif;}';
}
if(!empty($type_headings['variant'])) {
echo 'h1,h2,h3,h4,h5,h6,.heading-font,.banner h1,.banner h2{font-weight: '.(intval($type_headings['variant'])).';}';
}
if(get_theme_mod('type_headings_color')){
echo 'h1,h2,h3,h4,h5,h6,.heading-font{color: '.get_theme_mod('type_headings_color').';}';
}
// Text Transforms
if(get_theme_mod('text_transform_breadcrumbs')){
echo '.breadcrumbs{text-transform: '.get_theme_mod('text_transform_breadcrumbs').';}';
}
if(get_theme_mod('text_transform_buttons')){
echo 'button,.button{text-transform: '.get_theme_mod('text_transform_buttons').';}';
}
if(get_theme_mod('text_transform_navigation')){
echo '.nav > li > a, .links > li > a{text-transform: '.get_theme_mod('text_transform_navigation').';}';
}
if(get_theme_mod('text_transform_section_titles')){
echo '.section-title span{text-transform: '.get_theme_mod('text_transform_section_titles').';}';
}
if(get_theme_mod('text_transform_widget_titles')){
echo 'h3.widget-title,span.widget-title{text-transform: '.get_theme_mod('text_transform_widget_titles').';}';
}
// Alt Type
if(!empty($type_alt ['font-family'])) {
echo '.alt-font{font-family: "'.$type_alt['font-family'].'", sans-serif;}';
}
if(!empty($type_alt['variant'])) {
echo '.alt-font{font-weight: '.intval($type_alt['variant']).'!important;}';
}
?>
<?php if(get_theme_mod('type_nav_top_color')){ ?>
.header:not(.transparent) .top-bar-nav > li > a {
color: <?php echo get_theme_mod('type_nav_top_color'); ?>;
}
<?php } ?>
<?php if(get_theme_mod('type_nav_top_color_hover')) { ?>
.header:not(.transparent) .top-bar-nav.nav > li > a:hover,
.header:not(.transparent) .top-bar-nav.nav > li.active > a,
.header:not(.transparent) .top-bar-nav.nav > li.current > a,
.header:not(.transparent) .top-bar-nav.nav > li > a.active,
.header:not(.transparent) .top-bar-nav.nav > li > a.current{
color: <?php echo get_theme_mod('type_nav_top_color_hover'); ?>;
}
.top-bar-nav.nav-line-bottom > li > a:before,
.top-bar-nav.nav-line-grow > li > a:before,
.top-bar-nav.nav-line > li > a:before,
.top-bar-nav.nav-box > li > a:hover,
.top-bar-nav.nav-box > li.active > a,
.top-bar-nav.nav-pills > li > a:hover,
.top-bar-nav.nav-pills > li.active > a{
color:#FFF!important;
background-color: <?php echo get_theme_mod('type_nav_top_color_hover'); ?>;
}
<?php } ?>
<?php if(get_theme_mod('type_nav_color')){ ?>
.header:not(.transparent) .header-nav-main.nav > li > a {
color: <?php echo get_theme_mod('type_nav_color'); ?>;
}
<?php } ?>
<?php if(get_theme_mod('type_nav_color_hover')) { ?>
.header:not(.transparent) .header-nav-main.nav > li > a:hover,
.header:not(.transparent) .header-nav-main.nav > li.active > a,
.header:not(.transparent) .header-nav-main.nav > li.current > a,
.header:not(.transparent) .header-nav-main.nav > li > a.active,
.header:not(.transparent) .header-nav-main.nav > li > a.current{
color: <?php echo get_theme_mod('type_nav_color_hover'); ?>;
}
.header-nav-main.nav-line-bottom > li > a:before,
.header-nav-main.nav-line-grow > li > a:before,
.header-nav-main.nav-line > li > a:before,
.header-nav-main.nav-box > li > a:hover,
.header-nav-main.nav-box > li.active > a,
.header-nav-main.nav-pills > li > a:hover,
.header-nav-main.nav-pills > li.active > a{
color:#FFF!important;
background-color: <?php echo get_theme_mod('type_nav_color_hover'); ?>;
}
<?php } ?>
<?php if(get_theme_mod('type_nav_bottom_color')){ ?>
.header:not(.transparent) .header-bottom-nav.nav > li > a{
color: <?php echo get_theme_mod('type_nav_bottom_color'); ?>;
}
<?php } ?>
<?php if(get_theme_mod('type_nav_bottom_color_hover')){ ?>
.header:not(.transparent) .header-bottom-nav.nav > li > a:hover,
.header:not(.transparent) .header-bottom-nav.nav > li.active > a,
.header:not(.transparent) .header-bottom-nav.nav > li.current > a,
.header:not(.transparent) .header-bottom-nav.nav > li > a.active,
.header:not(.transparent) .header-bottom-nav.nav > li > a.current{
color: <?php echo get_theme_mod('type_nav_bottom_color_hover'); ?>;
}
.header-bottom-nav.nav-line-bottom > li > a:before,
.header-bottom-nav.nav-line-grow > li > a:before,
.header-bottom-nav.nav-line > li > a:before,
.header-bottom-nav.nav-box > li > a:hover,
.header-bottom-nav.nav-box > li.active > a,
.header-bottom-nav.nav-pills > li > a:hover,
.header-bottom-nav.nav-pills > li.active > a{
color:#FFF!important;
background-color: <?php echo get_theme_mod('type_nav_bottom_color_hover'); ?>;
}
<?php } ?>
<?php
$color_links = get_theme_mod( 'color_links' );
$color_links_hover = get_theme_mod( 'color_links_hover' );
if( $color_links ){ ?>
a{color: <?php echo $color_links; ?>;}
<?php } ?>
<?php if ( $color_links_hover ){ ?>
a:hover{color: <?php echo $color_links_hover; ?>;}
.tagcloud a:hover{border-color: <?php echo $color_links_hover; ?>;
background-color: <?php echo $color_links_hover; ?>;}
<?php } ?>
<?php if(get_theme_mod('color_widget_links')){ ?>
.widget a{color: <?php echo get_theme_mod('color_widget_links'); ?>;}
.widget a:hover{color: <?php echo get_theme_mod('color_widget_links_hover'); ?>;}
.widget .tagcloud a:hover{border-color: <?php echo get_theme_mod('color_widget_links_hover'); ?>; background-color: <?php echo get_theme_mod('color_widget_links_hover'); ?>;}
<?php } ?>
<?php if(get_theme_mod('color_divider')){ ?>
.is-divider{background-color: <?php echo get_theme_mod('color_divider'); ?>;}
<?php } ?>
<?php if(is_woocommerce_activated() && get_theme_mod('header_shop_bg_color')){ ?>
.shop-page-title.featured-title .title-overlay{
background-color: <?php echo get_theme_mod('header_shop_bg_color') ?>;}
<?php } ?>
<?php if(get_theme_mod('color_checkout')) { ?>
.current .breadcrumb-step, [data-icon-label]:after, .button#place_order,.button.checkout,.checkout-button,.single_add_to_cart_button.button{background-color: <?php echo get_theme_mod('color_checkout'); ?>!important }
<?php } ?>
<?php if(get_theme_mod('category_force_image_height')) { ?>
.has-equal-box-heights .box-image {
padding-top: <?php echo get_theme_mod('category_image_height', 100) ;?>%;
}
<?php } ?>
<?php if(get_theme_mod('color_sale')) { ?>
.badge-inner.on-sale{background-color: <?php echo get_theme_mod('color_sale'); ?>}
<?php } ?>
<?php if ( get_theme_mod( 'color_new_bubble_auto' ) ) { ?>
.badge-inner.new-bubble-auto{background-color: <?php echo get_theme_mod( 'color_new_bubble_auto' ); ?>}
<?php } ?>
<?php if(get_theme_mod('color_new_bubble')) { ?>
.badge-inner.new-bubble{background-color: <?php echo get_theme_mod('color_new_bubble'); ?>}
<?php } ?>
<?php if(get_theme_mod('color_review')) { ?>
.star-rating span:before,.star-rating:before, .woocommerce-page .star-rating:before, .stars a:hover:after, .stars a.active:after{color: <?php echo get_theme_mod('color_review'); ?>}
<?php } ?>
<?php if ( is_woocommerce_activated() && get_theme_mod( 'color_regular_price' ) ) { ?>
.price del, .product_list_widget del, del .woocommerce-Price-amount { color: <?php echo get_theme_mod( 'color_regular_price' ); ?>; }
<?php } ?>
<?php if ( is_woocommerce_activated() && get_theme_mod( 'color_sale_price' ) ) { ?>
ins .woocommerce-Price-amount { color: <?php echo get_theme_mod( 'color_sale_price' ); ?>; }
<?php } ?>
<?php if(is_woocommerce_activated() && get_theme_mod('header_shop_bg_image')){ ?>
.shop-page-title.featured-title .title-bg{background-image: url(<?php echo get_theme_mod('header_shop_bg_image'); ?>);}
<?php } ?>
<?php if(get_theme_mod('button_radius') && get_theme_mod('button_radius') !== '0px') { ?>
input[type='submit'], input[type="button"], button:not(.icon), .button:not(.icon){border-radius: <?php echo get_theme_mod('button_radius');?>!important}
<?php } ?>
<?php if(get_theme_mod('flatsome_lightbox_bg')) { ?>
.pswp__bg,.mfp-bg.mfp-ready{background-color: <?php echo get_theme_mod('flatsome_lightbox_bg'); ?>}
<?php } ?>
<?php if(is_woocommerce_activated() && get_theme_mod('header_shop_bg_featured', 1)) { ?>
<?php if(is_product_category() || is_product_tag()) { ?>
<?php
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
if($image) echo '.shop-page-title.featured-title .title-bg{background-image: url('.$image.')!important;}';
?>
<?php } ?>
<?php if(is_product()) {
// On product pages
global $post;
$feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
echo '.shop-page-title.featured-title .title-bg{ background-image: url('.$feat_image.')!important;}';
} ?>
<?php } ?>
<?php if(is_woocommerce_activated()){
$image_sizes = wc_get_image_size('thumbnail');
$image_width = $image_sizes['width'];
?>
@media screen and (min-width: <?php echo $small_screen; ?>){
.products .box-vertical .box-image{
min-width: <?php echo $image_width;?>px!important;
width: <?php echo $image_width;?>px!important;
}
}
<?php } ?>
<?php
$header_icons_color = get_theme_mod('header_icons_color');
$header_icons_color_hover = get_theme_mod('header_icons_color_hover');
if(!$header_icons_color_hover) $header_icons_color_hover = $header_icons_color;
if($header_icons_color){ ?>
.header-main .social-icons,
.header-main .cart-icon strong,
.header-main .menu-title,
.header-main .header-button > .button.is-outline,
.header-main .nav > li > a > i:not(.icon-angle-down){
color: <?php echo $header_icons_color; ?>!important;
}
.header-main .header-button > .button.is-outline,
.header-main .cart-icon strong:after,
.header-main .cart-icon strong{
border-color: <?php echo $header_icons_color; ?>!important;
}
.header-main .header-button > .button:not(.is-outline){
background-color: <?php echo $header_icons_color; ?>!important;
}
.header-main .current-dropdown .cart-icon strong,
.header-main .header-button > .button:hover,
.header-main .header-button > .button:hover i,
.header-main .header-button > .button:hover span{
color:#FFF!important;
}
<?php if($header_icons_color_hover){ ?>
.header-main .menu-title:hover,
.header-main .social-icons a:hover,
.header-main .header-button > .button.is-outline:hover,
.header-main .nav > li > a:hover > i:not(.icon-angle-down){
color: <?php echo $header_icons_color_hover; ?>!important;
}
.header-main .current-dropdown .cart-icon strong,
.header-main .header-button > .button:hover{
background-color: <?php echo $header_icons_color_hover; ?>!important;
}
.header-main .current-dropdown .cart-icon strong:after,
.header-main .current-dropdown .cart-icon strong,
.header-main .header-button > .button:hover{
border-color: <?php echo $header_icons_color_hover; ?>!important;
}
<?php } ?>
<?php } ?>
<?php if(get_theme_mod('footer_1_bg_image')){ ?>
.footer-1{background-image: url('<?php echo get_theme_mod('footer_1_bg_image'); ?>');}
<?php } ?>
<?php if(get_theme_mod('footer_2_bg_image')){ ?>
.footer-2{background-image: url('<?php echo get_theme_mod('footer_2_bg_image'); ?>');}
<?php } ?>
<?php if(get_theme_mod('footer_1_bg_color')){ ?>
.footer-1{background-color: <?php echo get_theme_mod('footer_1_bg_color') ;?>}
<?php } ?>
<?php if(get_theme_mod('footer_2_bg_color')){ ?>
.footer-2{background-color: <?php echo get_theme_mod('footer_2_bg_color') ;?>}
<?php } ?>
<?php if(get_theme_mod('footer_bottom_color')){ ?>
.absolute-footer, html{background-color: <?php echo get_theme_mod('footer_bottom_color') ;?>}
<?php } ?>
<?php if(get_theme_mod('product_header') == 'top') {
echo '.page-title-small + main .product-container > .row{padding-top:0;}';
} ?>
<?php if ( get_theme_mod( 'cart_auto_refresh' ) ) {
echo 'button[name=\'update_cart\'] { display: none; }';
} ?>
<?php if ( get_theme_mod( 'header_nav_vertical_height' ) ) { ?>
.header-vertical-menu__opener{height: <?php echo get_theme_mod('header_nav_vertical_height');?>px}
<?php } ?>
<?php if ( get_theme_mod( 'header_nav_vertical_width' ) ) { ?>
.header-vertical-menu__opener, .header-vertical-menu__fly-out{width: <?php echo get_theme_mod('header_nav_vertical_width');?>px}
<?php } ?>
<?php if ( get_theme_mod( 'header_nav_vertical_bg_color' ) ) { ?>
.header-vertical-menu__opener{background-color: <?php echo get_theme_mod('header_nav_vertical_bg_color');?>}
<?php } ?>
<?php if ( get_theme_mod( 'header_nav_vertical_fly_out_bg_color' ) ) { ?>
.header-vertical-menu__fly-out{background-color: <?php echo get_theme_mod('header_nav_vertical_fly_out_bg_color');?>}
<?php } ?>
<?php if(get_theme_mod('html_custom_css')){
echo '/* Custom CSS */';
echo get_theme_mod('html_custom_css');
} ?>
<?php if(get_theme_mod('html_custom_css_tablet')){
echo '/* Custom CSS Tablet */';
echo '@media (max-width: ' . $medium_screen_max . '){';
echo get_theme_mod('html_custom_css_tablet');
echo '}';
} ?>
<?php if(get_theme_mod('html_custom_css_mobile')){
echo '/* Custom CSS Mobile */';
echo '@media (max-width: ' . $small_screen_max . '){';
echo get_theme_mod('html_custom_css_mobile');
echo '}';
} ?>
<?php if(is_admin_bar_showing()){ ?>
@media (max-width: <?php echo $medium_screen_max; ?>){
#wpadminbar{display: none!important;}
html{margin-top: 0!important}
}
@media (min-width: <?php echo $medium_screen; ?>){
.mfp-content,
.stuck,
button.mfp-close{
top: 32px!important;
}
.is-full-height{height: calc(100vh - 32px)!important;}
}
<?php } ?>
<?php if(is_admin_bar_showing() || is_customize_preview()) { ?>
.xdebug-var-dump{
z-index: 999999;
}
.shortcode-error{
border: 2px dashed #000;
padding: 20px;
color:#fff;
font-size:16px;
background-color: #71cedf;
}
.custom-product-page .shortcode-error {
padding: 15% 10%;
text-align: center;
}
<?php } ?>
<?php if ( current_user_can( 'edit_pages' ) && is_admin_bar_showing() ) { ?>
.edit-block-wrapper{
position: relative;
}
.edit-block-button{
font-size: 12px!important;
background-color: #555!important;
margin: 6px 2px 3px 0px!important;
border-radius: 4px!important;
}
.edit-block-button-builder{
background-color: #00a0d2!important;
}
<?php } ?>
.label-new.menu-item > a:after{content:"<?php _e('New','flatsome'); ?>";}
.label-hot.menu-item > a:after{content:"<?php _e('Hot','flatsome'); ?>";}
.label-sale.menu-item > a:after{content:"<?php _e('Sale','flatsome'); ?>";}
.label-popular.menu-item > a:after{content:"<?php _e('Popular','flatsome'); ?>";}
</style>
<?php
$buffer = ob_get_clean();
echo flatsome_minify_css($buffer);
}
add_action( 'wp_head', 'flatsome_custom_css', 100 );

View File

@@ -0,0 +1,143 @@
<?php
// Set Default Flatsome Options
if(!function_exists('flatsome_defaults')){
function flatsome_defaults($option) {
$df = array(
// Blog
'blog_layout' => 'right-sidebar',
'blog_layout_divider' => 1,
'blog_style' => 'normal',
'blog_posts_title_align' => 'center',
'blog_post_layout' => 'right-sidebar',
'blog_author_box' => 1,
'blog_share' => 1,
'bubble_style' => 'style1',
'pages_template' => 'default',
'dropdown_style' => 'default',
'wc_category_page_title' => 0,
'body_bg_type' => 'bg-tiled',
'wc_category_list_toggle' => 0,
'blog_featured_height' => 500,
'header_button_1' => 'Button 1',
'header_button_1_link' => '#',
'header_button_1_radius' => '99px',
'header_button_1_color' => 'primary',
'header_button_2' => 'Button 2',
'header_button_2_radius' => '99px',
'header_button_2_color' => 'secondary',
'header_button_2_style' => 'outline',
'header_buttons_mobile' => 1,
'pages_title_bg_featured' => 1,
'category_sidebar' => 'left-sidebar',
'wishlist_title' => 1,
'wishlist_icon_size' => '24px',
'header_bg_transparent_shade' => 0,
'blog_archive_title' => 1,
'wishlist_icon' => 'heart',
// Top bar
'flatsome_lightbox' => 1,
'nav_style_top' => 'divided',
'topbar_left' => '<strong class="uppercase">Add anything here or just remove it...</strong>',
'account_login_style' => 'lightbox',
'social_icons' => array('facebook','twitter','email','linkedin','pinterest','whatsapp'),
'social_icons_style' => 'outline',
'nav_uppercase' => 1,
'blog_badge_style' => 'outline',
'flatsome_portfolio' => 1,
'topbar_right' => '',
'breadcrumb_size' => 'large',
'product_hover' => 'fade_in_back',
'product_info_share' => 1,
'product_info_meta' => 1,
'header_shop_bg_featured' => 1,
'back_to_top' => 1,
'product_info_divider' => 1,
'blog_posts_header_style' => 'normal',
'blog_post_style' => 'default',
// Main header
'header_sticky' => 1,
'disable_quick_view' => 0,
'product_box_rating' => 1,
'product_box_category' => 1,
'site_logo' => get_template_directory_uri().'/assets/img/logo.png',
'mobile_overlay' => 'left',
'topbar_align' => 'left',
'top_right_text' => '',
'nav_position_text_top' => '',
'header_shop_bg_color' => 'rgba(0,0,0,.3)',
'header_height' => 90,
'header_height_sticky' => 70,
'header_color' => 'light',
'box_shadow_header' => 0,
'footer_2_color' => 'dark',
'header_content_push' => 1,
'category_row_count_mobile' => 2,
'category_row_count_tablet' => 3,
'products_pr_page' => 12,
'category_row_count' => 3,
'cart_icon' => 'basket',
'account_icon' => 'disabled',
'header_account_title' => 1,
'header_bg_img' => '',
'header_bg_img_repeat' => 'repeat-x',
'nav_style_main' => 'nav-uppercase',
'google_map_api' => 'AIzaSyCnQHEUD4Yvg4m1ul3PWUwsjctR1Cl2NFc',
'nav_size' => '',
'nav_spacing' => '',
'deparments_menu_label' => 'Departments',
// Bottom bar
'bottombar_sticky' => 1,
'bottombar_left' => '',
'nav_position_text' => '',
'cat_style' => 'badge',
'category_grid_style' => 'grid',
'nav_position' => 'top',
'nav_position_color' => 'light',
'header_contact_visibility' => 0,
'header_height_mobile' => 70,
//'custom_cart_icon' => '',
'header_cart_style' => 'dropdown',
'related_products' => 'slider',
'related_products_pr_row' => '4',
'header_cart_total' => 1,
'header_cart_title' => 1,
'continue_shopping' => 1,
// Follow icons
'follow_style' => 'small',
'follow_facebook' => 'https://yoururl',
'follow_twitter' => 'https://yoururl',
'follow_instagram' => 'https://yoururl',
'portfolio_archive_filter' => 'left',
'portfolio_archive_filter_style' => 'line-grow',
'header_search_style' => 'dropdown',
'contact_style' => 'left',
'contact_icon_size' => '16px',
'contact_phone' => '+47 900 99 000',
'contact_email' => 'youremail@gmail.com',
'type_headings' => array('font-family'=> 'Lato','variant' => '700'),
'type_texts' => array('font-family'=> 'Lato','variant' => '400'),
'type_nav' => array('font-family'=> 'Lato','variant' => '700'),
'type_alt' => array('font-family'=> 'Dancing Script','variant' => '400'),
'nav_uppercase_bottom' => 1,
'breadcrumb_title_pos' => 'left',
'breadcrumb_nav_pos' => 'right',
'product_image_width' => '6',
'product_sidebar_width' => '2',
'blog_show_excerpt' => 1,
'wc_account_links' => 1,
'footer_left_text' => 'Copyright [ux_current_year] &copy; <strong>Flatsome Theme</strong>',
'product_upsell' => 'sidebar',
'footer_1_columns' => '4',
'footer_2_columns' => '4',
'footer_bottom_text' => 'dark',
// Optimize
'lazy_load_backgrounds' => 1,
'lazy_load_scripts' => 0,
'payment_icons' => array('visa','paypal','stripe','mastercard','cashondelivery'),
);
// Return default option if not empty
if(!empty($df[$option])) return $df[$option];
};
}

View File

@@ -0,0 +1,16 @@
<?php
// Fallbacks
function flatsome_add_fallbacks () {
$ie_css = get_template_directory_uri() .'/assets/css/ie-fallback.css';
echo '<!--[if IE]>';
echo '<link rel="stylesheet" type="text/css" href="'.$ie_css.'">';
echo '<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"></script>';
echo "<script>var head = document.getElementsByTagName('head')[0],style = document.createElement('style');style.type = 'text/css';style.styleSheet.cssText = ':before,:after{content:none !important';head.appendChild(style);setTimeout(function(){head.removeChild(style);}, 0);</script>";
// Flexbox polyfill
echo '<script src="'.get_template_directory_uri() .'/assets/libs/ie-flexibility.js"></script>';
echo '<![endif]-->';
}
add_action('wp_head', 'flatsome_add_fallbacks');

View File

@@ -0,0 +1,92 @@
<?php // @codingStandardsIgnoreLine
/**
* Parses the Google Font api link.
*
* @return string The link
*/
function flatsome_get_google_fonts_link() {
$type_headings = get_theme_mod( 'type_headings', array( 'font-family' => 'Lato', 'variant' => '700' ) );
$type_texts = get_theme_mod( 'type_texts', array( 'font-family' => 'Lato', 'variant' => '400' ) );
$type_nav = get_theme_mod( 'type_nav', array( 'font-family' => 'Lato', 'variant' => '700' ) );
$type_alt = get_theme_mod( 'type_alt', array( 'font-family' => 'Dancing Script', 'variant' => '400' ) );
// Fix old.
if ( ! is_array( $type_nav ) ) {
$type_nav = array( 'font-family' => $type_nav, 'variant' => 'default' );
}
if ( ! is_array( $type_texts ) ) {
$type_texts = array( 'font-family' => $type_texts, 'variant' => 'default' );
}
if ( ! is_array( $type_alt ) ) {
$type_alt = array( 'font-family' => $type_alt, 'variant' => 'default' );
}
if ( ! is_array( $type_headings ) ) {
$type_headings = array( 'font-family' => $type_headings, 'variant' => 'default' );
}
$fonts = array( $type_headings, $type_texts, $type_nav, $type_alt );
$font_list = array();
$subsets = array();
// Insert fonts.
foreach ( $fonts as $font ) {
// Add Fonts.
if ( isset( $font['font-family'] ) ) {
if ( ! isset( $font['variant'] ) ) {
$font['variant'] = 'default';
}
$font_list[ $font['font-family'] ][] = $font['variant'];
}
// Add Subsets.
if ( isset( $font['subset'] ) ) {
if ( ! is_array( $font['subset'] ) ) {
$subsets[] = $font['subset'];
} else {
foreach ( $font['subset'] as $subset ) {
$subsets[] = $subset;
}
}
}
}
$link_fonts = array();
foreach ( $font_list as $font => $variants ) {
$variants = implode( ',', $variants );
$link_font = str_replace( ' ', '+', $font );
if ( ! empty( $variants ) ) {
// Always include regular variant as a workaround for Kirki
// not updating the variant when font has only one variant.
$link_font .= ':regular,' . $variants;
}
$link_fonts[] = $link_font;
}
$link = '//fonts.googleapis.com/css?family=';
$link .= implode( '|', $link_fonts );
if ( ! empty( $subsets ) ) {
$subsets = array_unique( $subsets );
$link .= '&subset=' . implode( ',', $subsets );
}
$link .= '&display=' . get_theme_mod( 'googlefonts_font_display', 'swap' );
return $link;
}
/**
* Add google font style when not disabled.
*/
function flatsome_google_fonts() {
if ( get_theme_mod( 'disable_fonts', 0 ) ) {
return;
}
wp_enqueue_style( 'flatsome-googlefonts', flatsome_get_google_fonts_link(), array(), '3.9' );
}
add_action( 'wp_enqueue_scripts', 'flatsome_google_fonts', 9999 );

View File

@@ -0,0 +1,333 @@
<?php
/**
* Get the Flatsome Envato instance.
*/
function flatsome_envato() {
return Flatsome_Envato::get_instance();
}
/**
* Enqueues a webpack bundle.
*
* @param string $handle Script handle name.
* @param string $path Path to asset fille.
* @param array $dependencies Extra dependencies.
* @return void
*/
function flatsome_enqueue_asset( $handle, $path, $dependencies = array() ) {
$theme = wp_get_theme( get_template() );
$version = $theme->get( 'Version' );
$template_dir = get_template_directory();
$template_uri = get_template_directory_uri();
$script_path = "$template_dir/assets/js/$path.asset.php";
$script_url = "$template_uri/assets/js/$path.js";
$script_asset = file_exists( $script_path )
? require $script_path
: array( 'dependencies' => array(), 'version' => $version );
wp_enqueue_script(
$handle,
$script_url,
array_merge( $script_asset['dependencies'], $dependencies ),
$script_asset['version'],
true
);
}
/**
* Get Flatsome option
*
* @deprecated in favor of get_theme_mod()
*
* @return string
*/
function flatsome_option($option) {
// Get options
return get_theme_mod( $option, flatsome_defaults($option) );
}
if(!function_exists('flatsome_dummy_image')) {
function flatsome_dummy_image() {
return get_template_directory_uri().'/assets/img/missing.jpg';
}
}
/**
* Checks current WP version against a given version.
*
* @param string $version The version to check for.
*
* @return bool Returns true if WP version is equal or higher then given version.
*/
function flatsome_wp_version_check( $version = '5.4' ) {
global $wp_version;
if ( version_compare( $wp_version, $version, '>=' ) ) {
return true;
}
return false;
}
/* Check WooCommerce Version */
if( ! function_exists('fl_woocommerce_version_check') ){
function fl_woocommerce_version_check( $version = '2.6' ) {
if( version_compare( WC()->version, $version, ">=" ) ) {
return true;
}
return false;
}
}
/* Get Site URL shortcode */
if( ! function_exists( 'flatsome_site_path' ) ) {
function flatsome_site_path(){
return site_url();
}
}
add_shortcode('site_url', 'flatsome_site_path');
add_shortcode('site_url_secure', 'flatsome_site_path');
/* Get Year */
if( ! function_exists( 'flatsome_show_current_year' ) ) {
function flatsome_show_current_year(){
return date('Y');
}
}
add_shortcode('ux_current_year', 'flatsome_show_current_year');
function flatsome_get_post_type_items($post_type, $args_extended=array()) {
global $post;
$old_post = $post;
$return = false;
$args = array(
'post_type'=>$post_type
, 'post_status'=>'publish'
, 'showposts'=>-1
, 'order'=>'ASC'
, 'orderby'=>'title'
);
if ($args && count($args_extended)) {
$args = array_merge($args, $args_extended);
}
query_posts($args);
if (have_posts()) {
global $post;
$return = array();
while (have_posts()) {
the_post();
$return[get_the_ID()] = $post;
}
}
wp_reset_query();
$post = $old_post;
return $return;
}
function flatsome_is_request( $type ) {
switch ( $type ) {
case 'admin' :
return is_admin();
case 'ajax' :
return defined( 'DOING_AJAX' );
case 'frontend' :
return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' );
}
}
function flatsome_api_url() {
$api_url = 'https://flatsome-api.netlify.com';
if ( defined( 'FLATSOME_API_URL' ) && FLATSOME_API_URL ) {
$api_url = FLATSOME_API_URL;
}
return $api_url;
}
function flatsome_facebook_accounts() {
$theme_mod = get_theme_mod( 'facebook_accounts', array() );
return array_filter( $theme_mod, function ( $account ) {
return ! empty( $account );
} );
}
/**
* Returns the current Facebook GraphAPI version beeing used.
*
* @since 3.13
*
* @return string
*/
function flatsome_facebook_api_version() {
return 'v8.0';
}
// Get block id by ID or slug.
function flatsome_get_block_id( $post_id ) {
global $wpdb;
if ( empty ( $post_id ) ) {
return null;
}
// Get post ID if using post_name as id attribute.
if ( ! is_numeric( $post_id ) ) {
$post_id = $wpdb->get_var(
$wpdb->prepare(
"SELECT ID FROM $wpdb->posts WHERE post_type = 'blocks' AND post_name = %s",
$post_id
)
);
}
// Polylang support.
if ( function_exists( 'pll_get_post' ) ) {
if ( $lang_id = pll_get_post( $post_id ) ) {
$post_id = $lang_id;
}
}
// WPML Support.
if ( function_exists( 'icl_object_id' ) ) {
if ( $lang_id = icl_object_id( $post_id, 'blocks', false, ICL_LANGUAGE_CODE ) ) {
$post_id = $lang_id;
}
}
return $post_id;
}
/**
* Retrieve a list of blocks.
*
* @param array|string $args Optional. Array or string of arguments.
*
* @return array|false List of blocks matching defaults or `$args`.
*/
function flatsome_get_block_list_by_id( $args = '' ) {
$defaults = array(
'option_none' => '',
);
$parsed_args = wp_parse_args( $args, $defaults );
$blocks = array();
if ( $parsed_args['option_none'] ) {
$blocks = array( 0 => $parsed_args['option_none'] );
}
$posts = flatsome_get_post_type_items( 'blocks' );
if ( $posts ) {
foreach ( $posts as $value ) {
$blocks[ $value->ID ] = $value->post_title;
}
}
return $blocks;
}
/**
* Calls a shortcode function by its tag name.
*
* @param string $tag The shortcode of the function to be called.
* @param array $atts The attributes to pass to the shortcode function (optional).
* @param array $content The content of the shortcode (optional).
*
* @return bool|string If a shortcode tag doesn't exist => false, if exists => the result of the shortcode.
*/
function flatsome_apply_shortcode( $tag, $atts = array(), $content = null ) {
global $shortcode_tags;
if ( ! isset( $shortcode_tags[ $tag ] ) ) return false;
return call_user_func( $shortcode_tags[ $tag ], $atts, $content, $tag );
}
/**
* Hides characters in a string.
*
* @param string $string The token.
* @param int $visible_chars How many characters to show.
* @return string
*/
function flatsome_hide_chars( $string, $visible_chars = 4 ) {
if ( ! is_string( $string ) ) {
$string = '';
}
if ( strlen( $string ) <= $visible_chars ) {
$visible_chars = strlen( $string ) - 2;
}
$chars = str_split( $string );
$end = strlen( $string ) - $visible_chars;
for ( $i = $visible_chars; $i < $end; $i++ ) {
if ( $chars[ $i ] === '-' ) continue;
$chars[ $i ] = '*';
}
return implode( '', $chars );
}
/**
* Normalizes the theme directory name.
*
* @param string $slug Optional theme slug.
* @return string
*/
function flatsome_theme_key( $slug = null ) {
if ( empty( $slug ) ) {
$slug = basename( get_template_directory() );
}
$slug = trim( $slug );
$slug = preg_replace( '/[,.\s]+/', '-', $slug );
$slug = strtolower( $slug );
return $slug;
}
/**
* Check if support is expired.
*
* @return bool
*/
function flatsome_is_support_expired() {
_deprecated_function( __FUNCTION__, '3.14' );
return true;
}
/**
* Check if support time is invalid.
*
* @param string $support_ends Support end timestamp.
*
* @return bool True if invalid false otherwise.
*/
function flatsome_is_invalid_support_time( $support_ends ) {
_deprecated_function( __FUNCTION__, '3.14' );
return false;
}
/**
* Checks whether theme is registered.
*
* @return bool
*/
function flatsome_is_theme_enabled() {
return flatsome_envato()->registration->is_registered();
}

View File

@@ -0,0 +1,48 @@
<?php
function flatsome_maintenance_mode() {
// Exit if not active.
if ( ! get_theme_mod( 'maintenance_mode', 0 ) ) {
return;
}
global $pagenow;
nocache_headers();
if ( $pagenow !== 'wp-login.php' && ! current_user_can( 'manage_options' ) && ! is_admin() ) {
// Remove Woocommerce store notice.
remove_action( 'wp_footer', 'woocommerce_demo_store' );
remove_action( 'wp_footer', 'flatsome_cookie_notice_template' );
// Clear Cachify Cache.
if ( has_action( 'cachify_flush_cache' ) ) {
do_action( 'cachify_flush_cache' );
}
// Clear Super Cache.
if ( function_exists( 'wp_cache_clear_cache' ) ) {
ob_end_clean();
wp_cache_clear_cache();
}
// Clear W3 Total Cache.
if ( function_exists( 'w3tc_pgcache_flush' ) ) {
ob_end_clean();
w3tc_pgcache_flush();
}
$protocol = wp_get_server_protocol();
header( "$protocol 503 Service Unavailable", true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Retry-After: 600' );
get_template_part( 'maintenance' );
die();
}
}
add_action( 'template_redirect', 'flatsome_maintenance_mode' );

View File

@@ -0,0 +1,92 @@
<?php
/**
* Flatsome Included Plugins
*
* @author UX Themes
* @package Flatsome/Functions
*/
/**
* Calls tgmpa() with $plugins & $config arrays
*/
function flatsome_register_required_plugins() {
$wc_required = wp_get_theme( get_template() )->get( 'WC requires at least' );
/**
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
array(
'name' => 'WooCommerce',
'slug' => 'woocommerce',
'version' => $wc_required ? $wc_required : '',
),
array(
'name' => 'Nextend Social Login', // The plugin name.
'slug' => 'nextend-facebook-connect', // The plugin slug (typically the folder name).
),
array(
'name' => is_yith_wishlist_premium() ? 'YITH WooCommerce Wishlist Premium' : 'YITH WooCommerce Wishlist', // The plugin name.
'slug' => is_yith_wishlist_premium() ? 'yith-woocommerce-wishlist-premium' : 'yith-woocommerce-wishlist', // The plugin slug (typically the folder name).
'image_url' => get_template_directory_uri() . '/assets/admin/plugin-thumbs/wishlist.png',
),
array(
'name' => 'Contact Form 7',
'slug' => 'contact-form-7',
'version' => '4.4.2',
),
);
/**
* Array of configuration settings. Amend each line as needed.
* If you want the default strings to be available under your own theme domain,
* leave the strings uncommented.
* Some of the strings are added into a sprintf, so see the comments at the
* end of each line for what each argument will be.
*/
$config = array(
'default_path' => '', // Default absolute path to pre-packaged plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'tgmpa' ),
'menu_title' => __( 'Install Plugins', 'tgmpa' ),
// translators: %s = plugin name.
'installing' => __( 'Installing Plugin: %s', 'tgmpa' ),
'oops' => __( 'Something went wrong with the plugin API.', 'tgmpa' ),
// translators: %1$s = plugin name(s).
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'tgmpa' ),
// translators: %1$s = plugin name(s).
'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'tgmpa' ),
// translators: %1$s = plugin name(s).
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.', 'tgmpa' ),
// translators: %1$s = plugin name(s).
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'tgmpa' ),
// translators: %1$s = plugin name(s).
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'tgmpa' ),
// translators: %1$s = plugin name(s).
'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'tgmpa' ),
// translators: %1$s = plugin name(s).
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'tgmpa' ),
// translators: %1$s = plugin name(s).
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.', 'tgmpa' ),
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'tgmpa' ),
'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'tgmpa' ),
'return' => __( 'Return to Required Plugins Installer', 'tgmpa' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'tgmpa' ),
// translators: %s = dashboard link.
'complete' => __( 'All plugins installed and activated successfully. %s', 'tgmpa' ),
'nag_type' => 'updated', // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
),
);
tgmpa( $plugins, $config );
}
require get_template_directory() . '/inc/classes/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'flatsome_register_required_plugins' );

View File

@@ -0,0 +1,466 @@
<?php
function get_flatsome_header_presets() {
return array(
'header-default' => array(
'label' => __( 'Header Default', 'kirki' ),
'settings' => array(
"topbar_show" => 1,
"topbar_elements_left" => array( "html" ),
"topbar_elements_center" => array(),
"topbar_elements_right" => array( "nav-top", "social" ),
"header_elements_left" => array( "search", "nav" ),
"header_elements_right" => array( "account", "divider", "cart" ),
"header_elements_bottom_left" => array(),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array( "html" ),
"header_mobile_elements_left" => array( "menu-icon" ),
"header_mobile_elements_right" => array( "cart" ),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "search-form", "nav", "account", "html-2", "html-3" ),
"header_top_height" => "30",
"topbar_color" => "dark",
"topbar_bg" => "",
"nav_style_top" => "divided",
"logo_position" => "left",
"header_width" => "container",
"header_height" => "100",
"header_color" => "light",
"header_bg" => "rgba(255,255,255,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"nav_style" => "",
"nav_size" => "",
"type_nav_color" => "",
"type_nav_color_hover" => "",
"nav_uppercase" => "1",
"header_height_transparent" => "",
"header_bg_transparent" => "",
"header_bg_transparent_shade" => "0",
"header_bottom_height" => "",
"nav_position_bg" => "#f1f1f1",
"nav_position_color" => "light",
"nav_style_bottom" => "",
"nav_size_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
),
),
'header-default-center' => array(
'label' => __( 'Header Default Center', 'kirki' ),
'settings' => array(
"topbar_show" => 1,
"topbar_elements_left" => array( "html" ),
"topbar_elements_center" => array(),
"topbar_elements_right" => array( "nav-top", "social" ),
"header_elements_left" => array( "search", "nav" ),
"header_elements_right" => array( "account", "divider", "cart" ),
"header_elements_bottom_left" => array(),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array( "html" ),
"header_mobile_elements_left" => array( "menu-icon" ),
"header_mobile_elements_right" => array( "cart" ),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "search-form", "nav", "account", "html-2", "html-3" ),
"header_top_height" => "30",
"topbar_color" => "dark",
"topbar_bg" => "",
"nav_style_top" => "divided",
"logo_position" => "center",
"header_width" => "container",
"header_height" => "100",
"header_color" => "light",
"header_bg" => "rgba(255,255,255,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"header_bottom_height" => "",
"nav_position_bg" => "#f1f1f1",
"nav_position_color" => "light",
"nav_style_bottom" => "",
"nav_size_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
),
),
'header-default-dark' => array(
'label' => __( 'Header Default Dark', 'kirki' ),
'settings' => array(
"topbar_show" => 0,
"topbar_elements_left" => array(),
"topbar_elements_center" => array(),
"topbar_elements_right" => array(),
"header_elements_left" => array( "search", "nav" ),
"header_elements_right" => array( "account", "divider", "cart" ),
"header_elements_bottom_left" => array(),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array( "html" ),
"header_mobile_elements_left" => array( "menu-icon" ),
"header_mobile_elements_right" => array( "cart" ),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "search-form", "nav", "account", "html-2", "html-3" ),
"header_top_height" => array( "30" ),
"topbar_color" => "dark",
"topbar_bg" => "",
"nav_style_top" => "divided",
"logo_position" => "left",
"header_width" => "container",
"header_height" => "100",
"header_color" => "dark",
"header_bg" => "rgba(0,0,0,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"nav_style" => "",
"nav_size" => "",
"type_nav_color" => "",
"type_nav_color_hover" => "",
"nav_uppercase" => "1",
"header_height_transparent" => "",
"header_bg_transparent" => "",
"header_bg_transparent_shade" => "0",
"header_bottom_height" => "",
"nav_position_bg" => "#f1f1f1",
"nav_position_color" => "light",
"nav_style_bottom" => "",
"nav_size_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
),
),
'header-wide-nav-dark' => array(
'label' => __( 'Header Wide Nav Dark', 'kirki' ),
'settings' => array(
"topbar_show" => 1,
"topbar_elements_left" => array( "html" ),
"topbar_elements_center" => array(),
"topbar_elements_right" => array( "nav-top", "social" ),
"header_elements_left" => array( "search-form" ),
"header_elements_right" => array( "account", "divider", "cart" ),
"header_elements_bottom_left" => array( "nav" ),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array( "html" ),
"header_mobile_elements_left" => array( "menu-icon" ),
"header_mobile_elements_right" => array( "cart" ),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "search-form", "nav", "account", "html-2", "html-3" ),
"logo_width" => "166",
"topbar_color" => "dark",
"topbar_bg" => "rgba(94,94,94,0.42)",
"nav_style_top" => "divided",
"logo_position" => "left",
"header_width" => "container",
"header_height" => "91",
"header_color" => "dark",
"header_bg" => "rgba(22,22,22,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"nav_style" => "",
"nav_size" => "",
"type_nav_color" => "",
"type_nav_color_hover" => "",
"nav_uppercase" => "1",
"header_height_transparent" => "",
"header_bg_transparent" => "",
"header_bg_transparent_shade" => "0",
"header_bottom_height" => "",
"nav_position_bg" => "#0A0A0A",
"nav_position_color" => "dark",
"nav_style_bottom" => "",
"nav_size_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
),
),
'header-wide-nav' => array(
'label' => __( 'Header Wide Nav', 'kirki' ),
'settings' => array(
"topbar_show" => 1,
"topbar_elements_left" => array( "html" ),
"topbar_elements_center" => array(),
"topbar_elements_right" => array( "nav-top", "social" ),
"header_elements_left" => array( "search-form" ),
"header_elements_right" => array( "account", "divider", "cart" ),
"header_elements_bottom_left" => array( "nav" ),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array( "html" ),
"header_mobile_elements_left" => array( "menu-icon" ),
"header_mobile_elements_right" => array( "cart" ),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "search-form", "nav", "account", "html-2", "html-3" ),
"logo_width" => "166",
"header_top_height" => "30",
"topbar_color" => "dark",
"topbar_bg" => "",
"nav_style_top" => "divided",
"logo_position" => "left",
"header_width" => "container",
"header_height" => "91",
"header_color" => "light",
"header_bg" => "rgba(255,255,255,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"nav_style" => "",
"nav_size" => "",
"type_nav_color" => "",
"type_nav_color_hover" => "",
"nav_uppercase" => "1",
"header_height_transparent" => "",
"header_bg_transparent" => "",
"header_bg_transparent_shade" => "0",
"header_bottom_height" => "43",
"nav_position_bg" => "#424242",
"nav_position_color" => "dark",
"nav_style_bottom" => "",
"nav_size_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
),
),
'header-simple' => array(
'label' => __( 'Header Simple', 'kirki' ),
'settings' => array(
"topbar_show" => 0,
"topbar_elements_left" => array(),
"topbar_elements_center" => array(),
"topbar_elements_right" => array(),
"header_elements_left" => array(),
"header_elements_right" => array( "search", "menu-icon" ),
"header_elements_bottom_left" => array(),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array(),
"header_mobile_elements_left" => array(),
"header_mobile_elements_right" => array( "search", "menu-icon" ),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "search-form", "nav", "account", "html-2", "html-3" ),
"header_top_height" => array( "30" ),
"topbar_color" => "dark",
"topbar_bg" => "",
"nav_style_top" => "divided",
"logo_position" => "left",
"header_width" => "container",
"header_height" => "72",
"header_color" => "light",
"header_bg" => "rgba(255,255,255,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"nav_style" => "",
"nav_size" => "",
"type_nav_color" => "",
"type_nav_color_hover" => "",
"nav_uppercase" => "1",
"header_height_transparent" => "",
"header_bg_transparent" => "",
"header_bg_transparent_shade" => "0",
"header_bottom_height" => "",
"nav_position_bg" => "#f1f1f1",
"nav_position_color" => "light",
"nav_style_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
),
),
'header-simple-center' => array(
'label' => __( 'Header Simple Center', 'kirki' ),
'settings' => array(
"topbar_show" => 0,
"topbar_elements_left" => array(),
"topbar_elements_center" => array(),
"topbar_elements_right" => array(),
"header_elements_left" => array( "menu-icon" ),
"header_elements_right" => array( "search" ),
"header_elements_bottom_left" => array(),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array(),
"header_mobile_elements_left" => array( "menu-icon" ),
"header_mobile_elements_right" => array( "search" ),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "search-form", "nav", "html-2", "html-3" ),
"header_top_height" => array( "30" ),
"topbar_color" => "dark",
"topbar_bg" => "",
"nav_style_top" => "divided",
"logo_position" => "center",
"header_width" => "container",
"header_height" => "72",
"header_color" => "light",
"header_bg" => "rgba(240,240,240,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"nav_style" => "",
"nav_size" => "",
"type_nav_color" => "",
"type_nav_color_hover" => "",
"nav_uppercase" => "1",
"header_height_transparent" => "",
"header_bg_transparent" => "",
"header_bg_transparent_shade" => "0",
"header_bottom_height" => "",
"nav_position_bg" => "#f1f1f1",
"nav_position_color" => "light",
"nav_style_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
),
),
'header-simple-signup' => array(
'label' => __( 'Header Simple Signup', 'kirki' ),
'settings' => array(
"topbar_show" => 0,
"topbar_elements_left" => array(),
"topbar_elements_center" => array(),
"topbar_elements_right" => array(),
"header_elements_left" => array( "search", "nav" ),
"header_elements_right" => array( "button-1", "button-2" ),
"header_elements_bottom_left" => array(),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array(),
"header_mobile_elements_left" => array( "menu-icon" ),
"header_mobile_elements_right" => array(),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "search-form", "nav", "button-1", "button-2", "html-2", "html-3" ),
"logo_width" => "176",
"topbar_color" => "dark",
"topbar_bg" => "",
"nav_style_top" => "divided",
"logo_position" => "left",
"header_width" => "container",
"header_height" => "83",
"header_color" => "light",
"header_bg" => "rgba(255,255,255,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"nav_style" => "",
"nav_size" => "",
"type_nav_color" => "",
"type_nav_color_hover" => "",
"nav_uppercase" => "1",
"header_height_transparent" => "",
"header_bg_transparent" => "",
"header_bg_transparent_shade" => "0",
"header_bottom_height" => "",
"nav_position_bg" => "#f1f1f1",
"nav_position_color" => "light",
"nav_style_bottom" => "",
"nav_size_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
"header_button_1" => "Sign Up",
"header_button_2" => "Join",
"header_button_2_color" => "plain",
),
),
'header-simple-right-buttons' => array(
'label' => __( 'Header Simple Right Buttons', 'kirki' ),
'settings' => array(
"topbar_show" => 0,
"topbar_elements_left" => array(),
"topbar_elements_center" => array(),
"topbar_elements_right" => array(),
"header_elements_left" => array(),
"header_elements_right" => array( "nav", "search", "button-1", "button-2" ),
"header_elements_bottom_left" => array(),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array(),
"header_mobile_elements_left" => array( "menu-icon" ),
"header_mobile_elements_right" => array( "search" ),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "button-1", "button-2", "nav", "html-2", "html-3", "social" ),
"logo_width" => "176",
"topbar_color" => "dark",
"topbar_bg" => "",
"nav_style_top" => "divided",
"logo_position" => "left",
"header_width" => "container",
"header_height" => "83",
"header_color" => "light",
"header_bg" => "rgba(255,255,255,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"nav_style" => "",
"nav_size" => "",
"type_nav_color" => "",
"type_nav_color_hover" => "",
"nav_uppercase" => "1",
"header_height_transparent" => "",
"header_bg_transparent" => "",
"header_bg_transparent_shade" => "0",
"header_bottom_height" => "",
"nav_position_bg" => "#f1f1f1",
"nav_position_color" => "light",
"nav_style_bottom" => "",
"nav_size_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
"header_button_1" => "Sign Up",
"header_button_2" => "Join",
"header_button_2_color" => "plain",
),
),
'header-cart-top' => array(
'label' => __( 'Header Cart Top', 'kirki' ),
'settings' => array(
"topbar_show" => 1,
"topbar_elements_left" => array( "html" ),
"topbar_elements_center" => array(),
"topbar_elements_right" => array( "nav-top", "account", "cart" ),
"header_elements_left" => array( "nav" ),
"header_elements_right" => array( "search-form" ),
"header_elements_bottom_left" => array(),
"header_elements_bottom_center" => array(),
"header_elements_bottom_right" => array(),
"header_mobile_elements_top" => array( "html" ),
"header_mobile_elements_left" => array( "menu-icon" ),
"header_mobile_elements_right" => array( "search", "cart" ),
"header_mobile_elements_bottom" => array(),
"mobile_sidebar" => array( "nav", "divider_3", "nav-top", "account", "html-2", "html-3" ),
"logo_width" => "169",
"header_top_height" => array( "33" ),
"topbar_color" => "dark",
"topbar_bg" => "",
"nav_style_top" => "divided",
"logo_position" => "left",
"header_width" => "container",
"header_height" => "83",
"header_color" => "light",
"header_bg" => "rgba(255,255,255,0.9)",
"header_bg_img_repeat" => "repeat-x",
"box_shadow_header" => "0",
"nav_style" => "",
"nav_size" => "",
"nav_push" => "0",
"type_nav_color" => "",
"type_nav_color_hover" => "",
"nav_uppercase" => "1",
"header_height_transparent" => "",
"header_bg_transparent" => "",
"header_bg_transparent_shade" => "0",
"header_bottom_height" => "",
"nav_position_bg" => "#f1f1f1",
"nav_position_color" => "light",
"nav_style_bottom" => "",
"nav_size_bottom" => "",
"type_nav_bottom_color" => "",
"type_nav_bottom_color_hover" => "",
"nav_uppercase_bottom" => "1",
"header_search_width" => "100",
),
),
);
}

View File

@@ -0,0 +1,331 @@
<?php
if ( ! isset( $content_width ) ) {
$content_width = 1020; // Pixels.
}
/**
* Initialized Envato and Flatsome Account implementation.
*/
flatsome_envato();
/**
* Only load styles for used blocks.
*/
add_filter( 'should_load_separate_core_block_assets', '__return_true' );
/**
* Setup Flatsome.
*/
function flatsome_setup() {
/* add woocommerce support */
add_theme_support( 'woocommerce' );
if ( get_theme_mod( 'wpseo_breadcrumb' ) ) {
add_theme_support( 'yoast-seo-breadcrumbs' );
}
/* add title tag support */
add_theme_support( 'title-tag' );
/* Load child theme languages */
load_theme_textdomain( 'flatsome', get_stylesheet_directory() . '/languages' );
/* load theme languages */
load_theme_textdomain( 'flatsome', get_template_directory() . '/languages' );
/* Add default posts and comments RSS feed links to head */
add_theme_support( 'automatic-feed-links' );
/* Add excerpt to pages */
add_post_type_support( 'page', 'excerpt' );
/* Add support for post thumbnails */
add_theme_support( 'post-thumbnails' );
/* Add support for Selective Widget refresh */
add_theme_support( 'customize-selective-refresh-widgets' );
/** Add sensei support */
add_theme_support( 'sensei' );
/* Add support for HTML5 */
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'widgets',
) );
/* Register menus. */
register_nav_menus( array(
'primary' => __( 'Main Menu', 'flatsome' ),
'primary_mobile' => __( 'Main Menu - Mobile', 'flatsome' ),
'footer' => __( 'Footer Menu', 'flatsome' ),
'top_bar_nav' => __( 'Top Bar Menu', 'flatsome' ),
'my_account' => __( 'My Account Menu', 'flatsome' ),
'vertical' => __( 'Vertical Menu', 'flatsome' ),
) );
/* Enable support for Post Formats */
add_theme_support( 'post-formats', array( 'video' ) );
// Disable widgets-block-editor for now.
remove_theme_support( 'widgets-block-editor' );
}
add_action( 'after_setup_theme', 'flatsome_setup' );
/**
* Setup Theme Widgets
*/
function flatsome_widgets_init() {
$title_before = '';
$title_class = '';
$title_after = '<div class="is-divider small"></div>';
register_sidebar( array(
'name' => __( 'Sidebar', 'flatsome' ),
'id' => 'sidebar-main',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => $title_before . '<span class="widget-title ' . $title_class . '"><span>',
'after_title' => '</span></span>' . $title_after,
) );
register_sidebar( array(
'name' => __( 'Footer 1', 'flatsome' ),
'id' => 'sidebar-footer-1',
'before_widget' => '<div id="%1$s" class="col pb-0 widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<span class="widget-title">',
'after_title' => '</span><div class="is-divider small"></div>',
) );
register_sidebar( array(
'name' => __( 'Footer 2', 'flatsome' ),
'id' => 'sidebar-footer-2',
'before_widget' => '<div id="%1$s" class="col pb-0 widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<span class="widget-title">',
'after_title' => '</span><div class="is-divider small"></div>',
) );
}
add_action( 'widgets_init', 'flatsome_widgets_init' );
/**
* Setup Flatsome Styles and Scripts
*/
function flatsome_scripts() {
$uri = get_template_directory_uri();
$theme = wp_get_theme( get_template() );
$version = $theme->get( 'Version' );
// Styles.
wp_enqueue_style( 'flatsome-main', $uri . '/assets/css/flatsome.css', array(), $version, 'all' );
wp_style_add_data( 'flatsome-main', 'rtl', 'replace' );
if ( is_woocommerce_activated() ) {
wp_enqueue_style( 'flatsome-shop', $uri . '/assets/css/flatsome-shop.css', array(), $version, 'all' );
wp_style_add_data( 'flatsome-shop', 'rtl', 'replace' );
}
// Load current theme styles.css file.
if ( ! get_theme_mod( 'flatsome_disable_style_css', 0 ) ) {
wp_enqueue_style( 'flatsome-style', get_stylesheet_uri(), array(), wp_get_theme()->get( 'Version' ), 'all' );
}
// Register styles (Loaded on request).
wp_register_style( 'flatsome-effects', $uri . '/assets/css/effects.css', array(), $version, 'all' );
// Register scripts (Loaded on request).
wp_register_script( 'flatsome-masonry-js', $uri . '/assets/libs/packery.pkgd.min.js', array( 'jquery' ), $version, true );
wp_register_script( 'flatsome-isotope-js', $uri . '/assets/libs/isotope.pkgd.min.js', array( 'jquery', 'flatsome-js' ), $version, true );
// Google maps.
$maps_api = trim( get_theme_mod( 'google_map_api' ) );
if ( ! empty( $maps_api ) ) {
wp_register_script( 'flatsome-maps', '//maps.googleapis.com/maps/api/js?key=' . $maps_api, array( 'jquery' ), $version, true );
}
// Enqueue theme scripts.
flatsome_enqueue_asset( 'flatsome-js', 'flatsome', array( 'jquery', 'hoverIntent' ) );
$sticky_height = get_theme_mod( 'header_height_sticky', 70 );
if ( is_admin_bar_showing() ) {
$sticky_height = $sticky_height + 30;
}
$lightbox_close_markup = apply_filters('flatsome_lightbox_close_button', '<button title="%title%" type="button" class="mfp-close"><svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></button>');
$localize_data = array(
'theme' => array( 'version' => $version ),
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'rtl' => is_rtl(),
'sticky_height' => $sticky_height,
'assets_url' => $uri . '/assets/js/',
'lightbox' => array(
'close_markup' => $lightbox_close_markup,
'close_btn_inside' => apply_filters( 'flatsome_lightbox_close_btn_inside', false ),
),
'user' => array(
'can_edit_pages' => current_user_can( 'edit_pages' ),
),
'i18n' => array(
'mainMenu' => __( 'Main Menu', 'flatsome' ),
),
'options' => array(
'cookie_notice_version' => get_theme_mod( 'cookie_notice_version', '1' ),
'swatches_layout' => get_theme_mod( 'swatches_layout' ),
'swatches_box_select_event' => get_theme_mod( 'swatches_box_select_event' ),
'swatches_box_behavior_selected' => get_theme_mod( 'swatches_box_behavior_selected' ),
'swatches_box_update_urls' => get_theme_mod( 'swatches_box_update_urls', '1' ),
'swatches_box_reset' => get_theme_mod( 'swatches_box_reset' ),
'swatches_box_reset_extent' => get_theme_mod( 'swatches_box_reset_extent' ),
'swatches_box_reset_time' => get_theme_mod( 'swatches_box_reset_time', 300 ),
'search_result_latency' => get_theme_mod( 'search_result_latency', '0' ),
),
);
if ( is_woocommerce_activated() ) {
$wc_localize_data = array(
'is_mini_cart_reveal' => flatsome_is_mini_cart_reveal(),
);
$localize_data = array_merge( $localize_data, $wc_localize_data );
}
// Add variables to scripts.
wp_localize_script( 'flatsome-js', 'flatsomeVars', $localize_data );
if ( is_woocommerce_activated() ) {
flatsome_enqueue_asset( 'flatsome-theme-woocommerce-js', 'woocommerce', array( 'flatsome-js' ) );
}
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Custom Properties polyfill for Internet Explorer.
wp_register_script( 'css-vars-polyfill', 'https://cdn.jsdelivr.net/gh/nuxodin/ie11CustomProperties@4.0.1/ie11CustomProperties.min.js', array(), '4.0.1', true );
wp_script_add_data( 'css-vars-polyfill', 'conditional', 'IE' );
// IntersectionObserver polyfill for IE.
wp_enqueue_script( 'intersection-observer-polyfill', 'https://cdn.jsdelivr.net/npm/intersection-observer-polyfill@0.1.0/dist/IntersectionObserver.js', array(), '0.1.0', true );
wp_script_add_data( 'intersection-observer-polyfill', 'conditional', 'IE' );
}
add_action( 'wp_enqueue_scripts', 'flatsome_scripts', 100 );
/**
* Set up UX Builder.
*/
function flatsome_ux_builder_setup() {
// Add Ux Builder to post types.
add_ux_builder_post_type( 'blocks' );
add_ux_builder_post_type( 'product' );
add_ux_builder_post_type( 'featured_item' );
}
add_action( 'init', 'flatsome_ux_builder_setup', 10 );
/**
* Enqueue UX Builder scripts.
*
* @param string $context Context is «editor» or content.
*/
function flatsome_ux_builder_scripts( $context ) {
$uri = get_template_directory_uri();
$theme = wp_get_theme( get_template() );
$version = $theme->get( 'Version' );
// Add UxBuilder assets.
if ( $context == 'editor' ) {
flatsome_enqueue_asset( 'ux-builder-flatsome', 'builder/custom/editor', array( 'ux-builder-core' ) );
wp_enqueue_style( 'ux-builder-flatsome', $uri . '/assets/css/builder/custom/builder.css', array( 'ux-builder-core' ), $version );
}
if ( $context == 'content' ) {
wp_enqueue_style( 'ux-builder-flatsome', $uri . '/assets/css/builder/custom/builder.css', null, $version );
flatsome_enqueue_asset( 'ux-builder-flatsome', 'builder/custom/content', array(
'flatsome-js',
'flatsome-masonry-js',
) );
}
}
add_action( 'ux_builder_enqueue_scripts', 'flatsome_ux_builder_scripts', 10 );
if ( ! is_admin() && get_theme_mod( 'lazy_load_backgrounds', 1 ) ) {
/**
* Lazy load backgrounds
*/
function flatsome_lazy_load_backgrounds_css() {
echo '<style>.bg{opacity: 0; transition: opacity 1s; -webkit-transition: opacity 1s;} .bg-loaded{opacity: 1;}</style>';
}
add_filter( 'wp_head', 'flatsome_lazy_load_backgrounds_css' );
}
/**
* Remove jQuery migrate.
*
* @param WP_Scripts $scripts WP_Scripts object.
*/
function flatsome_remove_jquery_migrate( $scripts ) {
if ( ! get_theme_mod( 'jquery_migrate' ) ) return;
if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
$script = $scripts->registered['jquery'];
if ( $script->deps ) { // Check whether the script has any dependencies.
$script->deps = array_diff( $script->deps, array(
'jquery-migrate',
) );
}
}
}
add_action( 'wp_default_scripts', 'flatsome_remove_jquery_migrate' );
// Disable emoji scripts
if ( ! is_admin() && get_theme_mod( 'disable_emoji', 0 ) ) {
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
}
function flatsome_deregister_block_styles() {
if ( ! is_admin() && get_theme_mod( 'disable_blockcss', 0 ) ) {
wp_dequeue_style( 'wp-block-library' );
}
}
add_action( 'wp_print_styles', 'flatsome_deregister_block_styles', 100 );
/**
* Prefetch lazy-loaded chunks.
*/
function flatsome_prefetch_scripts() {
$manifest_path = get_template_directory() . '/assets/js/manifest.json';
$template_uri = get_template_directory_uri();
if ( ! file_exists( $manifest_path ) ) return;
$json = file_get_contents( $manifest_path );
$manifest = json_decode( $json, true );
foreach ( $manifest as $path ) {
$href = esc_attr( "$template_uri/assets/js/$path" );
echo "<link rel=\"prefetch\" href=\"$href\" />\n";
}
}
add_action( 'wp_head', 'flatsome_prefetch_scripts', 5 );

View File

@@ -0,0 +1,87 @@
<?php
/**
* Adds site status tests for Flatsome registration.
*
* @param array $tests An associative array of tests.
* @return array
*/
function flatsome_site_status_tests( $tests ) {
$tests['direct']['flatsome_registration'] = array(
'label' => __( 'Flatsome registration', 'flatsome' ),
'test' => 'flatsome_site_health_registration_test',
);
return $tests;
}
add_filter( 'site_status_tests', 'flatsome_site_status_tests' );
/**
* Performs the registration status test.
*
* @return array
*/
function flatsome_site_health_registration_test() {
if ( is_a( flatsome_envato()->registration, 'Flatsome_Envato_Registration' ) ) {
return array(
'test' => 'flatsome_token',
'label' => __( 'You should register Flatsome with a purchase code', 'flatsome' ),
'status' => 'critical',
'badge' => array(
'label' => __( 'Security', 'flatsome' ),
'color' => 'blue',
),
'description' => sprintf(
'<p>%s</p>',
__( 'Your copy of Flatsome is registered with a personal Envato token. Please register Flatsome with a purchase code instead to ensure your site receives updates in the future.', 'flatsome' )
),
'actions' => sprintf(
'<p><a href="%s">%s</a></p>',
esc_url( admin_url( 'admin.php?page=flatsome-panel' ) ),
__( 'Register with a purchase code now', 'flatsome' )
),
);
}
$errors = flatsome_envato()->registration->get_errors();
$result = array(
'test' => 'flatsome_registration',
'label' => __( 'Flatsome is registered', 'flatsome' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Security', 'flatsome' ),
'color' => 'blue',
),
'description' => sprintf( '<p>%s</p>', __( 'Register Flatsome to receive updates.', 'flatsome' ) ),
'actions' => '',
);
if ( ! flatsome_envato()->registration->is_registered() ) {
$result['status'] = 'critical';
$result['label'] = __( 'Flatsome is not registered', 'flatsome' );
$result['actions'] = sprintf(
'<p><a href="%s">%s</a></p>',
esc_url( admin_url( 'admin.php?page=flatsome-panel' ) ),
__( 'Register now', 'flatsome' )
);
} elseif ( ! empty( $errors ) ) {
$result['status'] = 'critical';
$result['label'] = __( 'Flatsome was unable to receive the latest update', 'flatsome' );
$result['description'] = sprintf( '<p>%s</p>', implode( '</p><p>', $errors ) );
?>
<p>
<a href="<?php echo esc_url_raw( admin_url( 'admin.php?page=flatsome-panel' ) ); ?>">
<?php esc_html_e( 'Manage registration', 'flatsome' ); ?>
</a>
</p>
<p>
<a href="<?php echo esc_url_raw( UXTHEMES_ACCOUNT_URL ); ?>" target="_blank" rel="noopener noreferrer">
<?php esc_html_e( 'Manage your licenses', 'flatsome' ); ?>
</a>
</p>
<?php
$result['actions'] = ob_get_clean();
}
return $result;
}

View File

@@ -0,0 +1,30 @@
<?php
$_flatsome_theme_mod_site_url = site_url( '', 'http' );
$_flatsome_theme_mod_site_url_secure = site_url( '', 'https' );
function flatsome_theme_mod_fix ( $value ) {
if ( ! is_string( $value ) ) return $value;
global $_flatsome_theme_mod_site_url;
global $_flatsome_theme_mod_site_url_secure;
return str_replace(
array( '[site_url]', '[site_url_secure]' ),
array( $_flatsome_theme_mod_site_url, $_flatsome_theme_mod_site_url_secure ),
$value
);
}
add_filter( 'theme_mod_footer_1_bg_image', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_footer_2_bg_image', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_custom_cart_icon', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_site_logo', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_site_logo_dark', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_header_bg_img', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_header_newsletter_bg', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_site_logo_sticky', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_body_bg_image', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_portfolio_archive_bg', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_header_shop_bg_image', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_facebook_login_bg', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_payment_icons_custom', 'flatsome_theme_mod_fix' );
add_filter( 'theme_mod_follow_snapchat', 'flatsome_theme_mod_fix' );

View File

@@ -0,0 +1,132 @@
<?php
/**
* Flatsome Update Functions
*
* @author UX Themes
* @package Flatsome/Functions
*/
/**
* Inject update data for Flatsome to `_site_transient_update_themes`.
* The `package` property is a temporary URL which will be replaced with
* an actual URL to a zip file in the `upgrader_package_options` hook when
* WordPress runs the upgrader.
*
* @param array $transient The pre-saved value of the `update_themes` site transient.
* @return array
*/
function flatsome_get_update_info( $transient ) {
static $latest_version;
if ( ! isset( $transient->checked ) ) {
return $transient;
}
$theme = wp_get_theme( get_template() );
$template = $theme->get_template();
$version = $theme->get( 'Version' );
$update_details = array(
'theme' => $template,
'new_version' => $version,
'url' => add_query_arg(
array(
'version' => $version,
),
esc_url( admin_url( 'admin.php?page=flatsome-version-info' ) )
),
'package' => add_query_arg(
array(
'flatsome_version' => $version,
'flatsome_download' => true,
),
esc_url( admin_url( 'admin.php?page=flatsome-panel' ) )
),
);
if ( empty( $latest_version ) ) {
$cache = get_option( 'flatsome_update_cache' );
$now = time();
if (
! empty( $cache['version'] ) &&
! empty( $cache['last_checked'] ) &&
$now - ( (int) $cache['last_checked'] ) < 300
) {
$latest_version = $cache['version'];
} else {
$result = flatsome_envato()->registration->get_latest_version();
$latest_version = is_string( $result ) ? $result : $version;
update_option(
'flatsome_update_cache',
array(
'last_checked' => $now,
'version' => $latest_version,
)
);
}
}
if ( version_compare( $version, $latest_version, '<' ) ) {
$update_details['new_version'] = $latest_version;
$update_details['url'] = add_query_arg( 'version', $latest_version, $update_details['url'] );
$update_details['package'] = add_query_arg( 'flatsome_version', $latest_version, $update_details['package'] );
$transient->response[ $template ] = $update_details;
} else {
$transient->no_update[ $template ] = $update_details;
}
return $transient;
}
add_filter( 'pre_set_site_transient_update_themes', 'flatsome_get_update_info', 1, 99999 );
add_filter( 'pre_set_transient_update_themes', 'flatsome_get_update_info', 1, 99999 );
/**
* Get a fresh package URL before running the WordPress upgrader.
*
* @param array $options Options used by the upgrader.
* @return array
*/
function flatsome_upgrader_package_options( $options ) {
$package = $options['package'];
if ( false !== strrpos( $package, 'flatsome_download' ) ) {
parse_str( wp_parse_url( $package, PHP_URL_QUERY ), $vars );
if ( isset( $vars['flatsome_version'] ) ) {
$version = $vars['flatsome_version'];
$package = flatsome_envato()->registration->get_download_url( $version );
if ( is_wp_error( $package ) ) {
return $options;
}
$options['package'] = $package;
}
}
return $options;
}
add_filter( 'upgrader_package_options', 'flatsome_upgrader_package_options', 9 );
/**
* Disables update check for Flatsome in the WordPress themes repo.
*
* @param array $request An array of HTTP request arguments.
* @param string $url The request URL.
* @return array
*/
function flatsome_update_check_request_args( $request, $url ) {
if ( false !== strpos( $url, '//api.wordpress.org/themes/update-check/1.1/' ) ) {
$data = json_decode( $request['body']['themes'] );
$template = get_template();
unset( $data->themes->$template );
$request['body']['themes'] = wp_json_encode( $data );
}
return $request;
}
add_filter( 'http_request_args', 'flatsome_update_check_request_args', 5, 2 );

View File

@@ -0,0 +1,254 @@
<?php
// Fix options for next Flatsome version.
function flatsome_is_upgrading(){
// Check if old depricated (not available in v3) option exist.
$is_old = get_theme_mod('nav_position');
if(!empty($is_old)) return true;
}
/**
* Fix content when upgrading to major version 3.0
*/
function flatsome_fix_old_content(){
// Upgrade to flatsome 3.0
if(get_theme_mod('flatsome_version') < 3){
$options = get_theme_mods();
// Check if old content is installed
if(flatsome_is_upgrading()){
set_theme_mod('flatsome_fallback', 1);
update_option('envato_setup_complete', time());
} else {
set_theme_mod('flatsome_fallback', 0);
}
if(!isset($options['topbar_elements_left'])) set_theme_mod('topbar_elements_left', flatsome_topbar_elements_left());
if(!isset($options['topbar_elements_right'])) set_theme_mod('topbar_elements_right', flatsome_topbar_elements_right());
if(!isset($options['header_elements_left'])) set_theme_mod('header_elements_left', flatsome_header_elements_left());
if(!isset($options['header_elements_right'])) set_theme_mod('header_elements_right', flatsome_header_elements_right());
if(!isset($options['header_elements_bottom_left'])) set_theme_mod('header_elements_bottom_left', flatsome_header_elements_bottom_left());
if(!isset($options['header_elements_bottom_center'])) set_theme_mod('header_elements_bottom_center', flatsome_header_elements_bottom_center());
if(!isset($options['header_elements_bottom_right'])) set_theme_mod('header_elements_bottom_right', flatsome_header_elements_bottom_right());
if(!isset($options['header_mobile_elements_left'])) set_theme_mod('header_mobile_elements_left', flatsome_header_mobile_elements_left());
if(!isset($options['header_mobile_elements_right'])) set_theme_mod('header_mobile_elements_right', flatsome_header_mobile_elements_right());
if(!isset($options['header_mobile_elements_top'])) set_theme_mod('header_mobile_elements_top', flatsome_header_mobile_elements_top());
if(!isset($options['mobile_sidebar'])) set_theme_mod('mobile_sidebar', flatsome_header_mobile_sidebar());
if(!isset($options['product_layout'])) set_theme_mod('product_layout', flatsome_product_layout());
if(!flatsome_is_upgrading()) set_theme_mod('payment_icons_placement', 'footer');
// Set follow icons
if(!isset($options['follow_twitter'])) set_theme_mod('follow_twitter','http://url');
if(!isset($options['follow_facebook'])) set_theme_mod('follow_facebook','http://url');
if(!isset($options['follow_instagram'])) set_theme_mod('follow_instagram','http://url');
if(!isset($options['follow_email'])) set_theme_mod('follow_email','your@email');
set_theme_mod('flatsome_version', 3);
}
}
add_action( 'after_setup_theme', 'flatsome_fix_old_content');
$old_nav = get_theme_mod('nav_position');
$old_nav_topbar = get_theme_mod('topbar_show');
$old_search = get_theme_mod('search_pos');
function flatsome_topbar_elements_left(){
global $old_nav, $old_nav_topbar;
if($old_nav && !$old_nav_topbar) return array();
$options[] = 'html';
return $options;
}
function flatsome_topbar_elements_right(){
global $old_nav, $old_nav_topbar;
if($old_nav && !$old_nav_topbar) return array();
$options = array('nav-top');
if(get_theme_mod('myaccount_dropdown') == 'top_bar'){
$options[] = 'account';
}
if(get_theme_mod('show_cart') == 'top_bar'){
$options[] = 'cart';
}
if(!$old_nav) $options[] = 'newsletter';
if(!$old_nav) $options[] = 'social';
if($old_nav) $options[] = 'html-2';
return $options;
}
// Header Main Left
function flatsome_header_elements_left(){
global $old_nav, $old_search;
$options = array();
if($old_nav){
if($old_nav == 'bottom' || $old_nav == 'bottom_center'){
if($old_search == 'left') $options[] = 'search-form';
}
if($old_nav == 'top' && $old_search == 'left') $options[] = 'search';
if($old_nav == 'top') $options[] = 'nav';
if($old_nav == 'top' && $old_search == 'right') $options[] = 'search';
if($old_nav == 'bottom_center' || $old_nav == 'bottom') $options[] = 'html-4';
} else {
$options[] = 'search';
$options[] = 'nav';
}
return $options;
}
// Header Main Right
function flatsome_header_elements_right(){
global $old_nav, $old_search;
$cart = get_theme_mod('show_cart');
$account = get_theme_mod('myaccount_dropdown');
$options = array();
if($old_nav){
if($old_nav == 'top_right' && $old_search == 'left') $options[] = 'search';
if($old_nav == 'top_right') $options[] = 'nav';
if($old_nav == 'top_right' && $old_search == 'right') $options[] = 'search';
$options[] = 'html-3';
if(!empty($account) || $account == 1){
$options[] = 'account';
}
if($cart == 1 && $account == 1){
$options[] ='divider';
}
if(!empty($cart) || $cart == 1){
$options[] = 'cart';
}
} else{
$options = array('account','divider','cart');
}
return $options;
}
// Header Bottom Left
function flatsome_header_elements_bottom_left(){
global $old_nav, $old_search;
$options = array();
if($old_nav && $old_nav == 'bottom') $options[] = 'nav';
if($old_nav && ($old_search == 'right' && $old_nav == 'bottom')) $options[] = 'search';
return $options;
}
// Header Bottom Center
function flatsome_header_elements_bottom_center(){
global $old_nav, $old_search;
$options = array();
if($old_nav) {
if($old_nav == 'bottom_center') $options[] = 'search';
if($old_nav == 'bottom_center') $options[] = 'nav';
if($old_nav == 'bottom_center' && $old_search == 'right') $options[] = 'search';
}
return $options;
}
// Header Bottom Right
function flatsome_header_elements_bottom_right(){
global $old_nav, $old_search;
$options = array();
if($old_nav == 'bottom') {
$options[] = 'html-5';
}
return $options;
}
// Mobile Left
function flatsome_header_mobile_elements_left(){
$options = array('menu-icon');
return $options;
}
// Mobile Sidebar
function flatsome_header_mobile_sidebar(){
global $old_nav, $old_nav_topbar;
$options = array('search-form','nav',);
$account = get_theme_mod('myaccount_dropdown');
if($old_nav_topbar){
$options[]= 'divider';
$options[]= 'nav-top';
}
if(!$old_nav || $account == 1){
$options[] = 'account';
}
if(!$old_nav) $options[] = 'newsletter';
if(!$old_nav) $options[] = 'social';
$options[] = 'html-2';
$options[] = 'html-3';
return $options;
}
// Mobile right
function flatsome_header_mobile_elements_right(){
global $old_nav, $old_search;
$options = array();
if($old_nav){
if(get_theme_mod('show_cart') == 1) $options[] = 'cart';
} else{
$options[] = 'cart';
}
return $options;
}
// Mobile Top
function flatsome_header_mobile_elements_top(){
global $old_nav, $is_topbar;
if($old_nav && !$is_topbar) return array();
$options = array('html');
return $options;
}
// Fix old product sidebar layout
function flatsome_product_layout() {
$old_sidebar = get_theme_mod( 'product_sidebar' );
if( isset( $old_sidebar ) ) {
if( $old_sidebar === 'no_sidebar' ) {
return 'right-sidebar-small';
} else if( $old_sidebar === 'full_width' ) {
return 'no-sidebar';
} else if( $old_sidebar === 'left_sidebar' ) {
return 'left-sidebar-full';
} else if( $old_sidebar === 'right_sidebar' ) {
return 'right-sidebar';
} else if( $old_sidebar === 'right_sidebar_fullheight' ) {
return 'right-sidebar-full';
}
return 'right-sidebar-small';
} else {
return 'right-sidebar-small';
}
}