tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /** * Add post-formats support. */ add_theme_support( 'post-formats', [ 'link', 'aside', 'gallery', 'image', 'quote', 'status', 'video', 'audio', 'chat', ] ); /** * Enable support for Post Thumbnails on posts and pages. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); add_image_size( 'themeoo-blog-grid', 540, 420, true ); add_image_size( 'themeoo-gallery', 420, 420, true ); add_image_size( 'themeoo-vertical', 300, 580, true ); $blog_normal = themeoo_get_mod( 'layout_blog_normal_image' ); $blog_medium = themeoo_get_mod( 'layout_blog_medium_image' ); $blog_grid = themeoo_get_mod( 'layout_blog_grid_image' ); if ( $blog_normal ) { $blog_normal = explode( ',', $blog_normal ); $blog_normal = array_map( 'absint', $blog_normal ); add_image_size( 'blog-normal', $blog_normal[0], $blog_normal[1], true ); } if ( $blog_medium ) { $blog_medium = explode( ',', $blog_medium ); $blog_medium = array_map( 'absint', $blog_medium ); add_image_size( 'blog-medium', $blog_medium[0], $blog_medium[1], true ); } if ( $blog_grid ) { $blog_grid = explode( ',', $blog_grid ); $blog_grid = array_map( 'absint', $blog_grid ); add_image_size( 'blog-grid', $blog_grid[0], $blog_grid[1], true ); } // This theme uses wp_nav_menu() in one location. register_nav_menus( [ 'primary' => __( 'Primary Menu', 'ayyash' ), 'mobile' => __( 'Mobile Menu ( Select when mobile menu is different )', 'ayyash' ), ] ); /** * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', [ 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script', 'navigation-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( './assets/dist/css/style-editor.css' ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'themeoo_custom_background_args', [ 'default-color' => 'ffffff', 'default-image' => '', ] ) ); add_theme_support( 'custom-logo', [ 'height' => 100, 'width' => 400, 'flex-height' => true, 'flex-width' => true, 'header-text' => [ 'site-title', 'site-description' ], 'unlink-homepage-logo' => true, ] ); // Set up the WordPress core custom header feature. add_theme_support( 'custom-header', [ 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', ] ); // Add starter content if ( is_customize_preview() ) { /** * @see WP_Customize_Manager::setup_theme() * \--@see WP_Customize_Manager::import_theme_starter_content() * \--\--@see get_theme_starter_content() * @uses site-option:fresh_site */ require THEMEOO_THEME_DIR . 'inc/starter-content.php'; add_theme_support( 'starter-content', themeoo_get_starter_content() ); } // Add support for responsive embedded content. add_theme_support( 'responsive-embeds' ); // Add support for custom line height controls. add_theme_support( 'custom-line-height' ); // Add support for experimental link color control. add_theme_support( 'experimental-link-color' ); // Add support for experimental cover block spacing. add_theme_support( 'custom-spacing' ); } } if ( ! function_exists( 'wp_body_open' ) ) { /** * Fire the wp_body_open action. * Back compact. for 5.0.0 * * @return void */ function wp_body_open() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound,WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedFunctionFound do_action( 'wp_body_open' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound,WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedHooknameFound } } add_action( 'after_setup_theme', 'themeoo_setup' ); if ( ! function_exists( 'themeoo_extensions_flying_cart' ) ) { /** * /** * Enable Flying cart from theme. * * @return bool */ function themeoo_extensions_flying_cart() { return (bool) themeoo_get_mod( 'woocommerce_general_enable_product_flying_cart' ); } } add_filter( 'themeoo_extensions_flying_cart', 'themeoo_extensions_flying_cart' ); if ( ! function_exists( 'themeoo_enqueue_comments_reply' ) ) { /** * Enqueue Comments Reply into footer (comment-reply.js) * * @return void */ function themeoo_enqueue_comments_reply() { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply', 'wp-includes/js/comment-reply', [], '1.0.0', true ); } } } add_action( 'comment_form_before', 'themeoo_enqueue_comments_reply' ); if ( ! function_exists( 'themeoo_variation_radio_buttons' ) ) { /** * Product Attribute Radio buttons * * @param string $html Data. * @param array $args Arguments. * * @return string */ function themeoo_variation_radio_buttons( $html, $args ) { $args = wp_parse_args( apply_filters( 'woocommerce_dropdown_variation_attribute_options_args', $args ), [ 'options' => false, 'attribute' => false, 'product' => false, 'selected' => false, 'name' => '', 'id' => '', 'class' => '', 'show_option_none' => __( 'Choose an option', 'ayyash' ), ] ); /** * @var WC_Product_Variable $product */ $product = $args['product']; $options = $args['options']; $attribute = $args['attribute']; $name = ! $args['name'] ? 'attribute_' . sanitize_title( $attribute ) : $args['name']; if ( false === $args['selected'] && $args['attribute'] && $args['product'] instanceof WC_Product ) { $selected_key = 'attribute_' . sanitize_title( $args['attribute'] ); $selected = isset( $_REQUEST[ $selected_key ] ) ? wc_clean( wp_unslash( $_REQUEST[ $selected_key ] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $args['selected'] = ! $selected ? $product->get_variation_default_attribute( $args['attribute'] ) : $selected; } if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute ) ) { $attributes = $product->get_variation_attributes(); $options = $attributes[ $attribute ]; } $radios = '
' . esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) ) . '
'; } else { $output = esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) ); } $radios .= 'slug, false ) . '>'; } } } else { foreach ( $options as $option ) { $id = $name . '-' . $option; $term = get_term_by( 'slug', $option, 'pa_color' ); if ( $term && 'attribute_pa_color' === $name ) { $themeoo_select_color = get_term_meta( $term->term_id, 'color', true ); // @phpstan-ignore-line // Swatch. $output = '' . esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) ) . '
'; // @phpstan-ignore-line } else { $output = esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) ); } $checked = sanitize_title( $args['selected'] ) === $args['selected'] ? checked( $args['selected'], sanitize_title( $option ), false ) : checked( $args['selected'], $option, false ); $radios .= ''; } } } $radios .= '