enqueue_styles(true); }); add_filter('body_class', array($this, 'add_body_class')); add_filter('style_loader_src', array($this, 'veto_card_skin'), 999, 2); } public function veto_card_skin($src, $handle) { if ('aieo-recommendations' !== $handle) { return $src; } return ('aieo' === self::design_source()) ? $src : false; } public static function design_source() { static $v = null; if (null !== $v) { return $v; } $s = get_option(self::OPTION_KEY, array()); $v = (is_array($s) && isset($s['design_source'])) ? (string) $s['design_source'] : self::default_design_source(); if (!in_array($v, array('aieo', 'neutral', 'theme'), true)) { $v = self::default_design_source(); } return $v; } public static function default_design_source() { return 'theme'; } public static function display_flag($key) { static $cache = null; if (null === $cache) { $s = get_option(self::OPTION_KEY, array()); if (!is_array($s)) { $s = array(); } $cache = array( 'desc_show' => array_key_exists('desc_show', $s) ? !empty($s['desc_show']) : false, 'rating_show' => array_key_exists('rating_show', $s) ? !empty($s['rating_show']) : true, ); } return isset($cache[$key]) ? $cache[$key] : false; } public static function flex_align($align) { switch (strtolower(trim((string) $align))) { case 'left': return 'flex-start'; case 'right': return 'flex-end'; default: return 'center'; } } public function enqueue_admin_assets() { wp_enqueue_style('wp-color-picker'); wp_enqueue_script('wp-color-picker'); wp_add_inline_script('wp-color-picker', 'jQuery(function($){$(".aieo-color").wpColorPicker();});' ); } public function is_active() { return true; } public function add_body_class($classes) { $ds = self::design_source(); if ('aieo' !== $ds) { $classes[] = 'aieo-cards-theme'; } $classes[] = 'aieo-cards-src--' . $ds; return $classes; } public function get_settings() { $stored = get_option(self::OPTION_KEY, array()); if (!is_array($stored)) { $stored = array(); } return array_merge(array( 'design_source' => self::default_design_source(), 'card_border' => '1px solid #1a1a1a', 'card_bg' => '#ffffff', 'img_bg' => '#ffffff', 'card_width' => '284px', 'card_height' => '455px', 'card_width_m' => '44vw', 'card_ratio_m' => '284 / 455', 'text_align' => 'center', 'card_gap' => '16px', 'card_padding' => '14px', 'title_color' => '#c82d52', 'title_ff' => '', 'title_fs' => '1rem', 'title_fs_mobile' => '0.9375rem', 'price_color' => '#1a1a1a', 'price_fs' => '1rem', 'price_fs_mobile' => '0.9375rem', 'price_muted' => '#9a9a9a', 'img_pad' => '0', 'img_pad_m' => '0', 'title_pad' => '0', 'title_pad_m' => '0', 'price_pad' => '0', 'price_pad_m' => '0', 'desc_show' => false, 'desc_color' => '#6b7280', 'desc_fs' => '0.85rem', 'desc_fs_m' => '0.8rem', 'desc_pad' => '0', 'desc_pad_m' => '0', 'rating_show' => true, 'scroll_thumb_color' => '#c82d52', 'scroll_thumb_radius' => '99px', 'scroll_line_color' => '#1a1a1a', ), $stored); } private function valid_size($v, $def) { $v = trim((string) $v); if ($v === '') { return $def; } if (is_numeric($v)) { return $v . 'px'; } return preg_match('/^[0-9]*\.?[0-9]+\s*(rem|em|px|%|vw|vh|pt)$/i', $v) ? $v : $def; } private function valid_color($v, $def) { $v = trim((string) $v); if ($v === '') { return $def; } if (0 === strcasecmp($v, 'currentColor')) { return 'currentColor'; } if (class_exists('AIEO_Admin_Color')) { $c = AIEO_Admin_Color::sanitize($v); return $c !== '' ? $c : $def; } $c = sanitize_hex_color($v); return $c ? $c : $def; } public function ajax_save() { AIEO_DMM::verify_ajax_request(); $d = $this->get_settings(); $ds = isset($_POST['design_source']) ? sanitize_text_field(wp_unslash((string) $_POST['design_source'])) : self::default_design_source(); $d['design_source'] = in_array($ds, array('aieo', 'neutral', 'theme'), true) ? $ds : self::default_design_source(); if (isset($_POST['card_border'])) { $b = trim(sanitize_text_field(wp_unslash((string) $_POST['card_border']))); $d['card_border'] = ($b !== '' && strlen($b) <= 80) ? $b : $d['card_border']; } unset($d['card_radius']); $d['card_width'] = $this->valid_size($_POST['card_width'] ?? '', $d['card_width']); $d['card_width_m'] = $this->valid_size($_POST['card_width_m'] ?? '', $d['card_width_m']); if (isset($_POST['card_ratio_m'])) { $aieo_r = trim(sanitize_text_field(wp_unslash((string) $_POST['card_ratio_m']))); if (preg_match('#^[0-9]+(?:\.[0-9]+)?\s*/\s*[0-9]+(?:\.[0-9]+)?$#', $aieo_r)) { $d['card_ratio_m'] = $aieo_r; } } $aieo_ta = isset($_POST['text_align']) ? sanitize_key(wp_unslash((string) $_POST['text_align'])) : 'center'; $d['text_align'] = in_array($aieo_ta, array('center', 'left'), true) ? $aieo_ta : 'center'; $d['card_height'] = $this->valid_size($_POST['card_height'] ?? '', $d['card_height']); $d['card_gap'] = $this->valid_size($_POST['card_gap'] ?? '', $d['card_gap']); $d['card_padding'] = $this->valid_size($_POST['card_padding'] ?? '', $d['card_padding']); $d['title_fs'] = $this->valid_size($_POST['title_fs'] ?? '', $d['title_fs']); $d['title_fs_mobile'] = $this->valid_size($_POST['title_fs_mobile'] ?? '', $d['title_fs_mobile']); $d['price_fs'] = $this->valid_size($_POST['price_fs'] ?? '', $d['price_fs']); $d['price_fs_mobile'] = $this->valid_size($_POST['price_fs_mobile'] ?? '', $d['price_fs_mobile']); $d['card_bg'] = $this->valid_color($_POST['card_bg'] ?? '', $d['card_bg']); $d['img_bg'] = $this->valid_color($_POST['img_bg'] ?? '', $d['img_bg']); $d['title_color'] = $this->valid_color($_POST['title_color'] ?? '', $d['title_color']); $d['price_color'] = $this->valid_color($_POST['price_color'] ?? '', $d['price_color']); $d['price_muted'] = $this->valid_color($_POST['price_muted'] ?? '', $d['price_muted']); foreach (array('img_pad','img_pad_m','title_pad','title_pad_m','price_pad','price_pad_m','desc_pad','desc_pad_m') as $pk) { if (isset($_POST[$pk])) { $pv = trim(sanitize_text_field(wp_unslash((string) $_POST[$pk]))); $d[$pk] = (strlen($pv) <= 40) ? ($pv === '' ? '0' : $pv) : $d[$pk]; } } $d['desc_fs'] = $this->valid_size($_POST['desc_fs'] ?? '', $d['desc_fs']); $d['desc_fs_m'] = $this->valid_size($_POST['desc_fs_m'] ?? '', $d['desc_fs_m']); $d['desc_color'] = $this->valid_color($_POST['desc_color'] ?? '', $d['desc_color']); $d['desc_show'] = !empty($_POST['desc_show']); $d['rating_show'] = !empty($_POST['rating_show']); $d['scroll_thumb_color'] = $this->valid_color($_POST['scroll_thumb_color'] ?? '', $d['scroll_thumb_color']); $d['scroll_thumb_radius'] = $this->valid_size($_POST['scroll_thumb_radius'] ?? '', $d['scroll_thumb_radius']); $d['scroll_line_color'] = $this->valid_color($_POST['scroll_line_color'] ?? '', $d['scroll_line_color']); if (isset($_POST['title_ff'])) { $ff = trim(sanitize_text_field(wp_unslash((string) $_POST['title_ff']))); $ff = str_replace(array('{', '}', ';', '<', '>'), '', $ff); $d['title_ff'] = (strlen($ff) <= 120) ? $ff : $d['title_ff']; } update_option(self::OPTION_KEY, $d, false); wp_send_json_success(array('message' => __('Product Card settings saved.', 'ai-eshop-optimizer'))); } public function enqueue_styles($force = false) { static $done = false; if ($done || is_admin()) { return; } if (!$force) { $wants = function_exists('is_woocommerce') && (is_woocommerce() || is_cart() || is_checkout()); if (!$wants) { $post = get_post(); $wants = $post instanceof WP_Post && (has_block('aieo/recos', $post) || has_block('aieo/product-slider', $post) || has_block('aieo/semantic-related', $post) || has_block('aieo/brand-rails', $post) || (class_exists('\Rooster\Blocks\Elementor\Factory') && \Rooster\Blocks\Elementor\Factory::post_has($post, array('aieo/product-slider', 'aieo/semantic-related', 'aieo/brand-rails')))); } if (!$wants && class_exists('AIEO_DMM_Settings') && method_exists('AIEO_DMM_Settings', 'is_module_enabled') && AIEO_DMM_Settings::is_module_enabled('side_cart')) { $wants = true; } if (!$wants) { return; } } $done = true; if (class_exists('AIEO_Ratings') && method_exists('AIEO_Ratings', 'instance')) { AIEO_Ratings::instance()->enqueue_assets(true); } if (class_exists('AIEO_Wishlist') && method_exists('AIEO_Wishlist', 'instance')) { AIEO_Wishlist::instance()->enqueue_assets(true); } if (is_admin()) { return; } $ds = self::design_source(); $s = $this->get_settings(); if ('aieo' !== $ds) { $floor = '.aieo-recommendations-grid{display:grid;' . 'grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:16px}' . '.aieo-card{display:flex;flex-direction:column;text-decoration:none;' . 'text-align:' . esc_attr($s['text_align']) . '}' . '.aieo-card-img-wrap{position:relative;display:block;' . 'aspect-ratio:' . esc_attr($s['card_ratio_m']) . '}' . '.aieo-card-img-wrap img{display:block;width:100%;height:100%;' . 'object-fit:contain}' . '.aieo-card-name{display:-webkit-box;-webkit-line-clamp:2;' . '-webkit-box-orient:vertical;overflow:hidden}' . '.aieo-card-price ins{text-decoration:none}' . '.aieo-card.is-out-of-stock{opacity:.55}' . '.aieo-card-rating{--aieo-rating-size:14px;' . '--aieo-rating-cap-fs-arch:10px}'; wp_register_style('aieo-reco-floor', false, array(), AIEO_VERSION); wp_enqueue_style('aieo-reco-floor'); wp_add_inline_style('aieo-reco-floor', $floor); return; } $css = ':root .aieo-recommendations{' . '--aieo-reco-card-border:' . esc_attr($s['card_border']) . ';' . '--aieo-reco-card-bg:' . esc_attr($s['card_bg']) . ';' . '--aieo-reco-img-bg:' . esc_attr($s['img_bg']) . ';' . '--aieo-reco-card-w:' . esc_attr($s['card_width']) . ';' . '--aieo-reco-card-w-m:' . esc_attr($s['card_width_m']) . ';' . '--aieo-reco-card-ar-m:' . esc_attr($s['card_ratio_m']) . ';' . '--aieo-reco-text-align:' . esc_attr($s['text_align']) . ';' . '--aieo-reco-flex-align:' . self::flex_align($s['text_align']) . ';' . '--aieo-reco-card-h:' . esc_attr($s['card_height']) . ';' . '--aieo-reco-card-gap:' . esc_attr($s['card_gap']) . ';' . '--aieo-reco-card-pad:' . esc_attr($s['card_padding']). ';' . '--aieo-reco-title-color:' . esc_attr($s['title_color']) . ';' . '--aieo-reco-title-fs:' . esc_attr($s['title_fs']) . ';' . '--aieo-reco-title-fs-m:' . esc_attr($s['title_fs_mobile']) . ';' . '--aieo-reco-price-color:' . esc_attr($s['price_color']) . ';' . '--aieo-reco-price-fs:' . esc_attr($s['price_fs']) . ';' . '--aieo-reco-price-fs-m:' . esc_attr($s['price_fs_mobile']) . ';' . '--aieo-reco-muted:' . esc_attr($s['price_muted']) . ';' . '--aieo-reco-img-pad:' . esc_attr($s['img_pad']) . ';' . '--aieo-reco-img-pad-m:' . esc_attr($s['img_pad_m']) . ';' . '--aieo-reco-title-pad:' . esc_attr($s['title_pad']) . ';' . '--aieo-reco-title-pad-m:' . esc_attr($s['title_pad_m']) . ';' . '--aieo-reco-price-pad:' . esc_attr($s['price_pad']) . ';' . '--aieo-reco-price-pad-m:' . esc_attr($s['price_pad_m']) . ';' . '--aieo-reco-desc-color:' . esc_attr($s['desc_color']) . ';' . '--aieo-reco-desc-fs:' . esc_attr($s['desc_fs']) . ';' . '--aieo-reco-desc-fs-m:' . esc_attr($s['desc_fs_m']) . ';' . '--aieo-reco-desc-pad:' . esc_attr($s['desc_pad']) . ';' . '--aieo-reco-desc-pad-m:' . esc_attr($s['desc_pad_m']) . ';' . '--aieo-reco-scroll-thumb:' . esc_attr($s['scroll_thumb_color']) . ';' . '--aieo-reco-scroll-thumb-radius:' . esc_attr($s['scroll_thumb_radius']) . ';' . '--aieo-reco-scroll-line:' . esc_attr($s['scroll_line_color']) . ';' . '}'; $css .= ':root{' . '--aieo-reco-scroll-thumb:' . esc_attr($s['scroll_thumb_color']) . ';' . '--aieo-reco-scroll-thumb-radius:' . esc_attr($s['scroll_thumb_radius']) . ';' . '--aieo-reco-scroll-line:' . esc_attr($s['scroll_line_color']) . ';' . '}'; if (trim((string) $s['title_ff']) !== '') { $css .= ':root .aieo-recommendations .aieo-recommendations-grid .aieo-card-name{font-family:' . $s['title_ff'] . ' !important;}'; } wp_register_style('aieo-dmm-product-card', false, array(), defined('AIEO_VERSION') ? AIEO_VERSION : '1.0'); wp_enqueue_style('aieo-dmm-product-card'); wp_add_inline_style('aieo-dmm-product-card', $css); } public function render_subtab() { $s = $this->get_settings(); $id_of = static function ( $name ) { return 'aieo-pc-' . str_replace( '_', '-', $name ); }; $text = static function ( $name, $placeholder, $size = 'short', $extra = array() ) use ( $s, $id_of ) { return \Rooster\Admin\Ui::input( $name, (string) $s[ $name ], array( 'id' => $id_of( $name ), $size => true, 'placeholder' => $placeholder ) + $extra ); }; $colour = static function ( $name, $placeholder ) use ( $s, $id_of ) { return \Rooster\Admin\Fields::color( $name, (string) $s[ $name ], array( 'id' => $id_of( $name ), 'alpha' => true, 'placeholder' => (string) $placeholder ) ); }; $row = static function ( $name, $label, $control, $help = '' ) use ( $id_of ) { $field = array( 'id' => $id_of( $name ), 'label' => $label, 'control' => $control ); if ( '' !== $help ) { $field['help'] = $help; } return \Rooster\Admin\Ui::field_row( $field ); }; $pair = static function ( $name, $label, $desktop, $mobile, $ph_d, $ph_m ) use ( $s, $id_of ) { $parts = array(); foreach ( array( array( __( 'Desktop', 'ai-eshop-optimizer' ), $desktop, $ph_d ), array( __( 'Mobile', 'ai-eshop-optimizer' ), $mobile, $ph_m ) ) as $p ) { $parts[] = array( 'label' => $p[0], 'id' => $id_of( $p[1] ), 'control' => \Rooster\Admin\Ui::input( $p[1], (string) $s[ $p[1] ], array( 'id' => $id_of( $p[1] ), 'short' => true, 'placeholder' => $p[2] ) ), ); } return \Rooster\Admin\Ui::field_row( array( 'id' => $id_of( $name ) . '-row', 'label' => $label, 'parts' => $parts ) ); }; $switch = static function ( $name, $text ) use ( $s, $id_of ) { return \Rooster\Admin\Ui::toggle( $name, ! empty( $s[ $name ] ), array( 'id' => $id_of( $name ), 'hidden' => false, 'label' => $text ) ); }; $card = static function ( $anchor, $icon, $title, $col, $fields, $extra = array() ) { $form_id = 'aieo-card-' . $anchor . '-form'; list( $open, $close ) = AIEO_DMM_UI::card( array( 'anchor' => $anchor, 'icon' => $icon, 'title' => $title, 'col' => $col, 'footer' => class_exists( '\Rooster\Admin\States' ) ? \Rooster\Admin\States::save_button( $form_id ) : '', ) + $extra ); echo $open; echo AIEO_DMM_UI::card_form( 'aieo_dmm_product_card_save', 'product_card', $form_id, '
' . $fields . '
' ); echo $close; }; rooster_admin_band_open( array( 'cols' => 2 ) ); $aieo_ds = AIEO_DMM_Product_Card::design_source(); $aieo_tn_ok = class_exists( 'AIEO_Theme_Native_Recos' ) && AIEO_Theme_Native_Recos::supported(); $source = ''; if ( ! $aieo_tn_ok ) { $source .= \Rooster\Admin\Ui::notice( esc_html( class_exists( 'AIEO_Theme_Native_Recos' ) ? AIEO_Theme_Native_Recos::unsupported_reason() : __( 'Theme design is unavailable on this install.', 'ai-eshop-optimizer' ) ), 'warning', array( 'inline' => true ) ); } $fields = \Rooster\Admin\Ui::field_row( array( 'id' => $id_of( 'design_source' ), 'label' => __( 'Card design source', 'ai-eshop-optimizer' ), 'control' => $source, 'help' => __( 'Theme design hands your precomputed recommendations to the theme\'s own related-products block, so the cards are drawn by the theme — its markup, its CSS, its carousel. Nothing of ours is forced on them. Use it when the theme has a card design you want to keep. If the theme does not render a related-products block, this mode shows nothing on the product page.', 'ai-eshop-optimizer' ), ) ); $aieo_pc_aieo = \Rooster\Admin\Guidance::text( __( '“Rooster One design” applies everything below, on every theme.', 'ai-eshop-optimizer' ), 'guidance', array( 'question' => __( 'What does Rooster One design do?', 'ai-eshop-optimizer' ) ) ); $aieo_pc_neutral = \Rooster\Admin\Guidance::text( __( '“Neutral” ships no card stylesheet at all — only the layout grid, which your theme cannot supply because it does not know these cards exist. Every setting below then has no effect. Be aware of what this does and does not do: it stops us imposing a design, but it cannot make your theme style these cards. Many themes (Rey among them) load their product-card CSS only on shop and category pages, not on product pages, so on a product page there may be nothing to inherit and the cards will look plain. Check a product page after switching.', 'ai-eshop-optimizer' ), 'guidance', array( 'question' => __( 'What does Neutral do?', 'ai-eshop-optimizer' ) ) ); $fields .= $aieo_pc_aieo . $aieo_pc_neutral; $card( 'product-card-overview', 'sparkles', __( 'Card design', 'ai-eshop-optimizer' ), 1, $fields, array( 'description' => __( 'Appearance of the Rooster One recommendation/carousel product cards — owned by the plugin so the same design renders on ANY theme (it no longer depends on roosterx-ff). Set the card border, the title font size (desktop + mobile) + colour, and the price font size (desktop + mobile) + colour. Variable-product price ranges render on one line; sales stack the regular price over the sale price.', 'ai-eshop-optimizer' ) ) ); $fields = $row( 'card_border', __( 'Border', 'ai-eshop-optimizer' ), $text( 'card_border', '1px solid #1a1a1a', 'medium' ), __( 'CSS border shorthand, e.g. “1px solid #1a1a1a” or “none”.', 'ai-eshop-optimizer' ) ); $fields .= $row( 'card_bg', __( 'Background', 'ai-eshop-optimizer' ), $colour( 'card_bg', '#ffffff' ) ); $fields .= $row( 'img_bg', __( 'Image area background', 'ai-eshop-optimizer' ), $colour( 'img_bg', '#ffffff' ), __( 'Background behind the product image (was grey). Use “transparent” to match the card.', 'ai-eshop-optimizer' ) ); $card( 'product-card-card-frame', 'square', __( 'Card frame', 'ai-eshop-optimizer' ), 2, $fields, array( 'description' => __( 'Set the border and background colours of the product cards in your recommendation carousels; their corners are the theme\'s.', 'ai-eshop-optimizer' ) ) ); $fields = $row( 'card_width', __( 'Card width (desktop)', 'ai-eshop-optimizer' ), $text( 'card_width', '284px' ), __( 'Lower it for thinner cards, e.g. 250px.', 'ai-eshop-optimizer' ) ); $fields .= $row( 'card_height', __( 'Card height (desktop)', 'ai-eshop-optimizer' ), $text( 'card_height', '455px' ) ); $fields .= $row( 'card_width_m', __( 'Card width (mobile)', 'ai-eshop-optimizer' ), $text( 'card_width_m', '44vw' ), __( 'Below 768px the card is sized by width + ratio instead of width + height, so two cards and a peek of the third fit the screen. 44vw is the default; raise it for fewer, wider cards.', 'ai-eshop-optimizer' ) ); $fields .= $row( 'card_ratio_m', __( 'Card ratio (mobile)', 'ai-eshop-optimizer' ), $text( 'card_ratio_m', '284 / 455' ), __( 'Width / height, e.g. 284 / 455 (tall) or 1 / 1 (square). Digits and one slash only.', 'ai-eshop-optimizer' ) ); $fields .= $row( 'text_align', __( 'Text alignment', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::select( 'text_align', array( 'center' => __( 'Centred', 'ai-eshop-optimizer' ), 'left' => __( 'Left', 'ai-eshop-optimizer' ) ), (string) $s['text_align'], array( 'id' => $id_of( 'text_align' ), 'short' => true ) ), __( 'Applies to the title, price and description. Centred is the Rooster One default; most third-party themes left-align their product cards, so pick Left if you want these to sit closer to the rest of your shop.', 'ai-eshop-optimizer' ) ); $fields .= $row( 'card_gap', __( 'Gap between cards', 'ai-eshop-optimizer' ), $text( 'card_gap', '16px' ) ); $fields .= $row( 'card_padding', __( 'Inner padding', 'ai-eshop-optimizer' ), $text( 'card_padding', '14px' ) ); $card( 'product-card-sizing-and-spacing', 'ruler', __( 'Sizing and spacing', 'ai-eshop-optimizer' ), 1, $fields, array( 'description' => __( 'Choose how wide and tall the cards are on desktop and mobile, the gap between them and how their text aligns.', 'ai-eshop-optimizer' ) ) ); $fields = $pair( 'title_fs', __( 'Title — font size', 'ai-eshop-optimizer' ), 'title_fs', 'title_fs_mobile', '1.375rem', '1.125rem' ); $fields .= $row( 'title_color', __( 'Title — colour', 'ai-eshop-optimizer' ), $colour( 'title_color', '#c82d52' ) ); $fields .= $row( 'title_ff', __( 'Title — font family', 'ai-eshop-optimizer' ), $text( 'title_ff', 'inherit (theme default)', 'medium' ), __( 'CSS font-family, e.g. “Poppins, sans-serif”. Leave blank to use the theme font.', 'ai-eshop-optimizer' ) ); $card( 'product-card-title', 'file-text', __( 'Title', 'ai-eshop-optimizer' ), 2, $fields, array( 'description' => __( 'Set the font, size and colour of the product name printed on each recommendation card.', 'ai-eshop-optimizer' ) ) ); $fields = $pair( 'price_fs', __( 'Price — font size', 'ai-eshop-optimizer' ), 'price_fs', 'price_fs_mobile', '1.25rem', '1.05rem' ); $fields .= $row( 'price_color', __( 'Price — colour', 'ai-eshop-optimizer' ), $colour( 'price_color', '#1a1a1a' ) ); $fields .= $row( 'price_muted', __( 'Was-price (strike) colour', 'ai-eshop-optimizer' ), $colour( 'price_muted', '#9a9a9a' ) ); $card( 'product-card-price', 'banknote', __( 'Price', 'ai-eshop-optimizer' ), 1, $fields, array( 'description' => __( 'Set the size and colour of the price on each card, and the colour of the crossed-out regular price on sale items.', 'ai-eshop-optimizer' ) ) ); $fields = $pair( 'img_pad', __( 'Image', 'ai-eshop-optimizer' ), 'img_pad', 'img_pad_m', '0', '0' ); $fields .= $pair( 'title_pad', __( 'Title', 'ai-eshop-optimizer' ), 'title_pad', 'title_pad_m', '0', '0' ); $fields .= $pair( 'price_pad', __( 'Price', 'ai-eshop-optimizer' ), 'price_pad', 'price_pad_m', '0', '0' ); $card( 'product-card-element-padding', 'rows-3', __( 'Element padding', 'ai-eshop-optimizer' ), 2, $fields, array( 'description' => __( 'CSS padding, e.g. “8px” or “8px 0”.', 'ai-eshop-optimizer' ) ) ); $fields = $row( 'desc_show', __( 'Show short description', 'ai-eshop-optimizer' ), $switch( 'desc_show', __( 'Display the product short description under the title (clamped to 2 lines)', 'ai-eshop-optimizer' ) ) ); $fields .= $row( 'desc_color', __( 'Description — colour', 'ai-eshop-optimizer' ), $colour( 'desc_color', '#6b7280' ) ); $fields .= $pair( 'desc_fs', __( 'Description — font size', 'ai-eshop-optimizer' ), 'desc_fs', 'desc_fs_m', '0.85rem', '0.8rem' ); $fields .= $pair( 'desc_pad', __( 'Description — padding (Desktop / Mobile)', 'ai-eshop-optimizer' ), 'desc_pad', 'desc_pad_m', '0', '0' ); $card( 'product-card-short-description', 'scroll-text', __( 'Short description', 'ai-eshop-optimizer' ), 1, $fields, array( 'description' => __( 'Choose whether two lines of the product\'s short description appear under its name on each card, and how they look.', 'ai-eshop-optimizer' ) ) ); $fields = $row( 'rating_show', __( 'Show ratings under price', 'ai-eshop-optimizer' ), $switch( 'rating_show', __( 'Display the read-only star rating under the price', 'ai-eshop-optimizer' ) ) ); $card( 'product-card-ratings', 'star', __( 'Ratings', 'ai-eshop-optimizer' ), 2, $fields, array( 'description' => __( 'Choose whether the product\'s star rating appears under the price on each recommendation card.', 'ai-eshop-optimizer' ) ) ); $fields = $row( 'scroll_thumb_color', __( 'Scroll thumb colour', 'ai-eshop-optimizer' ), $colour( 'scroll_thumb_color', '#c82d52' ), __( 'Colour of the moving progress thumb under the mobile carousel.', 'ai-eshop-optimizer' ) ); $fields .= $row( 'scroll_thumb_radius', __( 'Scroll thumb corner radius', 'ai-eshop-optimizer' ), $text( 'scroll_thumb_radius', '99px' ), __( '99px is a pill. Use 0 for a square bar to match a squared-off theme.', 'ai-eshop-optimizer' ) ); $fields .= $row( 'scroll_line_color', __( 'Track line colour', 'ai-eshop-optimizer' ), $colour( 'scroll_line_color', '#1a1a1a' ), __( 'Colour of the thin line under the thumb.', 'ai-eshop-optimizer' ) ); $card( 'product-card-carousel-scroll-bar', 'sliders-horizontal', __( 'Carousel scroll bar (mobile)', 'ai-eshop-optimizer' ), 2, $fields, array( 'description' => __( 'Set the colours and corner shape of the progress bar that shows shoppers how far they have scrolled a carousel on a phone.', 'ai-eshop-optimizer' ) ) ); rooster_admin_band_close(); } }