Saving/changing the Style ID (Smart Option: style_id) is what applies the pre-made styles from the Style Server (running on the main SLP site at the moment).

\SLP_SmartOptions::view_appearance()

This method defines the Smart Option for style_id.
It is a hidden field (changed with JS on the old Settings | View interface).
When changed it calls \SLP_SmartOptions::change_style_id() which directly calls \SLP_Style_Manager->change_style() to load the style changes from the style server.

This also sets up related style Smart Option which displays the “style_vision_list” vue based listing.

The now-defunct theme Smart Option is also set, but this is for legacy support and no longer used.

			$smart_options['theme']    = array(
				'type'    => 'hidden',
				'default' => 'a_gallery_style',
			);
			$smart_options['style_id'] = array(
				'type'              => 'hidden',
				'call_when_changed' => array( $this, 'change_style_id' ),
			);
			$smart_options['style']    = array(
				'type'       => 'style_vision_list',
				'show_label' => true,
				'wrapper'    => false,
				'vue'        => true,
			);
			$smart_

\SLP_Style_Manager::change_style_id()

Call stack when clicking “select style” on the legacy “style vision list”:

SLP_SmartOptions.php:320, SLP_SmartOptions->change_style_id()
SLP_SmartOptions.php:539, SLP_SmartOptions->execute_change_callbacks()
SLP_Admin_Settings.php:409, SLP_Admin_Settings->save_options()
SLP_Admin_UI.php:538, SLP_Admin_UI->setup_admin_screen()
class-wp-hook.php:324, WP_Hook->apply_filters()
class-wp-hook.php:348, WP_Hook->do_action()
plugin.php:517, do_action()
class-wp-screen.php:424, WP_Screen->set_current_screen()
screen.php:243, set_current_screen()
admin.php:212, {main}()

Call stack when clicking “activate” on the new style manager (React based) interface:

SLP_SmartOptions.php:320, SLP_SmartOptions->change_style_id()
SLP_SmartOptions.php:539, SLP_SmartOptions->execute_change_callbacks()
SLP_REST_Handler.php:719, SLP_REST_Handler->update_smart_option()
MySLP.php:266, MySLP->rest_dispatch_request_filter()
class-wp-hook.php:324, WP_Hook->apply_filters()
plugin.php:205, apply_filters()
class-wp-rest-server.php:1187, WP_REST_Server->respond_to_request()
class-wp-rest-server.php:1041, WP_REST_Server->dispatch()
class-wp-rest-server.php:431, WP_REST_Server->serve_request()
rest-api.php:424, rest_api_loaded()
class-wp-hook.php:324, WP_Hook->apply_filters()
class-wp-hook.php:348, WP_Hook->do_action()
plugin.php:565, do_action_ref_array()
class-wp.php:418, WP->parse_request()
class-wp.php:813, WP->main()
functions.php:1336, wp()
wp-blog-header.php:16, require()
index.php:17, {main}()

Style Caching

Only the Style Vision list currently caches style info by setting a transient via \SLP_Style_Manager::cache_style(), it does this as it renders each style response returned from the style server while rendering the vision list.

The cache is kept for one week.

The current style comes from a transient that caches the style server responses.

An example entry:

stdClass Object
(
    [id] => 67
    [date] => 2023-02-21T13:38:51
    [date_gmt] => 2023-02-21T18:38:51
    [guid] => stdClass Object
        (
            [rendered] => http://3.211.25.112/?post_type=slp_style_gallery&p=67
        )

    [modified] => 2024-12-21T13:25:44
    [modified_gmt] => 2024-12-21T18:25:44
    [slug] => basic
    [status] => publish
    [type] => slp_style_gallery
    [link] => https://storelocatorplus.com/slp_style_gallery/basic/
    ...

\SLP_SmartOptions::style

This is the style vision list rendering.

This is also used to cache the style settings from the server by comparing \SLP_Style_Manager::current_style->slug versus the \SLP_SmartOptions::style value

Used By

  • \SLP_Style_Manager::style_matches_slug()
    • which is used by \SLP_Style_Manager::set_active_style()
      • which is used by \SLP_Style_Manager::apply_style()

\SLP_SmartOptions::style_id

The actual selected style_id.