add_section( 'hester_section_help', array( 'title' => esc_html__( 'Help', 'hester' ), 'priority' => 999, ) ); // Reset tour. $customizer->add_setting( 'hester_help_reset_tour', array( 'sanitize_callback' => 'hester_no_sanitize', ) ); $customizer->add_control( new Hester_Customizer_Control_Button( $customizer, 'hester_help_reset_tour', array( 'label' => esc_html__( 'Take a Tour', 'hester' ), 'section' => 'hester_section_help', 'ajax_action' => 'hester_start_customizer_tour', 'button_text' => esc_html__( 'Start Tour', 'hester' ), 'settings' => 'hester_help_reset_tour', 'priority' => 10, ) ) ); // Hester docs. $customizer->add_setting( 'hester_help_hester_docs', array( 'sanitize_callback' => 'hester_no_sanitize', ) ); $customizer->add_control( new Hester_Customizer_Control_Button( $customizer, 'hester_help_hester_docs', array( 'label' => esc_html__( 'Hester Theme Guide', 'hester' ), 'section' => 'hester_section_help', 'button_text' => esc_html__( 'Help Articles', 'hester' ), 'button_url' => 'http://docs.peregrine-themes.com/', 'settings' => 'hester_help_hester_docs', 'priority' => 20, ) ) ); } } /** * Create pointers for current screen. * * @since 1.0.0 */ public function add_pointers() { $current_screen = get_current_screen(); if ( ! $current_screen ) { return; } $pointers = array(); // Get all pointers. switch ( $current_screen->id ) { case 'customize': $pointers = $this->customizer_pointers(); break; default: break; } // Check if any pointers are to be displayed. if ( empty( $pointers ) ) { return; } // Filter out dismissed pointers. $dismissed = get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ); $dismissed = explode( ',', (string) $dismissed ); foreach ( $pointers as $pointer_id => $pointer ) { if ( in_array( $pointer_id, $dismissed, true ) ) { $this->pointers = array(); break; } if ( empty( $pointer ) || empty( $pointer_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) ) { $this->pointers = array(); break; } $this->pointers[ $pointer_id ] = $pointer; } // Check if any pointers are to be displayed. if ( empty( $this->pointers ) ) { return; } // Enqueue pointer script. wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'wp-pointer' ); } /** * Customizer pointers. * * @since 1.0.0 */ public function customizer_pointers() { if ( class_exists( 'Hester_Core' ) ) { $pointers = array( 'hester-pointer-01' => array( 'id' => 'hester-pointer-01', 'target' => '#customize-info', 'next' => 'hester-pointer-02', 'options' => array( 'content' => '

WordPress + Bluehost

' . esc_html__( 'Welcome to your WordPress Site! Let us give you a quick overview to help you customize your website’s design. Or, come back to this tour at any time in the “Help” tab.', 'hester' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'top', ), ), 'focus' => array( 'type' => 'root', ), 'arrow' => 'arrow-top', ), 'hester-pointer-02' => array( 'id' => 'hester-pointer-02', 'target' => '#accordion-section-themes', 'previous' => 'hester-pointer-01', 'next' => 'hester-pointer-03', 'options' => array( 'content' => '

' . esc_html__( 'Your website design and theme', 'hester' ) . '

' . '

' . sprintf( wp_kses( 'To help you get building as fast as possible, we pre-installed our favorite theme, %3$sHester%4$s, but you can change this theme at any time. %1$sRead more about Hester.%2$s', hester_get_allowed_html_tags() ), '', '', '', '' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'middle', ), ), 'focus' => array( 'type' => 'root', ), ), 'hester-pointer-03' => array( 'id' => 'hester-pointer-03', 'target' => '#accordion-section-static_front_page', 'previous' => 'hester-pointer-02', 'next' => 'hester-pointer-04', 'options' => array( 'content' => '

' . esc_html__( 'Enable custom front page sections', 'hester' ) . '

' . '

' . esc_html__( 'To show custom homepage sections like slider, services etc just Enable front page section option under this tab. ', 'hester' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'middle', ), ), 'focus' => array( 'type' => 'root', ), ), 'hester-pointer-04' => array( 'id' => 'hester-pointer-04', 'target' => '#accordion-panel-hester_panel_homepage', 'previous' => 'hester-pointer-03', 'next' => 'hester-pointer-05', 'options' => array( 'content' => '

' . esc_html__( 'Customize front page sections', 'hester' ) . '

' . '

' . esc_html__( 'From under this tab you can customize your custom front page section. You can enable/disable them, re-order them and can change content and their appearance.', 'hester' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'middle', ), ), 'focus' => array( 'type' => 'root', ), ), 'hester-pointer-05' => array( 'id' => 'hester-pointer-05', 'target' => '#accordion-panel-hester_panel_general', 'previous' => 'hester-pointer-04', 'next' => 'hester-pointer-06', 'options' => array( 'content' => '

' . esc_html__( 'Customize your design', 'hester' ) . '

' . '

' . esc_html__( 'Give your site a personalized look. Here you can change your site layout, colors, fonts and more.', 'hester' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'middle', ), ), 'focus' => array( 'type' => 'root', ), ), 'hester-pointer-06' => array( 'id' => 'hester-pointer-06', 'target' => '#accordion-panel-hester_panel_blog', 'previous' => 'hester-pointer-05', 'next' => 'hester-pointer-07', 'options' => array( 'content' => '

