D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
cwd
/
wp-content
/
themes
/
pixwell
/
Filename :
functions.php
back
Copy
<?php define( 'PIXWELL_THEME_VERSION', '10.7' ); include_once get_theme_file_path( 'includes/core.php' ); include_once get_theme_file_path( 'backend/include-files.php' ); include_once get_theme_file_path( 'includes/include-files.php' ); include_once get_theme_file_path( 'templates/include-files.php' ); add_action( 'after_setup_theme', 'pixwell_theme_setup', 10 ); add_action( 'wp_enqueue_scripts', 'pixwell_register_script_frontend', 10 ); /** load translate */ load_theme_textdomain( 'pixwell', get_theme_file_path( 'languages' ) ); /** setup */ if ( ! function_exists( 'pixwell_theme_setup' ) ) { function pixwell_theme_setup() { if ( ! isset( $GLOBALS['content_width'] ) ) { $GLOBALS['content_width'] = 1170; } $settings = get_option( 'pixwell_theme_options', [] ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'title-tag' ); add_theme_support( 'html5', [ 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'script', 'style', ] ); add_theme_support( 'amp', [ 'paired' => true, ] ); add_theme_support( 'post-formats', [ 'gallery', 'video', 'audio' ] ); add_theme_support( 'post-thumbnails' ); add_theme_support( 'editor-style' ); add_theme_support( 'responsive-embeds' ); if ( ! empty( $settings['widget_block'] ) ) { remove_theme_support( 'widgets-block-editor' ); } add_theme_support( 'woocommerce', [ 'gallery_thumbnail_image_width' => 110, 'thumbnail_image_width' => 300, 'single_image_width' => 760, ] ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); register_nav_menus( [ 'pixwell_menu_main' => esc_html__( 'Main Menu', 'pixwell' ), 'pixwell_menu_offcanvas' => esc_html__( 'Left Aside Menu (Mobile Menu)', 'pixwell' ), 'pixwell_menu_top' => esc_html__( 'Top Bar Menu', 'pixwell' ), 'pixwell_menu_footer' => esc_html__( 'Footer Menu', 'pixwell' ), ] ); $crop_data = pixwell_calc_crop_sizes(); foreach ( $crop_data as $crop_id => $size ) { add_image_size( $crop_id, $size[0], $size[1], $size[2] ); } if ( ! empty( $settings['site_itemlist'] ) && ! isset( $GLOBALS['pixwell_pids'] ) ) { $GLOBALS['pixwell_pids'] = []; } } } if ( ! function_exists( 'pixwell_register_script_frontend' ) ) { function pixwell_register_script_frontend() { $style_deps = [ 'pixwell-font' ]; wp_register_style( 'pixwell-font', esc_url_raw( Pixwell_Font::get_instance()->get_font_url() ), [], PIXWELL_THEME_VERSION, 'all' ); if ( is_rtl() ) { wp_enqueue_style( 'pixwell-main', get_theme_file_uri( 'assets/css/rtl.css' ), $style_deps, PIXWELL_THEME_VERSION, 'all' ); } else { wp_enqueue_style( 'pixwell-main', get_theme_file_uri( 'assets/css/main.css' ), $style_deps, PIXWELL_THEME_VERSION, 'all' ); } $style_deps[] = 'pixwell-main'; if ( class_exists( 'WooCommerce' ) && ! pixwell_is_amp() ) { wp_deregister_style( 'yith-wcwl-font-awesome' ); if ( is_rtl() ) { wp_enqueue_style( 'pixwell-wc', get_theme_file_uri( 'assets/css/woocommerce-rtl.css' ), $style_deps, PIXWELL_THEME_VERSION, 'all' ); } else { wp_enqueue_style( 'pixwell-wc', get_theme_file_uri( 'assets/css/woocommerce.css' ), $style_deps, PIXWELL_THEME_VERSION, 'all' ); } $style_deps[] = 'pixwell-wc'; } if ( ! pixwell_get_option( 'disable_default_style' ) ) { wp_enqueue_style( 'pixwell-style', get_stylesheet_uri(), $style_deps, PIXWELL_THEME_VERSION, 'all' ); } /** load scripts */ if ( ! pixwell_is_amp() ) { wp_enqueue_script( 'html5', get_theme_file_uri( 'assets/js/html5shiv.min.js' ), [], '3.7.3' ); wp_script_add_data( 'html5', 'conditional', 'lt IE 9' ); wp_enqueue_script( 'jquery-waypoints', get_theme_file_uri( 'assets/js/jquery.waypoints.min.js' ), [ 'jquery' ], '3.1.1', true ); wp_enqueue_script( 'owl-carousel', get_theme_file_uri( 'assets/js/owl.carousel.min.js' ), [ 'jquery' ], '1.8.1', true ); wp_enqueue_script( 'pixwell-sticky', get_theme_file_uri( 'assets/js/rbsticky.min.js' ), [ 'jquery' ], '1.0', true ); wp_enqueue_script( 'jquery-tipsy', get_theme_file_uri( 'assets/js/jquery.tipsy.min.js' ), [ 'jquery' ], '1.0', true ); wp_enqueue_script( 'jquery-uitotop', get_theme_file_uri( 'assets/js/jquery.ui.totop.min.js' ), [ 'jquery' ], 'v1.2', true ); wp_enqueue_script( 'jquery-isotope', get_theme_file_uri( 'assets/js/jquery.isotope.min.js' ), [ 'jquery' ], '3.0.6', true ); wp_enqueue_script( 'pixwell-global', get_theme_file_uri( 'assets/js/global.js' ), [ 'jquery', 'imagesloaded', 'jquery-waypoints', 'owl-carousel', 'pixwell-sticky', 'jquery-tipsy', 'jquery-uitotop', 'jquery-isotope', ], PIXWELL_THEME_VERSION, true ); wp_localize_script( 'pixwell-global', 'pixwellParams', [ 'ajaxurl' => admin_url( 'admin-ajax.php' ) ] ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } } }