tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); add_theme_support( 'custom-header' ); add_theme_support( 'custom-background' ); add_theme_support( 'woocommerce' ); add_theme_support( 'responsive-embeds' ); /* * 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' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'wp-block-styles' ); add_theme_support( 'align-wide' ); add_theme_support( 'wp-block-styles' ); add_theme_support( 'editor-styles' ); add_theme_support( 'post', 'page-attributes' ); // Set the default content width. $GLOBALS['content_width'] = 525; /*---------- Register image sizes ----------*/ //Register image sizes add_image_size( 'thinkai_730x295', 730, 295, true ); //thinkai_730x295 Project Masonry add_image_size( 'thinkai_350x620', 350, 620, true ); //thinkai_350x620 Project Masonry add_image_size( 'thinkai_350x295', 350, 295, true ); //thinkai_350x295 Project Masonry add_image_size( 'thinkai_370x320', 370, 320, true ); //thinkai_370x320 Blog Grid add_image_size( 'thinkai_370x270', 370, 270, true ); //thinkai_370x270 Project Masonry add_image_size( 'thinkai_370x370', 370, 370, true ); //thinkai_370x370 Project Masonry add_image_size( 'thinkai_370x420', 370, 420, true ); //thinkai_370x420 Team Grid add_image_size( 'thinkai_360x290', 360, 290, true ); //thinkai_360x290 Blog List View add_image_size( 'thinkai_1170x530', 1170, 530, true ); //thinkai_1170x530 Our Blog /*---------- Register image sizes ends ----------*/ // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'main_menu' => esc_html__( 'Main Menu', 'thinkai' ), 'footer_menu' => esc_html__( 'Footer Menu', 'thinkai' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Add theme support for Custom Logo. add_theme_support( 'custom-logo', array( 'width' => 250, 'height' => 250, 'flex-width' => true, ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, and column width. */ add_editor_style(); add_action( 'admin_init', 'thinkai_admin_init', 2000000 ); } /** * [thinkai_admin_init] * * @param array $data [description] * * @return [type] [description] */ function thinkai_admin_init() { remove_action( 'admin_notices', array( 'ReduxFramework', '_admin_notices' ), 99 ); } /*---------- Sidebar settings ----------*/ /** * [thinkai_widgets_init] * * @param array $data [description] * * @return [type] [description] */ function thinkai_widgets_init() { global $wp_registered_sidebars; $theme_options = get_theme_mod( 'thinkai' . '_options-mods' ); register_sidebar( array( 'name' => esc_html__( 'Default Sidebar', 'thinkai' ), 'id' => 'default-sidebar', 'description' => esc_html__( 'Widgets in this area will be shown on the right-hand side.', 'thinkai' ), 'before_widget' => '', 'before_title' => '', ) ); register_sidebar(array( 'name' => esc_html__('Footer Widget', 'thinkai'), 'id' => 'footer-sidebar', 'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'thinkai'), 'before_widget'=>'
', 'before_title' => '

', 'after_title' => '

' )); if ( class_exists( '\Elementor\Plugin' )){ //Footer Widget V2 register_sidebar(array( 'name' => esc_html__('Footer Widget 02', 'thinkai'), 'id' => 'footer-sidebar2', 'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'thinkai'), 'before_widget'=>'
', 'before_title' => '

', 'after_title' => '

' )); //Footer Widget V3 register_sidebar(array( 'name' => esc_html__('Footer Widget 03', 'thinkai'), 'id' => 'footer-sidebar3', 'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'thinkai'), 'before_widget'=>'
', 'before_title' => '

', 'after_title' => '

' )); //Footer Widget V4 register_sidebar(array( 'name' => esc_html__('Footer Widget 04', 'thinkai'), 'id' => 'footer-sidebar4', 'description' => esc_html__('Widgets in this area will be shown in Footer Area.', 'thinkai'), 'before_widget'=>'
', 'before_title' => '

', 'after_title' => '