' . esc_html__( 'Change your blog layout or location', 'hester' ) . '

' . '

' . esc_html__( 'Customize the look and feel of your blog and introduce yourself to your viewers, customers or the world.', 'hester' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'middle', ), ), 'focus' => array( 'type' => 'root', ), ), 'hester-pointer-07' => array( 'id' => 'hester-pointer-07', 'target' => '#customize-header-actions', 'previous' => 'hester-pointer-06', 'options' => array( 'content' => '

' . esc_html__( 'Save, preview, publish or exit', 'hester' ) . '

' . '

' . esc_html__( 'Done for now? Save, preview, publish or schedule when you want to publish the latest edits to your site. Or, close the customizer to go to your WordPress dashboard to modify your website’s settings or preferences. ', 'hester' ) . '

', 'position' => array( 'edge' => 'top', 'align' => 'left', ), ), 'focus' => array( 'type' => 'root', ), ), ); } else { $pointers = array( 'hester-pointer-01' => array( 'id' => 'hester-pointer-01', 'target' => '#customize-info', 'next' => 'hester-pointer-02', 'options' => array( 'content' => '

WordPress + Bluehost

' . esc_html__( 'Welcome to your WordPress Site! Let us give you a quick overview to help you customize your website’s design. Or, come back to this tour at any time in the “Help” tab.', 'hester' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'top', ), ), 'focus' => array( 'type' => 'root', ), 'arrow' => 'arrow-top', ), 'hester-pointer-02' => array( 'id' => 'hester-pointer-02', 'target' => '#accordion-section-themes', 'previous' => 'hester-pointer-01', 'next' => 'hester-pointer-03', 'options' => array( 'content' => '

' . esc_html__( 'Your website design and theme', 'hester' ) . '

' . '

' . sprintf( wp_kses( 'To help you get building as fast as possible, we pre-installed our favorite theme, %3$sHester%4$s, but you can change this theme at any time. %1$sRead more about Hester.%2$s', hester_get_allowed_html_tags() ), '', '', '', '' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'middle', ), ), 'focus' => array( 'type' => 'root', ), ), 'hester-pointer-03' => array( 'id' => 'hester-pointer-03', 'target' => '#accordion-panel-hester_panel_general', 'previous' => 'hester-pointer-02', 'next' => 'hester-pointer-04', 'options' => array( 'content' => '

' . esc_html__( 'Customize your design', 'hester' ) . '

' . '

' . esc_html__( 'Give your site a personalized look. Here you can change your site layout, colors, fonts and more.', 'hester' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'middle', ), ), 'focus' => array( 'type' => 'root', ), ), 'hester-pointer-04' => array( 'id' => 'hester-pointer-04', 'target' => '#accordion-panel-hester_panel_blog', 'previous' => 'hester-pointer-03', 'next' => 'hester-pointer-05', 'options' => array( 'content' => '

' . esc_html__( 'Change your blog layout or location', 'hester' ) . '

' . '

' . esc_html__( 'Customize the look and feel of your blog and introduce yourself to your viewers, customers or the world.', 'hester' ) . '

', 'position' => array( 'edge' => 'left', 'align' => 'middle', ), ), 'focus' => array( 'type' => 'root', ), ), 'hester-pointer-05' => array( 'id' => 'hester-pointer-05', 'target' => '#customize-header-actions', 'previous' => 'hester-pointer-04', 'options' => array( 'content' => '

' . esc_html__( 'Save, preview, publish or exit', 'hester' ) . '

' . '

' . esc_html__( 'Done for now? Save, preview, publish or schedule when you want to publish the latest edits to your site. Or, close the customizer to go to your WordPress dashboard to modify your website’s settings or preferences. ', 'hester' ) . '

', 'position' => array( 'edge' => 'top', 'align' => 'left', ), ), 'focus' => array( 'type' => 'root', ), ), ); } return $pointers; } /** * Print JavaScript if pointers are available. * * @since 1.0.0 */ public function add_pointers_script() { if ( empty( $this->pointers ) ) { return; } $pointers = wp_json_encode( $this->pointers ); // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped echo " "; // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped } /** * AJAX handler to reset WP Pointers for the customizer tour. * * @since 1.0.0 */ public function start_customizer_tour() { // Security check. check_ajax_referer( 'hester_customizer' ); $customizer_pointers = $this->customizer_pointers(); if ( ! empty( $customizer_pointers ) ) { $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ); foreach ( $customizer_pointers as $pointer => $config ) { $key = array_search( $pointer, $dismissed, true ); if ( false !== $key ) { unset( $dismissed[ $key ] ); } } $dismissed = implode( ',', $dismissed ); update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed ); // Reload page and start the tour. wp_send_json_success( array( 'reload' => true ) ); } // Error. wp_send_json_error(); } /** * Modify recommended plugins for Endurance users. * * @since 1.0.0 * @param Array $plugins Array of recommended plugins. * @return Array Modified array of recommended plugins. */ public function recommended_plugins( $plugins ) { if ( is_array( $plugins ) && ! empty( $plugins ) ) { foreach ( $plugins as $slug => $plugin ) { if ( isset( $plugin['endurance'] ) && false === $plugin['endurance'] ) { unset( $plugins[ $slug ] ); } } } return $plugins; } } endif; /** * The function which returns the one Hester_Endurance instance. */ function hester_endurance() { return Hester_Endurance::instance(); } hester_endurance();