3 * Singleton class for handling the theme's customizer integration.
6 * @subpackage Shop Isle
10 * Class Shopisle_Customizer_Upsell
15 final class Shopisle_Customizer_Upsell {
24 private function __construct() {
28 * Returns the instance.
34 public static function get_instance() {
36 static $instance = null;
38 if ( is_null( $instance ) ) {
40 $instance->setup_actions();
47 * Sets up initial actions.
53 private function setup_actions() {
55 // Register panels, sections, settings, controls, and partials.
56 add_action( 'customize_register', array( $this, 'sections' ) );
58 // Register scripts and styles for the controls.
59 add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ), 0 );
63 * Sets up the customizer sections.
68 * @param object $manager - the wp_customizer object.
72 public function sections( $manager ) {
74 // Load custom sections.
75 require_once( trailingslashit( get_template_directory() ) . 'inc/customizer/customize-pro/class-shopisle-customizer-upsell-main.php' );
76 require_once( trailingslashit( get_template_directory() ) . 'inc/customizer/customize-pro/class-shopisle-customizer-upsell-text.php' );
77 require_once( trailingslashit( get_template_directory() ) . 'inc/customizer/customize-pro/class-shopisle-customizer-upsell-section.php' );
79 // Register custom section types.
80 $manager->register_section_type( 'Shopisle_Customizer_Upsell_Main' );
81 $manager->register_section_type( 'Shopisle_Customizer_Upsell_Text' );
84 // Main Upsell In Customizer Root.
85 $manager->add_section(
86 new Shopisle_Customizer_Upsell_Main(
87 $manager, 'shopisle-upsell', array(
88 'upsell_title' => __( 'Shop Isle', 'shop-isle' ),
89 'label_url' => 'http://docs.themeisle.com/article/421-shop-isle-documentation-wordpress-org',
90 'label_text' => __( 'Documentation', 'shop-isle' ),
95 // Frontpage Sections Upsell.
96 $manager->add_section(
97 new Shopisle_Customizer_Upsell_Section(
98 $manager, 'shopisle-upsell-section', array(
99 'panel' => 'shop_isle_front_page_sections',
102 esc_html__( 'Categories Section', 'shop-isle' ),
103 esc_html__( 'Map Section', 'shop-isle' ),
104 esc_html__( 'Ribbon Section', 'shop-isle' ),
105 esc_html__( 'Services Section', 'shop-isle' ),
106 esc_html__( 'Shortcodes Section', 'shop-isle' ),
108 'button_url' => esc_url( 'https://www.themeisle.com/themes/shop-isle-pro/' ),
109 'button_text' => esc_html__( 'View PRO version', 'shop-isle' ),
114 // Frontpage Instructions.
115 $shop_isle_wporg_flag = get_option( 'shop_isle_wporg_flag' );
116 if ( ( ( ! empty( $shop_isle_wporg_flag ) && ( 'true' === $shop_isle_wporg_flag ) ) ) && ( 'posts' === get_option( 'show_on_front' ) ) ) {
118 $manager->add_section(
119 new Shopisle_Customizer_Upsell_Text(
120 $manager, 'shopisle-upsell-frontpage-instructions', array(
123 /* translators: 1: Link to static front page customizer control */
124 __( 'To customize the Frontpage sections please create a page. After that, go to %1$s and select "A static page". Finally, for "Front page" choose the page you previously created.', 'shop-isle' ),
126 /* translators: 1: Link to static front page customizer control 2: 'Static Front Page' */
127 '<a class="shop_isle_go_to_section" href="%1$s">%2$s</a>',
128 admin_url( 'customize.php?autofocus[control]=show_on_front' ),
129 esc_html__( 'Static Front Page', 'shop-isle' )
131 ) . '<br><br>' . sprintf(
132 /* translators: 1: Link to documentation page. 2: 'doc' */
133 __( 'Need further informations? Check this %1$s', 'shop-isle' ),
135 '<a href="http://docs.themeisle.com/article/236-how-to-set-up-the-home-page-for-llorix-one" target="_blank">%s</a>',
136 esc_html__( 'doc', 'shop-isle' )
139 'panel' => 'shop_isle_front_page_sections',
149 * Loads theme customizer CSS.
155 public function enqueue_control_scripts() {
157 wp_enqueue_script( 'shopisle-upsell-js', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/customize-pro/shopisle-upsell-customize-controls.js', array( 'customize-controls' ) );
159 wp_enqueue_style( 'shopisle-upsell-style', trailingslashit( get_template_directory_uri() ) . 'inc/customizer/customize-pro/shopisle-upsell-customize-controls.css' );
163 Shopisle_Customizer_Upsell::get_instance();