' )); //Shop Widget register_sidebar(array( 'name' => esc_html__( 'Shop Widget', 'thinkai' ), 'id' => 'shop-sidebar', 'description' => esc_html__( 'Widgets in this area will be shown on the right-hand side.', 'thinkai' ), 'before_widget'=>'
', 'after_widget'=>'
', 'before_title' => '' )); //Service Widget register_sidebar(array( 'name' => esc_html__( 'Service Listing', 'thinkai' ), 'id' => 'service-sidebar', 'description' => esc_html__( 'Widgets in this area will be shown on the right-hand side.', 'thinkai' ), 'before_widget'=>'', 'before_title' => '

', 'after_title' => '

' )); //Blog Widget register_sidebar(array( 'name' => esc_html__( 'Blog Listing', 'thinkai' ), 'id' => 'blog-sidebar', 'description' => esc_html__( 'Widgets in this area will be shown on the right-hand side.', 'thinkai' ), 'before_widget'=>'', 'before_title' => '' )); } if ( ! is_object( thinkai_WSH() ) ) { return; } $sidebars = thinkai_set( $theme_options, 'custom_sidebar_name' ); foreach ( array_filter( (array) $sidebars ) as $sidebar ) { if ( thinkai_set( $sidebar, 'topcopy' ) ) { continue; } $name = $sidebar; if ( ! $name ) { continue; } $slug = str_replace( ' ', '_', $name ); register_sidebar( array( 'name' => $name, 'id' => sanitize_title( $slug ), 'before_widget' => '', 'before_title' => '', ) ); } update_option( 'wp_registered_sidebars', $wp_registered_sidebars ); } add_action( 'widgets_init', 'thinkai_widgets_init' ); /*---------- Sidebar settings ends ----------*/ /*---------- Gutenberg settings ----------*/ function thinkai_gutenberg_editor_palette_styles() { add_theme_support( 'editor-color-palette', array( array( 'name' => esc_html__( 'strong yellow', 'thinkai' ), 'slug' => 'strong-yellow', 'color' => '#f7bd00', ), array( 'name' => esc_html__( 'strong white', 'thinkai' ), 'slug' => 'strong-white', 'color' => '#fff', ), array( 'name' => esc_html__( 'light black', 'thinkai' ), 'slug' => 'light-black', 'color' => '#242424', ), array( 'name' => esc_html__( 'very light gray', 'thinkai' ), 'slug' => 'very-light-gray', 'color' => '#797979', ), array( 'name' => esc_html__( 'very dark black', 'thinkai' ), 'slug' => 'very-dark-black', 'color' => '#000000', ), ) ); add_theme_support( 'editor-font-sizes', array( array( 'name' => esc_html__( 'Small', 'thinkai' ), 'size' => 10, 'slug' => 'small' ), array( 'name' => esc_html__( 'Normal', 'thinkai' ), 'size' => 15, 'slug' => 'normal' ), array( 'name' => esc_html__( 'Large', 'thinkai' ), 'size' => 24, 'slug' => 'large' ), array( 'name' => esc_html__( 'Huge', 'thinkai' ), 'size' => 36, 'slug' => 'huge' ) ) ); } add_action( 'after_setup_theme', 'thinkai_gutenberg_editor_palette_styles' ); /*---------- Gutenberg settings ends ----------*/ /*---------- Enqueue Styles and Scripts ----------*/ function thinkai_enqueue_scripts() { $options = thinkai_WSH()->option(); $header_meta = get_post_meta( get_the_ID(), 'header_style_settings'); $header_option = $options->get( 'header_style_settings' ); $header = ( $header_meta ) ? $header_meta['0'] : $header_option; //styles wp_enqueue_style( 'animate', get_template_directory_uri() . '/assets/vendors/animate/animate.min.css' ); wp_enqueue_style( 'custom-animate', get_template_directory_uri() . '/assets/vendors/animate/custom-animate.css' ); wp_enqueue_style( 'aos', get_template_directory_uri() . '/assets/vendors/aos/aos.css' ); wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/vendors/bootstrap/css/bootstrap.min.css' ); wp_enqueue_style( 'bootstrap-touchspin', get_template_directory_uri() . '/assets/vendors/bootstrap-touchspin/jquery.bootstrap-touchspin.css' ); wp_enqueue_style( 'fancybox', get_template_directory_uri() . '/assets/vendors/fancybox/fancybox.min.css' ); wp_enqueue_style( 'thinkai-fontawesome-all', get_template_directory_uri() . '/assets/vendors/fontawesome/css/all.min.css' ); wp_enqueue_style( 'jarallax', get_template_directory_uri() . '/assets/vendors/jarallax/jarallax.css' ); wp_enqueue_style( 'jquery-magnific-popup', get_template_directory_uri() . '/assets/vendors/jquery-magnific-popup/jquery.magnific-popup.css' ); wp_enqueue_style( 'jquery-ui', get_template_directory_uri() . '/assets/vendors/jquery-ui/jquery-ui.css' ); wp_enqueue_style( 'nice-select', get_template_directory_uri() . '/assets/vendors/nice-select/nice-select.css' ); wp_enqueue_style( 'odometer', get_template_directory_uri() . '/assets/vendors/odometer/odometer.min.css' ); wp_enqueue_style( 'owl-carousel', get_template_directory_uri() . '/assets/vendors/owl-carousel/owl.carousel.min.css' ); wp_enqueue_style( 'owl-theme-default', get_template_directory_uri() . '/assets/vendors/owl-carousel/owl.theme.default.min.css' ); wp_enqueue_style( 'thinkai-swiper', get_template_directory_uri() . '/assets/vendors/swiper/swiper.min.css' ); wp_enqueue_style( 'timepicker', get_template_directory_uri() . '/assets/vendors/timepicker/timePicker.css' ); wp_enqueue_style( 'vegas', get_template_directory_uri() . '/assets/vendors/vegas/vegas.min.css' ); wp_enqueue_style( 'thm-icons-style', get_template_directory_uri() . '/assets/vendors/thm-icons/style.css' ); wp_enqueue_style( 'thinkai-header-section', get_template_directory_uri() . '/assets/css/module-css/01-header-section.css' ); wp_enqueue_style( 'thinkai-banner-section', get_template_directory_uri() . '/assets/css/module-css/02-banner-section.css' ); wp_enqueue_style( 'thinkai-about-section', get_template_directory_uri() . '/assets/css/module-css/03-about-section.css' ); wp_enqueue_style( 'thinkai-fact-counter-section', get_template_directory_uri() . '/assets/css/module-css/04-fact-counter-section.css' ); wp_enqueue_style( 'thinkai-testimonial-section', get_template_directory_uri() . '/assets/css/module-css/05-testimonial-section.css' ); wp_enqueue_style( 'thinkai-partner-section', get_template_directory_uri() . '/assets/css/module-css/06-partner-section.css' ); wp_enqueue_style( 'thinkai-footer-section', get_template_directory_uri() . '/assets/css/module-css/07-footer-section.css' ); wp_enqueue_style( 'thinkai-blog-section', get_template_directory_uri() . '/assets/css/module-css/08-blog-section.css' ); wp_enqueue_style( 'thinkai-breadcrumb-section', get_template_directory_uri() . '/assets/css/module-css/09-breadcrumb-section.css' ); wp_enqueue_style( 'thinkai-contact', get_template_directory_uri() . '/assets/css/module-css/10-contact.css' ); wp_enqueue_style( 'thinkai-services-section', get_template_directory_uri() . '/assets/css/module-css/11-services-section.css' ); wp_enqueue_style( 'thinkai-shop', get_template_directory_uri() . '/assets/css/module-css/12-shop.css' ); wp_enqueue_style( 'thinkai-main', get_stylesheet_uri() ); wp_enqueue_style( 'thinkai-main-style', get_template_directory_uri() . '/assets/css/style.css' ); if( $header == 'header_v5'){ wp_enqueue_style( 'thinkai-color5', get_template_directory_uri() . '/assets/css/color-4.css' ); }elseif( $header == 'header_v4'){ wp_enqueue_style( 'thinkai-color4', get_template_directory_uri() . '/assets/css/color-3.css' ); }elseif( $header == 'header_v3'){ wp_enqueue_style( 'thinkai-color3', get_template_directory_uri() . '/assets/css/color-2.css' ); }elseif( $header == 'header_v2'){ wp_enqueue_style( 'thinkai-color2', get_template_directory_uri() . '/assets/css/color-1.css' ); } wp_enqueue_style( 'thinkai-custom', get_template_directory_uri() . '/assets/css/custom.css' ); wp_enqueue_style( 'thinkai-tut', get_template_directory_uri() . '/assets/css/tut.css' ); wp_enqueue_style( 'thinkai-gutenberg', get_template_directory_uri() . '/assets/css/gutenberg.css' ); wp_enqueue_style( 'thinkai-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce.css' ); wp_enqueue_style( 'thinkai-responsive', get_template_directory_uri() . '/assets/css/responsive.css' ); //scripts wp_enqueue_script( 'jquery-ui-core'); wp_enqueue_script( 'bootstrap-bundle', get_template_directory_uri().'/assets/vendors/bootstrap/js/bootstrap.bundle.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'aos', get_template_directory_uri().'/assets/vendors/aos/aos.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'jquery-bootstrap-touchspin', get_template_directory_uri().'/assets/vendors/bootstrap-touchspin/jquery.bootstrap-touchspin.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'jquery-countdown', get_template_directory_uri().'/assets/vendors/countdown/jquery.countdown.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'jquery-fancybox', get_template_directory_uri().'/assets/vendors/fancybox/jquery.fancybox.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'isotope', get_template_directory_uri().'/assets/vendors/isotope/isotope.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'jarallax', get_template_directory_uri().'/assets/vendors/jarallax/jarallax.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'jquery-appear', get_template_directory_uri().'/assets/vendors/jquery-appear/jquery.appear.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'jquery-magnific-popup', get_template_directory_uri().'/assets/vendors/jquery-magnific-popup/jquery.magnific-popup.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'jquery-ui', get_template_directory_uri().'/assets/vendors/jquery-ui/jquery-ui.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'jquery-nice-select', get_template_directory_uri().'/assets/vendors/nice-select/jquery.nice-select.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'odometer', get_template_directory_uri().'/assets/vendors/odometer/odometer.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'owl-carousel', get_template_directory_uri().'/assets/vendors/owl-carousel/owl.carousel.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'swiper', get_template_directory_uri().'/assets/vendors/swiper/swiper.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'timepicker', get_template_directory_uri().'/assets/vendors/timepicker/timepicker.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'thinkai-vegas', get_template_directory_uri().'/assets/vendors/vegas/vegas.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'wow', get_template_directory_uri().'/assets/vendors/wow/wow.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'gsap', get_template_directory_uri().'/assets/vendors/gsap/gsap.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'scrolltrigger', get_template_directory_uri().'/assets/vendors/gsap/ScrollTrigger.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'splittext', get_template_directory_uri().'/assets/vendors/gsap/SplitText.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'extra-scripts', get_template_directory_uri().'/assets/vendors/extra-scripts/extra-scripts.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'marquee', get_template_directory_uri().'/assets/vendors/marquee/marquee.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'circletype', get_template_directory_uri().'/assets/vendors/curved-text/jquery.circleType.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'lettering', get_template_directory_uri().'/assets/vendors/curved-text/jquery.lettering.min.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'fittext', get_template_directory_uri().'/assets/vendors/curved-text/jquery.fittext.js', array( 'jquery' ), '2.1.2', true ); wp_enqueue_script( 'thinkai-main-custom', get_template_directory_uri().'/assets/js/custom.js', array(), false, true ); if( is_singular() ) wp_enqueue_script('comment-reply'); } add_action( 'wp_enqueue_scripts', 'thinkai_enqueue_scripts' ); /*---------- Enqueue styles and scripts ends ----------*/ /*---------- Google fonts ----------*/ function thinkai_fonts_url() { $fonts_url = ''; $font_families['Inter'] = 'Inter:wght@300,400,500,600,700,800,900&display=swap'; $font_families['Plus Jakarta Sans'] = 'Plus Jakarta Sans:ital,wght@0,300;0,400;0,500;0,700;0,800;1,500;1,700&display=swap'; $font_families = apply_filters( 'THINKAI/includes/classes/header_enqueue/font_families', $font_families ); $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $protocol = is_ssl() ? 'https' : 'http'; $fonts_url = add_query_arg( $query_args, $protocol . '://fonts.googleapis.com/css' ); return esc_url_raw($fonts_url); } function thinkai_theme_styles() { wp_enqueue_style( 'thinkai-theme-fonts', thinkai_fonts_url(), array(), null ); } add_action( 'wp_enqueue_scripts', 'thinkai_theme_styles' ); add_action( 'admin_enqueue_scripts', 'thinkai_theme_styles' ); /*---------- Google fonts ends ----------*/ /*---------- More functions ----------*/ // 1) thinkai_set function /** * [thinkai_set description] * * @param array $data [description] * * @return [type] [description] */ if ( ! function_exists( 'thinkai_set' ) ) { function thinkai_set( $var, $key, $def = '' ) { if ( is_object( $var ) && isset( $var->$key ) ) { return $var->$key; } elseif ( is_array( $var ) && isset( $var[ $key ] ) ) { return $var[ $key ]; } elseif ( $def ) { return $def; } else { return false; } } } //Contact Form 7 List function get_contact_form_7_list() { $contact_forms = array(); $cf7 = get_posts( 'post_type="wpcf7_contact_form"&numberposts=-1' ); if (!empty($cf7)) { foreach ($cf7 as $cform) { if (isset($cform)) { if (isset($cform->ID) && isset($cform->post_title)) { $contact_forms[$cform->ID] = $cform->post_title; } } } } return $contact_forms; } // 2) thinkai_add_editor_styles function function thinkai_add_editor_styles() { add_editor_style( 'editor-style.css' ); } add_action( 'admin_init', 'thinkai_add_editor_styles' ); // 3) Add specific CSS class by filter body class. $options = thinkai_WSH()->option(); if( thinkai_set($options, 'boxed_wrapper') ){ add_filter( 'body_class', function( $classes ) { $classes[] = 'boxed_wrapper'; return $classes; } ); } add_filter('doing_it_wrong_trigger_error', function () {return false;}, 10, 0); //Related Products function thinkai_related_products_limit() { global $product; $args['posts_per_page'] = 6; return $args; } add_filter( 'woocommerce_output_related_products_args', 'thinkai_related_products_args', 20 ); function thinkai_related_products_args( $args ) { $args['posts_per_page'] = 3; // 4 related products $args['columns'] = 1; // arranged in 2 columns return $args; } function thinkai_register_block_patterns() { register_block_pattern( 'thinkai/custom-pattern-1', array( 'title' => __('Custom Pattern 1', 'thinkai'), 'description' => __('Description of Custom Pattern 1.', 'thinkai'), 'content' => '', 'categories' => array('text'), 'keywords' => array('pattern', 'layout', 'custom'), ) ); // Add more block patterns as needed } add_action('init', 'thinkai_register_block_patterns'); function thinkai_register_block_styles() { // Register custom block styles for specific blocks register_block_style( 'core/paragraph', array( 'name' => 'thinkai-custom-style-1', 'label' => __('Custom Style 1', 'thinkai'), 'style_handle' => 'thinkai-custom-style-1-css', // Enqueue your custom style CSS ) ); // Add more custom block styles as needed } add_action('init', 'thinkai_register_block_styles');