File: /home/salhiscp/salhab360photos.com/wp-content/themes/acora/functions.php
<?php
/**
* Functions and definitions.
*
* @package acora
* @since acora 1.0
*/
/**
* Define common constants.
*/
define('ACORA_URI', get_template_directory_uri());
define('ACORA_VERSION', wp_get_theme()->get('Version'));
$acora_port_base = esc_html__('portfolio', 'acora');
$acora_tax_base = esc_html__('category', 'acora');
$acora_tag_base = esc_html__('tag', 'acora');
/**
* Include various files.
* ------------------------------------------------------------
*/
include get_theme_file_path('/inc/theme-support.php'); // Theme supports various functions.
include get_theme_file_path('/inc/AcoraData.php'); // Theme options.
include get_theme_file_path('/inc/WalkerMenu.php'); // Menu walker.
include get_theme_file_path('/inc/libs/class-tgm-plugin-activation.php'); // TGM
/**
* Sets up theme defaults and registers support for various WordPress features.
* -----------------------------------------------------------------
*/
function acora_setup() {
//Initilize data
AcoraData::init();
/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
*/
load_theme_textdomain('acora', get_theme_file_path('languages'));
// Enable theme support for standard features.
add_theme_support('post-thumbnails');
add_theme_support('automatic-feed-links');
add_theme_support('title-tag');
// Add gutenberg support.
// Add support for Block Styles.
add_theme_support('wp-block-styles');
add_theme_support('align-wide');
add_theme_support('disable-custom-font-sizes');
add_theme_support('responsive-embeds');
// Register menu
register_nav_menus(array('primary' => esc_html__('Acora Primary Menu', 'acora')));
// Activate HTML5 features.
add_theme_support('html5', array('comment-form','search-form','gallery', 'caption'));
// Add image sizes
if(function_exists('add_image_size')){
add_image_size('acora-blog-image', 1321, 743, true);
add_image_size('acora-about-me', 1550, 927, true);
add_image_size('acora-team-hex', 535, 735, true);
add_image_size('acora-portfolio-thumbnail',
round(AcoraData::$data->portfolio_settings['thumbnail_max_width'] * 1.4),
round(AcoraData::$data->portfolio_settings['thumbnail_max_height'] * 1.4)
, true);
add_image_size('acora-profile-picture', 300, 300, true);
add_image_size('acora-team-members', 1068, 1131, true);
}
// Ensure maximum quality for images.
add_filter('jpeg_quality', 'acora_image_quality');
function acora_image_quality() {
return 100;
}
// Add custom size in media uploader.
add_filter('image_size_names_choose', 'acora_custom_sizes');
function acora_custom_sizes($sizes) {
return array_merge($sizes, array(
'acora-blog-image' => 'acora-blog-image',
'acora-about-me' => 'acora-about-me',
'acora-portfolio-thumbnail' => 'acora-portfolio-thumbnail',
'acora-team-hex' => 'acora-team-hex',
'acora-team-members' => 'acora-team-members',
'acora-profile-picture' => 'acora-profile-picture'
));
}
// Set excerpt length.
function acora_custom_excerpt_length($length) {
return 60;
}
add_filter('excerpt_length', 'acora_custom_excerpt_length', 999);
}
add_action('after_setup_theme', 'acora_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
*/
if(!isset($content_width)){
$content_width = 1340;
}
function acora_content_width() {
$content_width = $GLOBALS['content_width'];
$GLOBALS['content_width'] = apply_filters('acora_content_width', $content_width);
}
add_action( 'template_redirect', 'acora_content_width', 0 );
// Remove anchor from author name in the comments section.
add_filter('get_comment_author_url', '__return_empty_string');
/**
* Comments should be turned off by default for newly created pages.
* ------------------------------------------------------------
*/
function acora_default_content($post_content, $post) {
if ($post->post_type && ($post->post_type == 'page')){
$post->comment_status = 'closed';
$post->ping_status = 'closed';
}
return $post_content;
}
add_filter('default_content', 'acora_default_content', 10, 2);
/**
* Enable reply to comments.
* ------------------------------------------------------------
*/
function acora_theme_queue_js(){
if((!is_admin()) && is_singular() && comments_open() && get_option('thread_comments')){
wp_enqueue_script('comment-reply');
}
}
add_action('wp_enqueue_scripts', 'acora_theme_queue_js');
/**
* Enable search only for posts.
* ------------------------------------------------------------
*/
add_action('pre_get_posts', function ($q){
if(!is_admin() // Only target front end,
&& $q->is_main_query() // Only target the main query
&& $q->is_search() // Only target the search page
){
$q->set('post_type', ['post']);
}
});
/**
* Set custom password form.
* ------------------------------------------------------------
*/
function acora_custom_password_form() {
global $post;
$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
$o = '<form class="protected-post-form" action="' . esc_url(site_url()) . '/wp-login.php?action=postpass" method="post">
' . __( "<strong>This content is password protected</strong>. To view it please enter your password below.", 'acora') . '
<label class="pass-label" for="' . esc_attr($label) . '">' . esc_html__("Password", 'acora') . ' </label><input name="post_password" id="' . esc_attr($label) . '" type="password"/><input type="submit" name="Submit" class="button" value="' . esc_attr__("Submit", 'acora') . '" />
</form>';
return $o;
}
add_filter('the_password_form', 'acora_custom_password_form');
/**
* Register required plugins.
* ------------------------------------------------------------
*/
function acora_register_required_plugins() {
$config = array(
'id' => 'acora',
'default_path' => '',
'menu' => 'tgmpa-install-plugins',
'has_notices' => true,
'dismissable' => true,
'dismiss_msg' => '',
'is_automatic' => false,
'message' => '',
);
$plugins = array(
array(
'name' => esc_html__('Acora Settings', 'acora'),
'slug' => 'acora-settings',
'source' => get_template_directory() . '/inc/plugins/acora-settings.zip',
'required' => true,
'version' => '',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
'is_callable' => '',
),
array(
'name' => esc_html__('Easy Video Player', 'acora'),
'slug' => 'fwdevp',
'source' => get_template_directory() . '/inc/plugins/fwdevp.zip',
'required' => false,
'version' => '',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => esc_url('https://codecanyon.net/item/easy-video-player-wordpress-plugin/8537670'),
'is_callable' => '',
),
array(
'name' => esc_html__('Infinite Grid Pro', 'acora'),
'slug' => 'fwdigp',
'source' => get_template_directory() . '/inc/plugins/fwdigp.zip',
'required' => false,
'version' => '',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => esc_url('https://codecanyon.net/item/infinite-grid-pro-wordpress-plugin/18320536'),
'is_callable' => '',
),
array(
'name' => esc_html__('Simple Image Slider Carousel', 'acora'),
'slug' => 'fwdsisc',
'source' => get_template_directory() . '/inc/plugins/fwdsisc.zip',
'required' => false,
'version' => '',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => esc_url('https://codecanyon.net/item/simple-image-slider-carousel-wordpress-plugin/20541469'),
'is_callable' => '',
),
array(
'name' => esc_html__('Ultimate Video Player', 'acora'),
'slug' => 'fwduvp',
'source' => get_template_directory() . '/inc/plugins/fwduvp.zip',
'required' => false,
'version' => '',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => esc_url('https://codecanyon.net/item/ultimate-video-player-wordpress-plugin/8374433'),
'is_callable' => '',
),
array(
'name' => esc_html__('All-in-One WP Migration Unlimited Extension', 'acora'),
'slug' => 'all-in-one-wp-migration-unlimited-extension',
'source' => get_template_directory() . '/inc/plugins/all-in-one-wp-migration-unlimited-extension.zip',
'required' => false,
'version' => '',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
'is_callable' => '',
),
array(
'name' => esc_html__('All-in-One WP Migration', 'acora'),
'slug' => 'all-in-one-wp-migration',
'external_url' => esc_url('https://servmask.com/'),
'required' => false,
'force_activation' => false
),
array(
'name' => esc_html__('Regenerate Thumbnails', 'acora'),
'slug' => 'regenerate-thumbnails',
'external_url' => esc_url('https://alex.blog/wordpress-plugins/regenerate-thumbnails/'),
'required' => false,
'force_activation' => false
)
);
tgmpa($plugins, $config);
}
add_action('tgmpa_register', 'acora_register_required_plugins');
/**
* Backend enque
* ------------------------------------------------------------
*/
function acora_load_admin_scripts($hook){
// Enque admin files.
wp_enqueue_style('acora-google-fonts', esc_url(acora_slug_fonts_url()), ACORA_VERSION);
wp_enqueue_style('acora-icomoon', esc_url(ACORA_URI . '/css/fwdicon.css'), array(), ACORA_VERSION, 'all');
wp_enqueue_script('fwd-utils', esc_url(ACORA_URI . '/js/fwd/FWDUtils.js'), array(), ACORA_VERSION, true);
wp_enqueue_media();
if($hook == 'toplevel_page_acora_settings'
|| $hook == 'acora_page_acora_register_theme'
|| $hook == 'acora_page_acora_css'
|| $hook == 'edit.php'
|| $hook == 'post.php'
|| $hook == 'post-new.php'
|| $hook == 'widgets.php'
){
wp_enqueue_style('acora-admin', esc_url(ACORA_URI . '/css/admin.css'), array(), ACORA_VERSION, 'all');
wp_enqueue_script("jquery-ui-tabs");
wp_enqueue_script("jquery-ui-sortable");
wp_enqueue_script("jquery-ui-accordion");
wp_enqueue_script("jquery-ui-dialog");
wp_enqueue_script('acora-admin', esc_url(ACORA_URI . '/js/admin.js'), array('jquery'), ACORA_VERSION);
}
}
add_action('admin_enqueue_scripts', 'acora_load_admin_scripts');
/**
* Frontend enque
* ------------------------------------------------------------
*/
function acora_enque_front_files($hook){
global $wp_query;
global $wp;
global $post;
$vars = '';
$use_only_vertical_menu = false;
// Enqueue styles.
wp_enqueue_style('acora-google-fonts', esc_url(acora_slug_fonts_url()), ACORA_VERSION);
wp_enqueue_style('acora-icomoon', esc_url(ACORA_URI . '/css/fwdicon.css'), array(), ACORA_VERSION);
wp_enqueue_style('acora-global', esc_url(ACORA_URI . '/css/global.css'), array(), ACORA_VERSION);
if(AcoraData::$data->general_settings['theme_style'] == 'white'){
wp_enqueue_style('acora-front-style', esc_url(ACORA_URI . '/css/style.css'), array(), ACORA_VERSION);
}else{
wp_enqueue_style('acora-front-style', esc_url(ACORA_URI . '/css/style-dark.css'), array(), ACORA_VERSION);
}
wp_enqueue_style('acora-theme-style', esc_url(ACORA_URI . '/style.css'), array(), ACORA_VERSION);
// Enqueue js files.
wp_enqueue_script("jquery");
wp_enqueue_script('jquery-ease', esc_url(ACORA_URI . '/js/libs/jquery_easing.js'), array('jquery'), '1.3', false);
wp_enqueue_script('undescore', esc_url(includes_url('js') . '/underscore.min.js'));
wp_enqueue_script('fwd-utils', esc_url(ACORA_URI . '/js/fwd/FWDUtils.js'), array('jquery'), ACORA_VERSION, false);
wp_enqueue_script('fwd-vertical-menu', esc_url(ACORA_URI . '/js/vertical_menu.js'), array('jquery'), ACORA_VERSION, false);
wp_enqueue_script('fwd-menu', esc_url(ACORA_URI . '/js/menu.js'), array('jquery'), ACORA_VERSION, false);
wp_enqueue_script('fwd-scrollbar', esc_url(ACORA_URI . '/js/fwd/FWDScrollbar.js'), array('jquery'), ACORA_VERSION, false);
wp_enqueue_script('fwd-animation', esc_url(ACORA_URI . '/js/fwd/FWDAnimation.js'), array('jquery'), ACORA_VERSION, false);
wp_enqueue_script('fwd-share', esc_url(ACORA_URI . '/js/fwd/FWDShare.js'), array('jquery'), ACORA_VERSION, false);
if(is_page_template('page-templates/home-extended.php')){
wp_enqueue_script('acora-home-extended', esc_url(ACORA_URI . '/js/home-extended.js'), array('jquery'), ACORA_VERSION, false);
}else{
wp_enqueue_script('acora-front', esc_url(ACORA_URI . '/js/front.js'), array('jquery'), ACORA_VERSION, false);
}
$FWDGG_added_in_header = false;
if(is_page_template('page-templates/home-extended.php')
|| is_page_template('page-templates/about-me.php')
|| is_page_template('page-templates/blog-without-sidebar.php')
|| is_page_template('page-templates/blog-without-sidebar-and-header.php')
|| (is_home() && !empty(AcoraData::$data->blog_settings['instagram_feed']))){
wp_enqueue_script('fwd-gg', esc_url(ACORA_URI . '/js/fwd/fwdgg/FWDGG.js'), array('jquery'), ACORA_VERSION, false);
$FWDGG_added_in_header = true;
}
$FWDHS_added_in_header = false;
if(is_page_template('page-templates/home-slider.php')){
wp_enqueue_script('fwd-hs', esc_url(ACORA_URI . '/js/fwd/fwdhs/FWDHS.js'), array('jquery'), ACORA_VERSION, false);
$FWDHS_added_in_header = true;
}
$FWDVS_added_in_header = false;
if(get_post_type() == 'acora_portfolio'
|| (get_post_type() == 'post' && is_single())
|| (!empty($wp_query->query_vars['type']))
|| is_page_template('page-templates/portfolio.php')
|| is_page_template('page-templates/home-extended.php')
|| is_page_template('page-templates/home-slider.php')
|| is_page_template('page-templates/about-us.php')
){
wp_enqueue_script('fwd-vs', esc_url(ACORA_URI . '/js/fwd/fwdvs/FWDVS.js'), array('jquery'), ACORA_VERSION, false);
$FWDVS_added_in_header = true;
}
$FWDIGP_added_in_header = false;
if(is_page_template('page-templates/igp-portfolio.php')
|| get_post_type() == 'acora_portfolio'
|| (!empty($wp_query->query_vars['type']))
|| is_home()
){
$FWDIGP_added_in_header = true;
}
if(!$FWDGG_added_in_header){
wp_enqueue_script('fwd-gg', esc_url(ACORA_URI . '/js/fwd/fwdgg/FWDGG.js'), array(), ACORA_VERSION, true);
}
if(!$FWDVS_added_in_header){
wp_enqueue_script('fwd-vs', esc_url(ACORA_URI . '/js/fwd/fwdvs/FWDVS.js'), array(), ACORA_VERSION, true);
}
if(!$FWDHS_added_in_header){
wp_enqueue_script('fwd-hs', esc_url(ACORA_URI . '/js/fwd/fwdhs/FWDHS.js'), array(), ACORA_VERSION, true);
}
// Adding some js files to footer to improve loading time and overall performance.
wp_enqueue_script('fwdigp', esc_url(ACORA_URI . '/js/fwd/fwdigp/FWDIGP.js'), array(), ACORA_VERSION, true);
wp_enqueue_script('fwdsisc', esc_url(ACORA_URI . '/js/fwd/fwdsisc/FWDSISC.js'), array(), ACORA_VERSION, true);
wp_enqueue_script('fwd-si', esc_url(ACORA_URI . '/js/fwd/fwdsi/FWDSI.js'), array(), ACORA_VERSION, true);
wp_enqueue_script('fwd-evp', esc_url(ACORA_URI . '/js/fwd/fwdevp/FWDEVPlayer.js'), array(), ACORA_VERSION, true);
// Add inline js.
if(is_404()
|| is_page_template('page-templates/home-slider.php')
|| is_page_template('page-templates/home-simple.php')
|| is_page_template('page-templates/uvp-home.php')
|| is_page_template('page-templates/portfolio.php')
|| is_page_template('page-templates/igp-portfolio.php')
|| is_page_template('page-templates/only-shortcode-fluid-width.php')
|| is_page_template('page-templates/only-shortcode-fullscreen.php')
|| is_page_template('page-templates/contact-simple.php')
|| (defined('ACORA_SETTINGS_INIT') && get_post_type() == 'acora_portfolio' && !acora_settings_portfolio_allow_horizontal_menu())
|| is_author()
){
$use_only_vertical_menu = true;
}
if(!$use_only_vertical_menu){
$use_only_vertical_menu = 0;
}
$vars .= 'var use_only_vertical_menu=' . esc_html($use_only_vertical_menu) . ';';
$vars .= 'var acora_nonce = "' . wp_create_nonce("acora-ajax") . '";';
$vars .= 'var blog_name="' . esc_html(get_bloginfo('name')) . '";';
$vars .= 'var fwdpt_home="' . esc_url(get_home_url()) . '";';
$vars .= 'var ACORA_URI="' . esc_url(ACORA_URI) . '";';
$vars .= 'var fwdpt_logoPath="' . esc_url(AcoraData::$data->menu_settings['logo_image']) . '";';
$vars .= 'var acora_copyright="' . esc_html(AcoraData::$data->menu_settings['copyright']) . '";';
$vars .= 'var blink_menu_button="' . esc_html(AcoraData::$data->menu_settings['blink_menu_button']) . '";';
$vars .= 'var acora_menuShare="' . esc_html(json_encode(AcoraData::$data->menu_settings['share'])) . '";';
$vars .= 'var is_dark=' . (AcoraData::$data->general_settings['theme_style'] == 'dark' ? 'true' : 'false') . ';';
$vars .= 'var is_ACORA = true;';
if(AcoraData::$data->menu_settings['show_search_in_menu']){
$vars .= 'var acora_search_label="' . __('Search', 'acora') . '";';
}
$vars .= 'var ajaxURL="' . esc_url(admin_url('admin-ajax.php')) . '";';
if(!empty($post->ID)){
$vars .= 'var postId=' . esc_html($post->ID) . ';';
}
// Front vars for contact page.
if(is_page_template('page-templates/contact.php')){
$data = acora_settings_contact_get_data($post->ID);
extract($data);
$paralax = 'no';
if(wp_is_mobile()){
if(AcoraData::$data->general_settings['use_paralax_mobile']) $paralax = 'yes';
}else{
if(AcoraData::$data->general_settings['use_paralax_desktop']) $paralax = 'yes';
}
$vars .= 'var paralax="' . esc_html($paralax) . '";';
$vars .= 'var maps_api_key="' . esc_html($maps_api_key) . '";';
$vars .= 'var lat="' . esc_html($lat) . '";';
$vars .= 'var long="' . esc_html($long) . '";';
}else if(is_page_template('page-templates/contact-simple.php')){
$data = acora_settings_cs_get_data($post->ID);
extract($data);
$vars .= 'var maps_api_key="' . esc_html($cs_maps_api_key) . '";';
}else if(is_page_template('page-templates/home-extended.php')){
$data = acora_settings_hex_get_data($post->ID);
extract($data);
$output = '';
$paralax = 'no';
if(wp_is_mobile()){
if(AcoraData::$data->general_settings['use_paralax_mobile']){
$paralax = 'yes';
}
}else{
if(AcoraData::$data->general_settings['use_paralax_desktop']){
$paralax = 'yes';
}
}
$vars .= 'var paralax="' . esc_html($paralax) . '";';
}
wp_add_inline_script('acora-home-extended', $vars);
wp_add_inline_script('acora-front', $vars);
// Add files only for the demo page.
if(strpos(home_url(add_query_arg(array(), $wp->request)), "flash.ro") !== false){
wp_enqueue_script('colors-demo', esc_url(ACORA_URI . '/js/colors_demo.js'), array('jquery'), ACORA_VERSION, false);
}
}
add_action('wp_enqueue_scripts', 'acora_enque_front_files');
/**
* Add other needed allowed elements wp_kses_post tags to safely
* escape output.
* ------------------------------------------------------------
*/
function acora_custom_wpkses_post_tags($tags, $context){
if ( 'post' === $context ) {
$tags['submit'] = array(
'class' => true,
'id' => true
);
$tags['input'] = array(
'class' => true,
'id' => true
);
$tags['form'] = array(
'action' => true,
'class' => true,
'id' => true,
'method' => true,
'data-receiver-email' => true
);
$tags['ul'] = array(
'class' => true,
'id' => true,
'style' => true,
'data-cat' => true,
'data-category' => true,
'data-categories' => true,
'data-category-name' => true,
'data-url' => true,
'data-url' => true,
'data-cat' => true,
'data-source' => true,
'data-category' => true,
'data-categories' => true,
'data-category-name' => true,
'data-width' => true,
'data-height' => true,
'data-text-vertical-alignment' => true,
'data-video-thumb-preview' => true,
'data-video-subtitle-source' => true,
'data-video-vast-source' => true,
'data-video-password' => true,
'data-video-source' => true,
'data-thumb-link' => true,
'data-thumb-target' => true,
'data-thumb-src' => true,
'data-link' => true
);
$tags['li'] = array(
'class' => true,
'id' => true,
'data' => true,
'style' => true,
'data-url' => true,
'data-cat' => true,
'data-source' => true,
'data-category' => true,
'data-categories' => true,
'data-category-name' => true,
'data-width' => true,
'data-height' => true,
'data-text-vertical-alignment' => true,
'data-video-thumb-preview' => true,
'data-video-subtitle-source' => true,
'data-video-vast-source' => true,
'data-video-password' => true,
'data-video-source' => true,
'data-thumb-link' => true,
'data-thumb-target' => true,
'data-thumb-src' => true,
'data-link' => true
);
$tags['input'] = array(
'class' => true,
'id' => true,
'type' => true,
'value' => true
);
$tags['svg'] = array(
'class' => true,
'id' => true,
'width' => true,
'height' => true,
'viewBox' => true,
'fill' => true,
'stroke' => true,
'xmlns' => true
);
$tags['select'] = array(
'class' => true,
'id' => true
);
$tags['option'] = array(
'class' => true,
'id' => true,
'value' => true
);
$tags['script'] = array(
'type' => true,
'id' => true,
'value' => true
);
$tags['path'] = array(
'd' => true,
'fill' => true,
'stroke' => true
);
}
return $tags;
}
add_filter('wp_kses_allowed_html', 'acora_custom_wpkses_post_tags', 10, 2);
function acora_custom_wpkses_post_safe_tags($styles){
$styles[] = 'display';
return $styles;
}
add_filter( 'safe_style_css', 'acora_custom_wpkses_post_safe_tags', 10, 2);
/**
* Add color settings for accent color in cusotmizer
* ------------------------------------------------------------
*/
function acora_customize_register($wp_customize){
$wp_customize->add_setting('acora_accent_color_db',array(
'default' => get_theme_mod('acora_accent_color_db'),
'transport' => 'refresh',
'sanitize_callback' => 'esc_html'
));
$wp_customize->add_section('acora_accent_color_section', array(
'title' => esc_html__('Accent Color', 'acora'),
'priority' => 30,
'sanitize_callback' => 'esc_html'
));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'acora_accent_color_control', array(
'label' => esc_html__('Set Theme Accent Color', 'acora'),
'section' => 'acora_accent_color_section',
'settings' => 'acora_accent_color_db',
'sanitize_callback' => 'esc_html'
)));
}
add_action('customize_register', 'acora_customize_register');
/**
* Set accent main color css.
* ------------------------------------------------------------
*/
function acora_change_accent_color_css(){
$ac = get_theme_mod('acora_accent_color_db');
if(!empty($_COOKIE['acora_accent_color'])){
$ac = htmlspecialchars($_COOKIE["acora_accent_color"]);
}
$ac = esc_html($ac);
if(!empty($ac)):
?>
<style id="accent_color" type="text/css">
/* Categories selector. */
.FWDHS .main-holder .text {
color:<?php echo esc_html($ac); ?>;
}
/* Vertical menu. */
.vertical-menu a.vertical-menu-item-active,
.vertical-menu .copyright-main .icons-wrapper a:hover,
.vertical-menu-link:hover{
color: <?php echo esc_html($ac); ?>;
}
.fwd-scrollbar-handler{
background: <?php echo esc_html($ac); ?>;
}
/* Horizontal menu. */
.acora-menu-search-holder .close:hover,
.acora-menu-search-holder .submit:hover,
.acora-menu-search-holder .close:hover,
.site-navigation .search-icon:hover,
.site-navigation .current-menu-ancestor > a,
.site-navigation .current-menu-item > a,
.site-navigation .active > a,
.site-navigation a:hover{
color: <?php echo esc_html($ac); ?>;
}
/* Extended homepage. */
.home-extended .header-holder .pp-play:hover path,
.home-extended .header-holder .pp-pause:hover path{
fill: <?php echo esc_html($ac); ?>;
}
.sidebar .widget_block.widget_search button,
.home-extended .images .large-info .first-button{
background: <?php echo esc_html($ac); ?>;
}
.home-extended .our-blog .grid-holder .category,
.home-extended .our-blog .grid-holder .blog-read-more a:hover,
.home-extended .our-blog .grid-holder .blog-read-more a:hover:after,
.home-extended .our-team .grid-holder .name a:hover,
.home-extended .our-team .grid-holder .link a:hover,
.portfolio .default-categories-main .categories .fwdicon:before,
.portfolio .default-likes-main .like .fwdicon:before,
.default-categories-main .categories .category,
.home-extended .story #st_img2 a:hover .arrow,
.wp-block-quote p:before {
color: <?php echo esc_html($ac) .' !important'; ?>;
}
/* Home simple. */
.home-simple .entry-content .first-button{
background: <?php echo esc_html($ac); ?>;
}
/* Sidebar. */
.sidebar .widget_search button:hover{
background-color: <?php echo esc_html($ac) ?>;
}
/* About us. */
.about-us .video-holder .pp-play:hover path,
.about-us .video-holder .pp-pause:hover path{
fill: <?php echo esc_html($ac); ?>;
}
.home-extended .images .large-info .first-button{
background: <?php echo esc_html($ac); ?>;
}
.about-us #acora_team_grid .link a:hover,
.about-us #acora_team_grid .name a:hover,
.about-us .detailed-grid .details .holder .main-color,
.about-us .we-are-grid .image a .text strong,
.about-us .we-are-grid .image a:hover .arrow,
.about-us .share-btns-container a:hover,
.about-us .team .position {
color: <?php echo esc_html($ac); ?>;
}
.about-us .team .email a{
background-image: linear-gradient(transparent calc(100% - 1px), <?php echo esc_html($ac); ?> 1px);
}
.about-us .detailed-grid .details .holder .button-light:hover{
background: <?php echo esc_html($ac); ?>;
border-color: <?php echo esc_html($ac); ?>;
}
/* About me. */
.about-me .contact .form-submit input,
.about-me .main-info .info span{
background: <?php echo esc_html($ac); ?>;
}
.about-me .accordion .panel-title a:hover,
.about-me .main-info .info .share-btns-container a:hover span{
color: <?php echo esc_html($ac); ?>;
}
/* Contact. */
.contact-simple .entry-content .first-button,
.contact .comment-respond .inline:before,
.contact-simple .comment-respond .inline:before{
background: <?php echo esc_html($ac); ?>;
}
/* 404 page. */
.page-not-found a:hover{
color: <?php echo esc_html($ac); ?>;
}
/* Blog, page, post. */
blockquote p:before,
.wp-block-pullquote p:before,
.related-posts .extra-text-selected,
.profile-widget .icons-wrapper a:hover,
.profile-widget .icons-wrapper a:focus,
.blog-main .read-more .button:hover,
.blog-main .entry-content .title a:hover,
.blog-main .read-more .button:hover:before{
color: <?php echo esc_html($ac) .' !important'; ?>;
}
.blog-main .entry.sticky .title:after,
.blog-main article.sticky .title:after,
.posts .single .entry-content .wp-block-file a:nth-child(2),
.related-posts .title:before{
background: <?php echo esc_html($ac); ?>;
}
/* Portfolio archive. */
.PGMenuSelectorTextSelected,
.PGMenuButtonTextSelected,
.FWDSButtonSelectedState,
.contact-simple .cs-main-form-holder .fwdicon-close:hover,
.posts .single .meta .entry-date.comments a:hover,
.related-projects .default-categories-main .categories .fwdicon-categories:before,
.related-projects .default-likes-main .like .fwdicon:before,
.fwdigp .default-categories-main .categories .fwdicon-categories:before,
.fwdigp .default-likes-main .like .fwdicon:before,
.portolio-archive .default-categories-main .categories .fwdicon-categories:before,
.portolio-archive .default-likes-main .like .fwdicon:before{
color: <?php echo esc_html($ac) .' !important'; ?>;
}
/* Portfolio single. */
.fwdigp .close,
.protected-post-form input[type="submit"],
.portfolio-main .related-projects .title:before{
background: <?php echo esc_html($ac); ?>;
}
.posts .single .meta .entry-date.categories a:hover,
.posts .single .meta .entry-date.posted-by a:hover,
.posts .single .fwdicon-love{
color: <?php echo esc_html($ac); ?>;
}
/* Comments. */
#comments .bypostauthor .bypostauthor-icon{
border-color: <?php echo esc_html($ac); ?>;
}
#respond .submit,
#respond #cancel-comment-reply-link,
#respond #cancel-comment-reply-link,
#reply-title:before,
#comments .comment-actions a,
#comments .comment-actions .comment-reply-link,
#comments .title:before{
background: <?php echo esc_html($ac); ?>;
}
#comments .bypostauthor .bypostauthor-icon,
.posts .single .fwdicon-love{
color: <?php echo esc_html($ac); ?>;
}
</style>
<?php
endif;
};
add_action('wp_head', 'acora_change_accent_color_css', 10);
function acora_admin_change_accent_color_css(){
$ac = get_theme_mod('acora_accent_color_db');
if(!empty($_COOKIE["acora_accent_color"])){
$ac = htmlspecialchars($_COOKIE["acora_accent_color"]);
}
?>
<style id="accent_color" type="text/css">
.edit-post-visual-editor .editor-writing-flow .wp-block .wp-block-freeform blockquote p:before,
.edit-post-visual-editor .editor-writing-flow .wp-block[data-type="core/quote"] blockquote p:before,
.edit-post-visual-editor .editor-writing-flow .wp-block[data-type="core/quote"] .components-autocomplete p:before,
.edit-post-visual-editor .editor-writing-flow .wp-block[data-type="core/quote"] .components-autocomplete p:after,
.edit-post-visual-editor .editor-writing-flow .wp-block[data-type="core/pullquote"] p:first-child:before{
color:<?php echo esc_html($ac); ?>;
}
.edit-post-visual-editor .editor-writing-flow .wp-block[data-type="core/pullquote"] blockquote:before{
border-top: solid 1px <?php echo esc_html($ac); ?>;
}
.edit-post-visual-editor .editor-writing-flow .wp-block[data-type="core/file"] .wp-block-file__button{
background-color: <?php echo esc_html($ac); ?>;
}
</style>
<?php
}
add_action('admin_head', 'acora_admin_change_accent_color_css');
/**
* Add active class to acora_portfolio slug.
* -----------------------------------------------------------------
*/
function acora_custom_active_item_classes($classes = array(), $menu_item = false){
global $post;
global $wp;
global $acora_port_base;
if (empty($post)) return $classes;
// Getting the post type of the current post and URI.
$current_post_type = get_post_type_object(get_post_type($post->ID));
//$current_post_type_slug = $current_post_type->rewrite['slug'];
// Test URI vs custom acora_portfolio slug.
if(!empty(preg_match("/{$acora_port_base}(\/){0,1}$/i", $wp->request))){
$classes[] = ($menu_item->url == get_post_type_archive_link($post->post_type)) ? 'current-menu-item' : '';
}
return $classes;
}
add_filter('nav_menu_css_class', 'acora_custom_active_item_classes', 10, 2);
/**
* Tweeks and utils.
* ------------------------------------------------------------
*/
function acora_comment_previous_page() {
return ' class="button-light button-icon-right icon-right" ';
}
add_filter('previous_comments_link_attributes', 'acora_comment_previous_page');
function acora_comment_next_page() {
return ' class="button-light button-icon-left icon-left" ';
}
add_filter('next_comments_link_attributes', 'acora_comment_next_page');
function acora_parse_query($wp_query){
if($wp_query->is_post_type_archive){
$wp_query->is_post_type_archive = false;
}
if($wp_query->is_post_type_archive){
$wp_query->is_post_type_archive = false;
}
}
add_action('parse_query', 'acora_parse_query');
function acora_num_posts_archive_project_ie($query) {
if(!is_admin() && $query->is_archive('acora_portfolio') && $query->is_main_query()){
$query->set('posts_per_page', -1);
}
return $query;
}
add_action('pre_get_posts', 'acora_num_posts_archive_project_ie');