';
print_r($data);
echo '';
}
}
//Child Theme Functions File
add_action( 'wp_print_scripts', 'alisoair_dequeue_script', 100 );
function alisoair_dequeue_script() {
wp_dequeue_script( 'twentynineteen-touch-navigation' );
}
add_action( 'wp_enqueue_scripts', 'alisoair_enqueue_wp_child_theme' );
add_action( 'admin_enqueue_scripts', 'alisoair_enqueue_wp_child_theme' );
function alisoair_enqueue_wp_child_theme()
{
//wp_enqueue_style('alisoair-parent-styles', get_template_directory_uri().'/style.css' ); //twentynineteen stylesheet
if(is_admin()){
wp_enqueue_script('alisoair-child-scripts', get_stylesheet_directory_uri() . '/js/admin-script.js', array( 'jquery' ), '1.0', true );
}else{
wp_enqueue_style('alisoair-child-styles', get_stylesheet_uri());
wp_enqueue_style('alisoair-default-styles', get_stylesheet_directory_uri() . '/css/default.css', array(), time());
wp_enqueue_style('alisoair-bootstrap-styles', get_stylesheet_directory_uri() . '/css/bootstrap.css', array(), time());
wp_enqueue_style('alisoair-basic-styles', get_stylesheet_directory_uri() . '/css/basic.css', array(), time());
wp_enqueue_style('alisoair-media-styles', get_stylesheet_directory_uri() . '/css/media.css', array(), time());
wp_enqueue_script('alisoair-popper-scripts', get_stylesheet_directory_uri() . '/js/popper.min.js', array( 'jquery' ), '1.0', true );
wp_enqueue_script('alisoair-bootstrap-scripts', get_stylesheet_directory_uri() . '/js/bootstrap.js', array( 'jquery' ), '1.0', true );
wp_enqueue_script('alisoair-child-scripts', get_stylesheet_directory_uri() . '/js/script.js', array( 'jquery' ), '1.0', true );
wp_localize_script( 'alisoair-child-scripts', 'alisoair', array( 'ajaxurl' => admin_url( 'admin-ajax.php'), 'home_url'=>home_url() ));
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
}
if ( ! function_exists( 'alisoair_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function alisoair_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Twenty Nineteen, use a find and replace
* to change 'alisoair' to the name of your theme in all the template files.
*/
load_child_theme_textdomain( 'alisoair', get_stylesheet_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus(
array(
'menu-1' => __( 'Primary Menu', 'alisoair' ),
'menu-2' => __( 'Secondary Menu', 'alisoair' ),
'mobile-menu' => __( 'Mobile Menu', 'alisoair' ),
)
);
/*
* 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 support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'height' => 190,
'width' => 190,
'flex-width' => false,
'flex-height' => false,
)
);
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );
// Add support for full and wide align images.
add_theme_support( 'align-wide' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Enqueue editor styles.
add_editor_style( 'style-editor.css' );
// Add custom editor font sizes.
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => __( 'Small', 'alisoair' ),
'shortName' => __( 'S', 'alisoair' ),
'size' => 19.5,
'slug' => 'small',
),
array(
'name' => __( 'Normal', 'alisoair' ),
'shortName' => __( 'M', 'alisoair' ),
'size' => 22,
'slug' => 'normal',
),
array(
'name' => __( 'Large', 'alisoair' ),
'shortName' => __( 'L', 'alisoair' ),
'size' => 36.5,
'slug' => 'large',
),
array(
'name' => __( 'Huge', 'alisoair' ),
'shortName' => __( 'XL', 'alisoair' ),
'size' => 49.5,
'slug' => 'huge',
),
)
);
// Editor color palette.
add_theme_support(
'editor-color-palette',
array(
array(
'name' => __( 'Primary', 'alisoair' ),
'slug' => 'primary',
'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 33 ),
),
array(
'name' => __( 'Secondary', 'alisoair' ),
'slug' => 'secondary',
'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 23 ),
),
array(
'name' => __( 'Dark Gray', 'alisoair' ),
'slug' => 'dark-gray',
'color' => '#111',
),
array(
'name' => __( 'Light Gray', 'alisoair' ),
'slug' => 'light-gray',
'color' => '#767676',
),
array(
'name' => __( 'White', 'alisoair' ),
'slug' => 'white',
'color' => '#FFF',
),
)
);
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
add_theme_support(
'custom-background',
apply_filters(
'alisoair_custom_background_args',
array(
'default-color' => '#fff',
'default-image' => '',//get_stylesheet_directory_uri() . '/images/water-drink-bottle.jpg',
'default-repeat' => 'repeat-y',
'default-position-x' => 'center',
'default-position-y' => 'top',
'default-size' => 'contain',
)
)
);
}
endif;
add_action( 'after_setup_theme', 'alisoair_setup' );
function alisoair_add_metaboxes_for_pages() {
add_post_type_support( 'page', 'excerpt' );
add_post_type_support( 'page', 'post-formats' );
}
add_action( 'init', 'alisoair_add_metaboxes_for_pages' );
function alisoair_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( 'alisoair_content_width', 640 );
}
add_action( 'after_setup_theme', 'alisoair_content_width', 0 );
function alisoair_widgets_init() {
register_sidebar( array(
'name' => __( 'Header Images Gallery', 'alisoair' ),
'id' => 'awhig-sidebar',
'description' => __( 'Add gallery widget here to rotate images in header.', 'alisoair' ),
'before_widget' => '',
'before_title' => '',
'after_title' => ' ',
) );
register_sidebar( array(
'name' => __( 'Widgets Under Header', 'alisoair' ),
'id' => 'awuh-sidebar',
'description' => __( 'Add widgets here to appear in under header images section.', 'alisoair' ),
'before_widget' => '',
'before_title' => '',
'after_title' => ' ',
) );
register_sidebar( array(
'name' => __( 'Sidebar Footer', 'alisoair' ),
'id' => 'sidebar-footer',
'description' => __( 'Add widgets here to appear in your sidebar.', 'alisoair' ),
'before_widget' => '',
'before_title' => '',
'after_title' => ' ',
) );
}
add_action( 'widgets_init', 'alisoair_widgets_init' );
function alisoair_body_classes( $classes ) {
// Adds a class of custom-background-image to sites with a custom background image.
if ( get_background_image() ) {
$classes[] = 'custom-background-image';
}
// Adds a class of group-blog to sites with more than 1 published author.
if ( is_multi_author() ) {
$classes[] = 'group-blog';
}
// Adds a class of no-sidebar to sites without active sidebar.
if ( ! is_active_sidebar( 'sidebar-main' ) ) {
$classes[] = 'no-sidebar';
}
// Adds a class of hfeed to non-singular pages.
if ( ! is_singular() ) {
$classes[] = 'hfeed';
}
if ( function_exists('is_shop') && is_shop() ) {
$classes[] = 'wc-shop';
}
$classes[] = 'alisoair';
return $classes;
}
add_filter( 'body_class', 'alisoair_body_classes' );
function alisoair_get_svg( $args = array() ) {
// Make sure $args are an array.
if ( empty( $args ) ) {
return __( 'Please define default parameters in the form of an array.', 'alisoair' );
}
// Define an icon.
if ( false === array_key_exists( 'icon', $args ) ) {
return __( 'Please define an SVG icon filename.', 'alisoair' );
}
// Set defaults.
$defaults = array(
'icon' => '',
'title' => '',
'desc' => '',
'fallback' => false,
);
// Parse args.
$args = wp_parse_args( $args, $defaults );
// Set aria hidden.
$aria_hidden = ' aria-hidden="true"';
// Set ARIA.
$aria_labelledby = '';
if ( $args['title'] ) {
$aria_hidden = '';
$unique_id = uniqid();
$aria_labelledby = ' aria-labelledby="title-' . esc_attr($unique_id) . '"';
if ( $args['desc'] ) {
$aria_labelledby = ' aria-labelledby="title-' . esc_attr($unique_id) . ' desc-' . esc_attr($unique_id) . '"';
}
}
// Begin SVG markup.
$svg = '';
// Display the title.
if ( $args['title'] ) {
$svg .= '' . esc_html( $args['title'] ) . ' ';
// Display the desc only if the title is already set.
if ( $args['desc'] ) {
$svg .= '' . esc_html( $args['desc'] ) . ' ';
}
}
/*
* Display the icon.
*
* The whitespace around `` is intentional - it is a work around to a keyboard navigation bug in Safari 10.
*
* See https://core.trac.wordpress.org/ticket/38387.
*/
$svg .= ' ';
// Add some markup to use as a fallback for browsers that do not support SVGs.
if ( $args['fallback'] ) {
$svg .= ' ';
}
$svg .= ' ';
return $svg;
}
function alisoair_sanitize_input( $input ) {
if(is_array($input)){
$new_input = array();
foreach ( $input as $key => $val ) {
$new_input[ $key ] = (is_array($val)?alisoair_sanitize_input($val):sanitize_text_field( $val ));
}
}else{
$new_input = sanitize_text_field($input);
if(stripos($new_input, '@') && is_email($new_input)){
$new_input = sanitize_email($new_input);
}
if(stripos($new_input, 'http') || wp_http_validate_url($new_input)){
$new_input = esc_url($new_input);
}
}
return $new_input;
}
add_action( 'customize_register', 'alisoair_register_additional_customizer_settings' );
function alisoair_register_additional_customizer_settings( $wp_customize ) {
//facebook profile
$wp_customize->add_section('alisoair_header_section', array(
'title' => __('Header Section', 'alisoair'),
'priority' => 30,
));
$wp_customize->add_setting(
'alisoair_header_image',
array(
'default' => '',
'sanitize_callback' => 'alisoair_sanitize_input',
'type' => 'option', // you can also use 'theme_mod'
'capability' => 'edit_theme_options'
)
);
$wp_customize->add_control( new WP_Customize_Media_Control(
$wp_customize,
'alisoair_header_image', array(
'label' => __( 'Header Image', 'alisoair' ),
'section' => 'alisoair_header_section',
'mime_type' => 'image',
)
) );
$wp_customize->add_setting(
'alisoair_header_image',
array(
'default' => '',
'sanitize_callback' => 'alisoair_sanitize_input',
'type' => 'option', // you can also use 'theme_mod'
'capability' => 'edit_theme_options'
)
);
$wp_customize->add_control( new WP_Customize_Media_Control(
$wp_customize,
'alisoair_header_image', array(
'label' => __( 'Header Image', 'alisoair' ),
'section' => 'alisoair_header_section',
'mime_type' => 'image',
)
) );
$wp_customize->add_setting(
'alisoair_youtube_profile',
array(
'default' => '#',
'sanitize_callback' => 'alisoair_sanitize_input',
'type' => 'option', // you can also use 'theme_mod'
'capability' => 'edit_theme_options'
)
);
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'alisoair_youtube_profile',
array(
'label' => __( 'Youtube', 'alisoair' ),
'description' => __( 'Enter your Youtube URL', 'alisoair' ),
'settings' => 'alisoair_youtube_profile',
'priority' => 10,
'section' => 'alisoair_header_section',
'type' => 'text',
)
) );
$wp_customize->add_setting(
'alisoair_facebook_profile',
array(
'default' => '#',
'sanitize_callback' => 'alisoair_sanitize_input',
'type' => 'option', // you can also use 'theme_mod'
'capability' => 'edit_theme_options'
)
);
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'alisoair_facebook_profile',
array(
'label' => __( 'Facebook', 'alisoair' ),
'description' => __( 'Enter your Facebook URL', 'alisoair' ),
'settings' => 'alisoair_facebook_profile',
'priority' => 10,
'section' => 'alisoair_header_section',
'type' => 'text',
)
) );
$wp_customize->add_setting(
'alisoair_twitter_profile',
array(
'default' => '#',
'sanitize_callback' => 'alisoair_sanitize_input',
'type' => 'option', // you can also use 'theme_mod'
'capability' => 'edit_theme_options'
)
);
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'alisoair_twitter_profile',
array(
'label' => __( 'Twitter', 'alisoair' ),
'description' => __( 'Enter your Twitter URL', 'alisoair' ),
'settings' => 'alisoair_twitter_profile',
'priority' => 10,
'section' => 'alisoair_header_section',
'type' => 'text',
)
) );
$wp_customize->add_setting(
'alisoair_rss_profile',
array(
'default' => '#',
'sanitize_callback' => 'alisoair_sanitize_input',
'type' => 'option', // you can also use 'theme_mod'
'capability' => 'edit_theme_options'
)
);
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'alisoair_rss_profile',
array(
'label' => __( 'RSS', 'alisoair' ),
'description' => __( 'Enter your RSS URL', 'alisoair' ),
'settings' => 'alisoair_rss_profile',
'priority' => 10,
'section' => 'alisoair_header_section',
'type' => 'text',
)
) );
}
add_filter('nav_menu_submenu_css_class', 'alisoair_nav_submenu_class', 10, 3);
function alisoair_nav_submenu_class($classes, $args, $lvl)
{
if (in_array('sub-menu', $classes)) {
$classes[] = 'dropdown-menu';
}
// pree($args);exit;
return $classes;
}
add_filter('nav_menu_css_class', 'alisoair_nav_class', 10, 4);
function alisoair_nav_class($classes, $item, $args, $lvl)
{
if (in_array('menu-item', $classes)) {
$classes[] = 'nav-item';
}
if (in_array('menu-item-has-children', $classes) && $lvl == 0) {
$classes[] = '';
}
if (in_array('menu-item-has-children', $classes) && $lvl > 0) {
$classes[] = '';
}
//pree($item);
return $classes;
}
add_filter('walker_nav_menu_start_el', 'alisoair_nav_menu_args', 10, 4);
function alisoair_nav_menu_args($output, $item ,$lvl, $args)
{
if (in_array('menu-item', $item->classes) && $lvl == 0) {
$output = str_replace('">', '" class="nav-link">', $output);
// $output = str_replace('">', '" class="dropdown-toggle nav-link" data-toggle="dropdown" aria-expanded="true">', $output);
}
if (in_array('menu-item', $item->classes) && in_array('menu-item-has-children', $item->classes) && $lvl == 0) {
$output = str_replace('" class="nav-link">', '" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-expanded="true">', $output);
}
if (in_array('menu-item', $item->classes) && $lvl > 0) {
$output = str_replace('">', '" class="dropdown-item">', $output);
}
if (in_array('menu-item', $item->classes) && in_array('menu-item-has-children', $item->classes) && $lvl > 0) {
$output = str_replace('" class="dropdown-item">', '" class="dropdown-item dropdown-toggle" data-toggle="dropdown" aria-expanded="true">', $output);
}
return $output;
}
require get_stylesheet_directory() . '/inc/template-tags.php';
if (!function_exists('alisoair_breadcrumb')) {
function alisoair_breadcrumb($divOption = array("id" => "alisoair_breadcrumb", "class" => "alisoair_breadcrumb inner wrap cf")){
global $post;
$str ='';
if(!get_option('side_options_pannavi')){
if(!is_home()&&!is_front_page()&&!is_admin() ){
$tagAttribute = '';
foreach($divOption as $attrName => $attrValue){
$tagAttribute .= sprintf(' %s="%s"', $attrName, esc_attr($attrValue));
}
$p = 1;
$str.= '';
$str.= '
';
$str.= 'HOME ';
if(is_category()) {
$cat = get_queried_object();
if($cat->parent != 0){
$ancestors = array_reverse(get_ancestors( $cat -> cat_ID, 'category' ));
foreach($ancestors as $ancestor){
if(get_cat_name($ancestor)!=''){
$p++;
$str.=''. esc_html( get_cat_name($ancestor) ) .' ';
}
}
}
if($cat->name){
$p++;
$str.=''. esc_attr($cat->name) . ' ';
}
} elseif(is_single()){
$categories = get_the_category($post->ID);
$cat = $categories[0];
if($cat -> parent != 0){
$ancestors = array_reverse(get_ancestors( $cat->cat_ID, 'category' ));
foreach($ancestors as $ancestor){
if(get_cat_name($ancestor)){
$p++;
$str.=''. esc_html( get_cat_name($ancestor) ). ' ';
}
}
}
if($cat-> cat_name){
$p++;
$str.=''. $cat-> cat_name . ' ';
}
if($post -> post_title){
//$p++;
$str.= ''. $post -> post_title .' ';//
}
} elseif(is_page()){
if($post -> post_parent != 0 ){
$ancestors = array_reverse(get_post_ancestors( $post->ID ));
foreach($ancestors as $ancestor){
if(get_the_title($ancestor)){
$p++;
$str.=''. esc_html( get_the_title($ancestor) ) .' ';
}
}
}
if($post->post_title){
$p++;
$str.= ''. esc_attr($post->post_title) .' ';
}
} else{
if(wp_get_document_title('', false)){
//$p++;
$str.=''. wp_get_document_title('', false) .' ';//
}
}
$str.=' ';
$str.='
';
}
}
echo $str;
}
}
function alisoair_filter_media_comment_status( $open, $post_id ) {
return false;
$post = get_post( $post_id );
if( $post->post_type == 'attachment' ) {
return false;
}
return $open;
}
add_filter( 'comments_open', 'alisoair_filter_media_comment_status', 10 , 2 );