__( 'Sidebar', 'a19' ), 'id' => 'sidebar-2', 'description' => __( 'Add widgets here to appear in your sidebar.', 'a19' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'a19_widgets_init' ); /** * @link https://developer.wordpress.org/themes/advanced-topics/child-themes/#using-functions-php */ function a19_setup_theme() { /** * Load child textdomain for localization * * @link https://developer.wordpress.org/themes/advanced-topics/child-themes/#example-textdomain */ load_child_theme_textdomain( 'a19', get_stylesheet_directory() . '/languages' ); } add_action( 'after_setup_theme', 'a19_setup_theme' ); /* * Customizer * * @link https://developer.wordpress.org/themes/customize-api/customizer-objects/ */ function a19_customizer_settings( $wp_customize ) { /** * Section */ $wp_customize->add_section( 'a19_sidebar_settings', array( 'title' => __( 'Sidebar Settings', 'a19' ), 'priority' => 160, 'description' => __( 'Select the pages where a sidebar will appear. For an in depth description of the choices, see the WordPress function reference. For front page, for example, see is_front_page().', 'a19' ), 'capability' => 'edit_theme_options', ) ); function a19_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } /** * Settings */ $wp_customize->add_setting( 'home_sidebar', array( 'default' => true, 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'a19_sanitize_checkbox', ) ); $wp_customize->add_setting( 'front_page_sidebar', array( 'default' => false, 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'a19_sanitize_checkbox', ) ); $wp_customize->add_setting( 'single_sidebar', array( 'default' => false, 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'a19_sanitize_checkbox', ) ); $wp_customize->add_setting( 'page_sidebar', array( 'default' => false, 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'a19_sanitize_checkbox', ) ); $wp_customize->add_setting( 'archive_sidebar', array( 'default' => false, 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'a19_sanitize_checkbox', ) ); $wp_customize->add_setting( 'search_sidebar', array( 'default' => false, 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'a19_sanitize_checkbox', ) ); /** * Controls */ $wp_customize->add_control( 'a19_display_home_sidebar', array( 'section' => 'a19_sidebar_settings', 'settings' => 'home_sidebar', 'type' => 'checkbox', 'label' => __( 'Display home sidebar', 'a19' ), 'description' => __( 'Display a sidebar on the page that shows the time-based blog content of your site.', 'a19' ), ) ); $wp_customize->add_control( 'a19_display_front_page_sidebar', array( 'section' => 'a19_sidebar_settings', 'settings' => 'front_page_sidebar', 'type' => 'checkbox', 'label' => __( 'Display front page sidebar', 'a19' ), 'description' => __( "Display a sidebar on the page chosen to be the site's home page.", 'a19' ), ) ); $wp_customize->add_control( 'a19_display_single_sidebar', array( 'section' => 'a19_sidebar_settings', 'settings' => 'single_sidebar', 'type' => 'checkbox', 'label' => __( 'Display single sidebar', 'a19' ), 'description' => __( 'Display a sidebar on pages displaying a single post.', 'a19' ), ) ); $wp_customize->add_control( 'a19_display_page_sidebar', array( 'section' => 'a19_sidebar_settings', 'settings' => 'page_sidebar', 'type' => 'checkbox', 'label' => __( 'Display page sidebar', 'a19' ), 'description' => __( 'Display a sidebar on a pages not displaying post content.', 'a19' ), ) ); $wp_customize->add_control( 'a19_display_archive_sidebar', array( 'section' => 'a19_sidebar_settings', 'settings' => 'archive_sidebar', 'type' => 'checkbox', 'label' => __( 'Display archive sidebar', 'a19' ), 'description' => __( 'Display a sidebar on pages showing archived posts. This includes dates, categories and tags.', 'a19' ), ) ); $wp_customize->add_control( 'a19_display_search_sidebar', array( 'section' => 'a19_sidebar_settings', 'settings' => 'search_sidebar', 'type' => 'checkbox', 'label' => __( 'Display search sidebar', 'a19' ), 'description' => __( 'Display a sidebar on pages showing search results.', 'a19' ), ) ); } add_action( 'customize_register', 'a19_customizer_settings' ); /** * Support for A19 templates */ require get_stylesheet_directory() . '/inc/template-functions.php';