File: /www/wwwroot/aiwellbore.com/wp-content/updraft/themes-old/study-education-pro/functions.php
<?php
/**
* Study Education Pro functions and definitions
*
* @package Study Education Pro
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
require_once get_template_directory() . "/inc/customizer/frontend-sections/sections.php";
require_once get_template_directory() . "/inc/customizer/frontend-sections/style.php";
get_template_part('inc/customizer/customs', 'customization');
get_template_part('inc/customizer/customs-customization', 'css');
get_template_part('inc/customizer/customs-customization-font', 'familly');
get_template_part('inc/customizer/customs-customization', 'gnsettings');
get_template_part('inc/customizer/header/header-phone', 'email');
get_template_part('inc/customizer/header/header', 'menu');
get_template_part('inc/custom-functions', 'customizer');
get_template_part('header/slider', 'setting');
get_template_part('inc/customizer/header/header', 'social');
get_template_part('inc/customizer/sections-customizer/customs-customization-header', 'banner');
get_template_part('inc/customizer/footer/footer', 'copyright');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'resources');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'welcome');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'feature');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'video');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'cource');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'offer');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'educationwelcome');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'news');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'team');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'testimonial');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'galleryslider');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'banners');
get_template_part('inc/customizer/sections-customizer/customs-customization', 'layout');
get_template_part('inc/customizer/sections-customizer/customs-customization-sort', 'order');
get_template_part('inc/customizer/sections-customizer/customs-customization-counter', 'skill');
get_template_part('inc/customizer/footer/footer', 'layout');
get_template_part('inc/customizer/footer/footer', 'sections');
get_template_part('inc/customizer/footer/footer', 'contactus');
function limit_content_chr($content, $limit = 100) {
return mb_strimwidth(strip_tags($content), 0, $limit, '...');
}
function content($limit) {
$content = explode(' ', get_the_excerpt(), $limit);
if (count($content) >= $limit) {
array_pop($content);
$content = implode(" ", $content) . '...';
} else {
$content = implode(" ", $content);
}
$content = preg_replace('/\[.+\]/', '', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
function study_education_pro_custom_logo_setup() {
$defaults = array(
'height' => 107,
'width' => 385,
'flex-height' => true,
'flex-width' => true,
'header-text' => array('site-title', 'site-description'),
);
add_theme_support('custom-logo', $defaults);
}
add_action('after_setup_theme', 'study_education_pro_custom_logo_setup');
if (!function_exists('study_education_pro_setup')) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*/
function study_education_pro_setup() {
if (!isset($content_width))
$content_width = 640; /* pixels */
load_theme_textdomain('study-education-pro', get_template_directory() . '/languages');
add_theme_support('automatic-feed-links');
add_theme_support('post-thumbnails');
add_theme_support('woocommerce');
add_theme_support('title-tag');
add_image_size('homepage-thumb', 240, 145, true);
add_image_size('headerlogo385and93', 385, 107, true);
add_image_size('innerpagebanner1600and500', 1600, 500, true);
add_image_size('homepagemainslider1600and550', 1600, 550, true);
add_image_size('homepage-news-thumb', 640, 426, true);
add_image_size('welcomeeducationthumb408and469', 408, 469, true);
add_image_size('fteam270and340', 270, 340, true);
add_image_size('galleryslider620and650', 620, 650, true);
add_image_size('courcethumb251and251', 251, 251, true);
add_image_size('featurethumb120and100', 120, 100, true);
add_image_size('choose_usthumb370and358', 370, 358, true);
add_image_size('welcome600and600', 600, 600, true);
add_image_size('resourcethumb400and250', 400, 250, true);
register_nav_menus(array(
'primary' => esc_html__('Primary Menu', 'study-education-pro'),
'footer' => esc_html__('Footer Menu', 'study-education-pro'),
));
add_theme_support('custom-background', array(
'default-color' => 'ffffff'
));
add_editor_style('editor-style.css');
}
endif; // study_education_pro_setup
add_action('after_setup_theme', 'study_education_pro_setup');
function study_education_pro_widgets_init() {
register_sidebar(array(
'name' => esc_html__('Blog Sidebar', 'study-education-pro'),
'description' => esc_html__('Appears on blog page sidebar', 'study-education-pro'),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3><aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
));
register_sidebar(array(
'name' => esc_html__('Sidebar Main', 'study-education-pro'),
'description' => esc_html__('Appears on page sidebar', 'study-education-pro'),
'id' => 'sidebar-main',
'before_widget' => '',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3><aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
));
register_sidebar(array(
'name' => esc_html__('Footer Widget 1', 'study-education-pro'),
'description' => esc_html__('Appears on footer', 'study-education-pro'),
'id' => 'footer-1',
'before_widget' => '<div id="%1$s" class="widget-column-1">',
'after_widget' => '</div>',
'before_title' => '<h5>',
'after_title' => '</h5>',
));
register_sidebar(array(
'name' => esc_html__('Footer Widget 2', 'study-education-pro'),
'description' => esc_html__('Appears on footer', 'study-education-pro'),
'id' => 'footer-2',
'before_widget' => '<div id="%1$s" class="widget-column-2">',
'after_widget' => '</div>',
'before_title' => '<h5>',
'after_title' => '</h5>',
));
register_sidebar(array(
'name' => esc_html__('Footer Widget 3', 'study-education-pro'),
'description' => esc_html__('Appears on footer', 'study-education-pro'),
'id' => 'footer-3',
'before_widget' => '<div id="%1$s" class="widget-column-3">',
'after_widget' => '</div>',
'before_title' => '<h5>',
'after_title' => '</h5>',
));
register_sidebar(array(
'name' => esc_html__('Footer Widget 4', 'study-education-pro'),
'description' => esc_html__('Appears on footer', 'study-education-pro'),
'id' => 'footer-4',
'before_widget' => '<div id="%1$s" class="widget-column-4">',
'after_widget' => '</div>',
'before_title' => '<h5>',
'after_title' => '</h5>',
));
register_sidebar(array(
'name' => esc_html__('Sidebar Contact Page', 'study-education-pro'),
'description' => esc_html__('Appears on contact page', 'study-education-pro'),
'id' => 'sidebar-contact',
'before_widget' => '<aside class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
}
add_action('widgets_init', 'study_education_pro_widgets_init');
function study_education_pro_scripts() {
wp_enqueue_style('study_education_pro-gfonts-roboto', '//fonts.googleapis.com/css?family=Roboto:400,100,300,500,700');
wp_enqueue_style('study_education_pro-gfonts-robotocondensed', '//fonts.googleapis.com/css?family=Roboto+Condensed:400,300,300italic,400italic,700');
wp_enqueue_style('study_education_pro-gfonts-lato', '//fonts.googleapis.com/css?family=Lato:400,100,100italic,300,300italic,400italic,700,700italic,900,900italic');
wp_enqueue_style('study_education_pro-gfonts-ptsans', '//fonts.googleapis.com/css?family=PT+Sans:400,400italic,700,700italic');
wp_enqueue_style('study_education_pro-gfonts-Open Sans', '//fonts.googleapis.com/css?family=Open Sans:400,100,200,300,500,600,700,900,800');
$study_education_pro_select_bodyfont = get_theme_mod('study_education_pro_select_bodyfont');
wp_enqueue_style('study_education_pro-gfonts-body', '//fonts.googleapis.com/css?family=' . rawurlencode($study_education_pro_select_bodyfont) . '&subset=cyrillic,arabic,bengali,cyrillic,cyrillic-ext,devanagari,greek,greek-ext,gujarati,hebrew,latin-ext,tamil,telugu,thai,vietnamese,latin');
$study_education_pro_select_textuallogo = get_theme_mod('study_education_pro_select_textuallogo');
wp_enqueue_style('study_education_pro-gfonts-logo', '//fonts.googleapis.com/css?family=' . rawurlencode($study_education_pro_select_textuallogo) . '&subset=cyrillic,arabic,bengali,cyrillic,cyrillic-ext,devanagari,greek,greek-ext,gujarati,hebrew,latin-ext,tamil,telugu,thai,vietnamese,latin');
$custom_menu_text_font = get_theme_mod('custom_menu_text_font');
wp_enqueue_style('study_education_pro-gfonts-nav', '//fonts.googleapis.com/css?family=' . rawurlencode($custom_menu_text_font) . '&subset=cyrillic,arabic,bengali,cyrillic,cyrillic-ext,devanagari,greek,greek-ext,gujarati,hebrew,latin-ext,tamil,telugu,thai,vietnamese,latin');
$study_education_pro_select_headingfont = get_theme_mod('study_education_pro_select_headingfont');
wp_enqueue_style('study_education_pro-gfonts-heading', '//fonts.googleapis.com/css?family=' . rawurlencode($study_education_pro_select_headingfont) . '&subset=cyrillic,arabic,bengali,cyrillic,cyrillic-ext,devanagari,greek,greek-ext,gujarati,hebrew,latin-ext,tamil,telugu,thai,vietnamese,latin');
wp_enqueue_style('study_education_pro-basic-style', get_stylesheet_uri());
wp_enqueue_style('study_education_pro-editor-style', get_template_directory_uri() . '/editor-style.css');
wp_enqueue_style('study_education_pro-base-style', get_template_directory_uri() . '/css/style_base.css');
if (is_home() || is_front_page()) {
wp_enqueue_style('study_education_pro-nivo-style', get_template_directory_uri() . '/css/nivo-slider.css');
wp_enqueue_script('study_education_pro-nivo-slider', get_template_directory_uri() . '/js/jquery.nivo.slider.js', array('jquery'));
}
wp_enqueue_style('study_education_pro-prettyphoto-style', get_template_directory_uri() . '/css/prettyPhoto.css');
wp_enqueue_script('study_education_pro-prettyphoto-script', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery'));
wp_enqueue_script('study_education_pro-customscripts', get_template_directory_uri() . '/js/custom.js', array('jquery'));
wp_enqueue_style('study_education_pro-font-awesome-style-new', get_template_directory_uri() . '/css/fontawesome-new.css');
wp_enqueue_style('study_education_pro-font-awesome-brands-new', get_template_directory_uri() . '/css/brands.css');
wp_enqueue_style('study_education_pro-font-awesome-solid-new', get_template_directory_uri() . '/css/solid.css');
wp_enqueue_script('study_education_pro-testimonialsmin_js', get_template_directory_uri() . '/testimonials-rotator/js/jquery.quovolver.min.js');
wp_enqueue_script('study_education_pro-testimonials-bootstrap', get_template_directory_uri() . '/testimonials-rotator/js/bootstrap.js');
wp_enqueue_style('study_education_pro-testimonialslider-style', get_template_directory_uri() . '/testimonials-rotator/js/tm-rotator.css');
wp_enqueue_style('study_education_pro-animation-style', get_template_directory_uri() . '/css/animation.css');
wp_enqueue_style('study_education_pro-responsive-style', get_template_directory_uri() . '/css/theme-responsive.css');
wp_enqueue_style('study_education_pro-owl-style', get_template_directory_uri() . '/testimonials-rotator/js/owl.carousel.css');
wp_enqueue_script('study_education_pro-owljs', get_template_directory_uri() . '/testimonials-rotator/js/owl.carousel.js');
//Client Logo Rotator
wp_enqueue_style('grc_study-education-pro-flexiselcss', get_template_directory_uri() . '/css/flexiselcss.css');
wp_enqueue_script('grc_study-education-pro-flexisel', get_template_directory_uri() . '/js/jquery.flexisel.js', array('jquery'));
//animate effect
wp_enqueue_style('grc_study_education_pro_animate', get_template_directory_uri() . '/animate/animate.css');
wp_enqueue_script('grc_study_education_pro_viewportchecher', get_template_directory_uri() . '/animate/viewportchecker.js', array('jquery'));
//Counter
wp_enqueue_script('study-education-procounter_waypoints', get_template_directory_uri() . '/counter/js/waypoints.min.js', array('jquery'));
wp_enqueue_script('study-education-procounter_counter', get_template_directory_uri() . '/counter/js/jquery.counterup.min.js', array('jquery'));
// mixitup gallery
wp_enqueue_script('study_education_pro-mixitup-scripts', get_template_directory_uri() . '/mixitup/jquery_mixitup.js');
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
//if (get_theme_mod('scrollanimation', true) != true) {
wp_enqueue_style('study_education_pro-animation-style', get_template_directory_uri() . '/css/animation-style.css');
wp_enqueue_script('study_education_pro-custom-animation', get_template_directory_uri() . '/js/custom-animation.js', array('jquery'));
//}
//popup video
wp_enqueue_style('study_education_pro-popup-youtube-style', get_template_directory_uri() . '/popupvideo/grt-youtube-popup.css');
wp_enqueue_script('study_education_pro-popup-youtube-js', get_template_directory_uri() . '/popupvideo/grt-youtube-popup.js', array('jquery'));
//popup video end
}
add_action('wp_enqueue_scripts', 'study_education_pro_scripts');
function media_css_hook() {
?>
<script>
jQuery(window).bind('scroll', function () {
var wwd = jQuery(window).width();
if (wwd > 939) {
var navHeight = jQuery(window).height() - 575;
<?php if (get_theme_mod('headstick', true) != true) { ?>
if (jQuery(window).scrollTop() > navHeight) {
jQuery(".header").addClass('fixed');
jQuery(".header-top").css("display", "none");
} else {
jQuery(".header").removeClass('fixed');
jQuery(".header-top").css("display", "block");
}
<?php } ?>
}
});
jQuery(document).ready(function () {
jQuery('.link').on('click', function (event) {
var $this = jQuery(this);
if ($this.hasClass('clicked')) {
$this.removeAttr('style').removeClass('clicked');
} else {
$this.css('background', '#7fc242').addClass('clicked');
}
});
});
</script>
<?php
}
add_action('wp_head', 'media_css_hook');
function study_education_pro_pagination() {
global $wp_query;
$big = 12345678;
$page_format = paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages,
'type' => 'array'
));
if (is_array($page_format)) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '<div class="pagination"><div><ul>';
echo '<li><span>' . esc_html($paged) . ' of ' . esc_html($wp_query->max_num_pages) . '</span></li>';
foreach ($page_format as $page) {
echo "<li>" . $page . "</li>";
}
echo '</ul></div></div>';
}
}
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Load custom functions file.
*/
require get_template_directory() . '/inc/custom-functions.php';
function study_education_pro_custom_blogpost_pagination($wp_query) {
$big = 999999999; // need an unlikely integer
if (get_query_var('paged')) {
$pageVar = 'paged';
} elseif (get_query_var('page')) {
$pageVar = 'page';
} else {
$pageVar = 'paged';
}
$pagin = paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?' . $pageVar . '=%#%',
'current' => max(1, get_query_var($pageVar)),
'total' => $wp_query->max_num_pages,
'prev_text' => '« Prev',
'next_text' => 'Next »',
'type' => 'array'
));
if (is_array($pagin)) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '<div class="pagination"><div><ul>';
echo '<li><span>' . esc_html($paged) . ' of ' . esc_html($wp_query->max_num_pages) . '</span></li>';
foreach ($pagin as $page) {
echo "<li>" . $page . "</li>";
}
echo '</ul></div></div>';
}
}
// get slug by id
function study_education_pro_get_slug_by_id($id) {
$post_data = get_post($id, ARRAY_A);
$slug = $post_data['post_name'];
return $slug;
}
function custom_excerpt_length($length) {
return $length;
}
add_filter('excerpt_length', 'custom_excerpt_length', 999);