'store-pages-store-pages-plugin-store-cpt', 'icon' => 'link', 'title' => __('Store URL base and labels', 'ai-eshop-optimizer'), 'description' => __('Optional: a block-based page per shop, each bound to a location. A store page becomes that shop\'s canonical URL + LocalBusiness landing page. You choose the URL base and label — nothing is hardcoded. This governs the plugin store CPT; your theme store pages are listed below regardless.', 'ai-eshop-optimizer'), 'footer' => class_exists('\Rooster\Admin\States') ? \Rooster\Admin\States::save_button($aieo_sp_form) : '', )); echo $aieo_sp_open; $aieo_sp_fields = '
' . \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-store-cpt-enabled', 'label' => __('Store pages', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::toggle('store_cpt_enabled', !empty($seo['store_cpt_enabled']), array('id' => 'aieo-store-cpt-enabled', 'hidden' => false, 'label' => __('Enable store pages', 'ai-eshop-optimizer'))), )) . \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-store-cpt-base', 'label' => __('URL base', 'ai-eshop-optimizer'), 'control' => '' . esc_html(trailingslashit(home_url())) . '' . \Rooster\Admin\Ui::input('store_cpt_base', (string) ($seo['store_cpt_base'] ?? ''), array('id' => 'aieo-store-cpt-base', 'medium' => true, 'code' => true, 'placeholder' => 'stores')) . '/<slug>/', 'help' => __('The URL segment for store pages, for example stores, shops, branches or locations. Letters, numbers and dashes only, and it is yours to translate.', 'ai-eshop-optimizer'), )) . \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-store-cpt-singular', 'label' => __('Label (singular)', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::input('store_cpt_singular', (string) ($seo['store_cpt_singular'] ?? ''), array('id' => 'aieo-store-cpt-singular', 'medium' => true, 'placeholder' => __('Store', 'ai-eshop-optimizer'))), )) . \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-store-cpt-plural', 'label' => __('Label (plural)', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::input('store_cpt_plural', (string) ($seo['store_cpt_plural'] ?? ''), array('id' => 'aieo-store-cpt-plural', 'medium' => true, 'placeholder' => __('Stores', 'ai-eshop-optimizer'))), )) . '
'; echo AIEO_DMM_UI::card_form('aieo_store_config_save', 'store_pages', $aieo_sp_form, $aieo_sp_fields, array('nonce' => wp_create_nonce(AIEO_DMM_Store::NONCE), 'nonce_name' => 'nonce')); echo \Rooster\Admin\Guidance::text(__('After enabling + saving, the plugin store CPT becomes available. Create one page per shop, bind it to its location, and publish — the LocalBusiness URL + locations sitemap follow automatically.', 'ai-eshop-optimizer'), 'guidance', array('about' => __('Store URL base and labels', 'ai-eshop-optimizer'))); ?> post_type; })); if ($aieo_shops) : $aieo_shop_ids = array_map(static function ($s) { return (int) $s->ID; }, $aieo_shops); $aieo_shop = isset($_GET['aieo_shop']) ? absint($_GET['aieo_shop']) : 0; $aieo_shop = in_array($aieo_shop, $aieo_shop_ids, true) ? $aieo_shop : $aieo_shop_ids[0]; $aieo_way = AIEO_Store_Page::way($aieo_shop); $aieo_nonce = wp_create_nonce(AIEO_DMM_Store::NONCE); $aieo_hidden = static function ($part) use ($aieo_shop) { return array('store' => (string) $aieo_shop, 'part' => $part); }; $aieo_save = static function ($form) { return class_exists('\Rooster\Admin\States') ? \Rooster\Admin\States::save_button($form) : ''; }; $aieo_opts = array(); foreach ($aieo_shops as $s) { $aieo_opts[(string) $s->ID] = get_the_title($s) ?: __('(untitled)', 'ai-eshop-optimizer'); } $aieo_keep = ''; foreach (array('page', 'dmm_tab', 'tab', 'section') as $aieo_q) { if (isset($_GET[$aieo_q])) { $aieo_keep .= ''; } } list($aieo_o, $aieo_c) = AIEO_DMM_UI::card(array( 'anchor' => 'store-pages-shop-page', 'icon' => 'building-2', 'title' => __('A shop\'s page', 'ai-eshop-optimizer'), 'description' => __('What the shop\'s own page shows besides its address and hours. Choose the shop; the cards below are its.', 'ai-eshop-optimizer'), )); echo $aieo_o; echo '
' . $aieo_keep . \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-shop-pick', 'label' => __('Shop', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::select('aieo_shop', $aieo_opts, (string) $aieo_shop, array('id' => 'aieo-shop-pick', 'medium' => true)) . ' ' . \Rooster\Admin\Ui::button(__('Show', 'ai-eshop-optimizer'), array('variant' => 'outline', 'size' => 'sm', 'type' => 'submit')) . ' ' . esc_html__('View the page', 'ai-eshop-optimizer') . '', )) . '
'; echo $aieo_c; do_action('aieo_store_pages_shop_cards', $aieo_shop); $aieo_form = 'aieo-card-store-pages-shop-way-form'; list($aieo_o, $aieo_c) = AIEO_DMM_UI::card(array( 'anchor' => 'store-pages-shop-way', 'icon' => 'map-pin', 'title' => __('The way here', 'ai-eshop-optimizer'), 'description' => __('The way from the station to the door as steps, with the minutes between them, and the lines a visitor needs: access, collecting an order, deliveries. No map is loaded on the page.', 'ai-eshop-optimizer'), 'footer' => $aieo_save($aieo_form), )); echo $aieo_o; $aieo_rows = \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-way-title', 'label' => __('Heading', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::input('way_title', $aieo_way['title'], array('id' => 'aieo-way-title', 'medium' => true, 'placeholder' => __('Eight minutes from the station', 'ai-eshop-optimizer'))), 'help' => __('Left empty, the minutes of the steps and the first step\'s place make it: «8 minutes from Old Street station».', 'ai-eshop-optimizer'), )); $aieo_rows .= \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-way-steps', 'label' => __('Steps', 'ai-eshop-optimizer'), 'group' => true, 'wide' => true, 'control' => \Rooster\Admin\Fields::repeater('way_steps', $aieo_way['steps'], array( 'id' => 'aieo-way-steps', 'label' => __('The way here, step by step', 'ai-eshop-optimizer'), 'item' => _x('Step %d', 'a step of the way to the shop', 'ai-eshop-optimizer'), 'add' => __('Add a step', 'ai-eshop-optimizer'), 'empty' => __('No steps yet.', 'ai-eshop-optimizer'), 'max' => AIEO_Store_Page::WAY_MAX, 'noun' => array(_x('step', 'a step of the way to the shop, counted: «Up to 12 steps»', 'ai-eshop-optimizer'), _x('steps', 'steps of the way to the shop, counted: «Up to 12 steps»', 'ai-eshop-optimizer')), 'fields' => AIEO_Store_Page::way_step_fields(), )), )) . \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-way-lines', 'label' => __('Lines', 'ai-eshop-optimizer'), 'group' => true, 'wide' => true, 'control' => \Rooster\Admin\Fields::repeater('way_lines', $aieo_way['lines'], array( 'id' => 'aieo-way-lines', 'label' => __('The lines beside the way', 'ai-eshop-optimizer'), 'item' => __('Line %d', 'ai-eshop-optimizer'), 'add' => __('Add a line', 'ai-eshop-optimizer'), 'empty' => __('No lines yet.', 'ai-eshop-optimizer'), 'max' => AIEO_Store_Page::WAY_MAX, 'noun' => array(_x('line', 'a line beside the way to the shop, counted: «Up to 12 lines»', 'ai-eshop-optimizer'), _x('lines', 'lines beside the way to the shop, counted: «Up to 12 lines»', 'ai-eshop-optimizer')), 'fields' => AIEO_Store_Page::way_line_fields(), )), )); echo AIEO_DMM_UI::card_form('aieo_store_page_save', 'store_pages', $aieo_form, '
' . $aieo_rows . '
', array('nonce' => $aieo_nonce, 'nonce_name' => 'nonce', 'hidden' => $aieo_hidden('way'))); echo \Rooster\Admin\Guidance::text(__('The page shows the way only when it has a step; «How to get here» in the shop\'s head goes to it.', 'ai-eshop-optimizer'), 'guidance', array('about' => __('The way here', 'ai-eshop-optimizer'))); echo $aieo_c; endif; endif; ?> ID, '_aieo_grv_location_id', true); $aieo_sp_rows[] = array( 'id' => (int) $s->ID, 'title' => get_the_title($s) ?: __('(untitled)', 'ai-eshop-optimizer'), 'edit_url' => (string) get_edit_post_link($s->ID, 'raw'), 'view_url' => (string) get_permalink($s->ID), 'type' => ('aieo_store' === $s->post_type) ? __('Plugin', 'ai-eshop-optimizer') : __('Theme', 'ai-eshop-optimizer'), 'ptype' => '· ' . $s->post_type, 'location' => ($lid > 0 && isset($loc_map[$lid])) ? $loc_map[$lid] : ($lid > 0 ? '#' . $lid : ''), 'status' => get_post_status($s), ); } AIEO_Table::card(array( 'anchor' => 'store-pages-store-pages', 'heading' => 'h2', 'title' => __('Each page and its bound location', 'ai-eshop-optimizer'), 'description' => __('Lists every plugin and theme store page with the location it is bound to and its status, and links you straight to edit or view it.', 'ai-eshop-optimizer'), 'page_id' => 'store_pages', 'row_key' => 'id', 'rows' => $aieo_sp_rows, 'per_page' => 0, 'empty' => __('No store pages yet.', 'ai-eshop-optimizer'), 'columns' => array( array('key' => 'title', 'label' => __('Title', 'ai-eshop-optimizer'), 'type' => 'link', 'format' => array('href' => 'edit_url')), array('key' => 'type', 'label' => __('Type', 'ai-eshop-optimizer'), 'width' => '130px', 'suffix' => 'ptype'), array('key' => 'location', 'label' => __('Bound location', 'ai-eshop-optimizer')), array('key' => 'status', 'label' => __('Status', 'ai-eshop-optimizer'), 'type' => 'badge', 'width' => '90px'), ), 'actions' => array( array('id' => 'edit', 'label' => __('Edit', 'ai-eshop-optimizer'), 'href' => static function ($r) { return $r['edit_url']; }), array('id' => 'view', 'label' => __('View', 'ai-eshop-optimizer'), 'external' => true, 'href' => static function ($r) { return $r['view_url']; }), ), )); ?>