| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Recently Viewed Products Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
// Settings |
| 14 |
Merchant_Admin_Options::create( array( |
| 15 |
'title' => __( 'Settings', 'merchant' ), |
| 16 |
'module' => Merchant_Recently_Viewed_Products::MODULE_ID, |
| 17 |
'fields' => array( |
| 18 |
|
| 19 |
// Title. |
| 20 |
array( |
| 21 |
'id' => 'title', |
| 22 |
'type' => 'text', |
| 23 |
'title' => __( 'Title', 'merchant' ), |
| 24 |
'default' => __( 'Recently Viewed', 'merchant' ), |
| 25 |
), |
| 26 |
|
| 27 |
// Title HTML Tag. |
| 28 |
array( |
| 29 |
'id' => 'title_tag', |
| 30 |
'type' => 'select', |
| 31 |
'title' => __( 'Title HTML tag', 'merchant' ), |
| 32 |
'options' => array( |
| 33 |
'h1' => __( 'H1', 'merchant' ), |
| 34 |
'h2' => __( 'H2', 'merchant' ), |
| 35 |
'h3' => __( 'H3', 'merchant' ), |
| 36 |
'h4' => __( 'H4', 'merchant' ), |
| 37 |
'h5' => __( 'H5', 'merchant' ), |
| 38 |
'h6' => __( 'H6', 'merchant' ), |
| 39 |
'div' => __( 'div', 'merchant' ), |
| 40 |
), |
| 41 |
'default' => 'h2', |
| 42 |
), |
| 43 |
|
| 44 |
// Hide Title. |
| 45 |
array( |
| 46 |
'id' => 'hide_title', |
| 47 |
'type' => 'switcher', |
| 48 |
'title' => __( 'Hide title', 'merchant' ), |
| 49 |
'desc' => __( 'Hide the title visually only. The title will continue being rendered in the HTML source code.', 'merchant' ), |
| 50 |
'default' => 0, |
| 51 |
), |
| 52 |
|
| 53 |
// Slider Style. |
| 54 |
array( |
| 55 |
'id' => 'slider', |
| 56 |
'type' => 'switcher', |
| 57 |
'title' => __( 'Slider style', 'merchant' ), |
| 58 |
'desc' => __( 'Display the products grid as a slider.' , 'merchant' ), |
| 59 |
'default' => 0, |
| 60 |
), |
| 61 |
|
| 62 |
// Slider Navigation. |
| 63 |
array( |
| 64 |
'id' => 'slider_nav', |
| 65 |
'type' => 'radio', |
| 66 |
'title' => __( 'Slider navigation', 'merchant' ), |
| 67 |
'options' => array( |
| 68 |
'always-show' => __( 'Always Show', 'merchant' ), |
| 69 |
'on-hover' => __( 'Show On Hover', 'merchant' ), |
| 70 |
), |
| 71 |
'default' => 'on-hover', |
| 72 |
'condition' => array( 'slider', '==', '1' ), |
| 73 |
), |
| 74 |
|
| 75 |
// Number of Products. |
| 76 |
array( |
| 77 |
'id' => 'posts_per_page', |
| 78 |
'type' => 'range', |
| 79 |
'title' => __( 'Products', 'merchant' ), |
| 80 |
'desc' => __( 'Controls the number of products to display in the products grid.', 'merchant' ), |
| 81 |
'min' => 1, |
| 82 |
'max' => 30, |
| 83 |
'step' => 1, |
| 84 |
'unit' => '', |
| 85 |
'default' => 6, |
| 86 |
), |
| 87 |
|
| 88 |
// Number of Columns. |
| 89 |
array( |
| 90 |
'id' => 'columns', |
| 91 |
'type' => 'range', |
| 92 |
'title' => __( 'Columns', 'merchant' ), |
| 93 |
'desc' => __( 'Controls the number of columns to display in the products grid.', 'merchant' ), |
| 94 |
'min' => 1, |
| 95 |
'max' => 6, |
| 96 |
'step' => 1, |
| 97 |
'unit' => '', |
| 98 |
'default' => 3, |
| 99 |
), |
| 100 |
|
| 101 |
// Columns Gap. |
| 102 |
array( |
| 103 |
'id' => 'columns_gap', |
| 104 |
'type' => 'range', |
| 105 |
'title' => __( 'Columns gap', 'merchant' ), |
| 106 |
'desc' => __( 'Controls gap between each column in the products grid.', 'merchant' ), |
| 107 |
'min' => 0, |
| 108 |
'max' => 100, |
| 109 |
'step' => 1, |
| 110 |
'unit' => 'px', |
| 111 |
'default' => 15, |
| 112 |
), |
| 113 |
|
| 114 |
// Order by. |
| 115 |
array( |
| 116 |
'id' => 'orderby', |
| 117 |
'type' => 'select', |
| 118 |
'title' => __( 'Order by', 'merchant' ), |
| 119 |
'options' => array( |
| 120 |
'none' => __( 'Last viewed', 'merchant' ), |
| 121 |
'id' => __( 'ID', 'merchant' ), |
| 122 |
'rand' => __( 'Random', 'merchant' ), |
| 123 |
'title' => __( 'Title', 'merchant' ), |
| 124 |
'date' => __( 'Date', 'merchant' ), |
| 125 |
'modified' => __( 'Modified date', 'merchant' ), |
| 126 |
), |
| 127 |
'default' => 'none', |
| 128 |
), |
| 129 |
|
| 130 |
// Order. |
| 131 |
array( |
| 132 |
'id' => 'order', |
| 133 |
'type' => 'select', |
| 134 |
'title' => __( 'Order', 'merchant' ), |
| 135 |
'options' => array( |
| 136 |
'asc' => __( 'Asc', 'merchant' ), |
| 137 |
'desc' => __( 'Desc', 'merchant' ), |
| 138 |
), |
| 139 |
'default' => 'desc', |
| 140 |
'condition' => array( 'orderby', 'any', 'id|rand|title|date|modified' ), |
| 141 |
), |
| 142 |
|
| 143 |
// Hook Order. |
| 144 |
array( |
| 145 |
'id' => 'hook_order', |
| 146 |
'type' => 'range', |
| 147 |
'title' => __( 'Loading priority', 'merchant' ), |
| 148 |
'min' => 1, |
| 149 |
'max' => 100, |
| 150 |
'step' => 1, |
| 151 |
'unit' => '', |
| 152 |
'default' => 20, |
| 153 |
), |
| 154 |
array( |
| 155 |
'id' => 'hook_order_info', |
| 156 |
'type' => 'info', |
| 157 |
'content' => esc_html__( 'This is a developer level feature. The recently viewed product module is "hooked" into a specific location on the page. Themes and other plugins might also add additional elements to the same location. By modifying the hook priority, you have the ability to customize the placement of this element on that particular location. A lower number = a higher priority, so the module will appear higher on the page.', 'merchant' ), |
| 158 |
), |
| 159 |
|
| 160 |
// colors. |
| 161 |
|
| 162 |
// Title color. |
| 163 |
array( |
| 164 |
'id' => 'title_color', |
| 165 |
'type' => 'color', |
| 166 |
'title' => __( 'Title color', 'merchant' ), |
| 167 |
'default' => '#212121', |
| 168 |
), |
| 169 |
|
| 170 |
// Navigation Icon color. |
| 171 |
array( |
| 172 |
'id' => 'navigation_icon_color', |
| 173 |
'type' => 'color', |
| 174 |
'title' => __( 'Navigation icon color', 'merchant' ), |
| 175 |
'default' => '#FFF', |
| 176 |
'condition' => array( 'slider', '==', '1' ), |
| 177 |
), |
| 178 |
|
| 179 |
// Naviation color. |
| 180 |
array( |
| 181 |
'id' => 'navigation_color', |
| 182 |
'type' => 'color', |
| 183 |
'title' => __( 'Navigation color', 'merchant' ), |
| 184 |
'default' => '#212121', |
| 185 |
'condition' => array( 'slider', '==', '1' ), |
| 186 |
), |
| 187 |
|
| 188 |
// Naviation color (hover). |
| 189 |
array( |
| 190 |
'id' => 'navigation_color_hover', |
| 191 |
'type' => 'color', |
| 192 |
'title' => __( 'Navigation color (hover)', 'merchant' ), |
| 193 |
'default' => '#757575', |
| 194 |
'condition' => array( 'slider', '==', '1' ), |
| 195 |
), |
| 196 |
|
| 197 |
array( |
| 198 |
'id' => 'show_pages', |
| 199 |
'type' => 'checkbox_multiple', |
| 200 |
'title' => esc_html__( 'Show on pages', 'merchant' ), |
| 201 |
'options' => array( |
| 202 |
'product_single' => esc_html__( 'Product Single', 'merchant' ), |
| 203 |
'cart' => esc_html__( 'Cart', 'merchant' ), |
| 204 |
'checkout' => esc_html__( 'Checkout', 'merchant' ), |
| 205 |
), |
| 206 |
'default' => array( 'product_single' ), |
| 207 |
), |
| 208 |
), |
| 209 |
) ); |
| 210 |
|
| 211 |
// Shortcode |
| 212 |
$merchant_module_id = Merchant_Recently_Viewed_Products::MODULE_ID; |
| 213 |
Merchant_Admin_Options::create( array( |
| 214 |
'module' => $merchant_module_id, |
| 215 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 216 |
'fields' => array( |
| 217 |
array( |
| 218 |
'id' => 'use_shortcode', |
| 219 |
'type' => 'switcher', |
| 220 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 221 |
'default' => 0, |
| 222 |
), |
| 223 |
array( |
| 224 |
'type' => 'info', |
| 225 |
'id' => 'shortcode_info', |
| 226 |
'content' => esc_html__( 'If you are using a page builder or a theme that supports shortcodes, then you can output the module using the shortcode above. This might be useful if, for example, you find that you want to control the position of the module output more precisely than with the module settings. Note that the shortcodes can only be used on single product pages.', 'merchant' ), |
| 227 |
), |
| 228 |
array( |
| 229 |
'id' => 'shortcode_text', |
| 230 |
'type' => 'text_readonly', |
| 231 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 232 |
'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', |
| 233 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 234 |
), |
| 235 |
), |
| 236 |
) ); |