add_section( 'help_documents', array(
'title' => __( 'Help', 'bootcms' ),
'priority' => 999,
) );
// -------------
$wp_customize->add_setting( 'getting_started_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'getting_started_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'label' => __( 'Choose a Topic', 'bootcms' ),
'description' => '' .
esc_html__( 'Getting Started', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'features_scaffolding_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'features_scaffolding_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Features & Scaffolding', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'site_identity_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'site_identity_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Site Identity', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'global_styles_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'global_styles_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Simple Styles Global', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'bootcms_styles_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'bootcms_styles_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Simple Styles BootCMS', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'advanced_settings_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'advanced_settings_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Advanced Settings', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'post_settings_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'post_settings_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Post Settings', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'the_menus_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'the_menus_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Menus', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'the_widgets_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'the_widgets_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Widgets', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'homepage_settings_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'homepage_settings_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Homepage Settings', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'additional_css_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'additional_css_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Additional CSS', 'bootcms' ) .
'',
) );
$wp_customize->add_setting( 'large_editor_help', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( 'large_editor_help', array(
'type' => 'hidden',
'section' => 'help_documents',
'description' => '' .
esc_html__( 'Large HTML Editor', 'bootcms' ) .
'',
) );
}
add_action( 'customize_register', 'help_docs_customize_register' );
// send direct URL requests to the help files, to the real path
add_action( 'template_redirect', function() {
$request = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
$position = strpos( $request, 'bootcms-help/' );
if ( $position !== false ) {
$requested_file = substr(
$request,
$position + strlen( 'bootcms-help/' )
);
wp_safe_redirect(
get_template_directory_uri()
. '/bootcms-help/'
. $requested_file,
302
);
exit;
}
} );