Custom sidebars can be loaded when you need them.

Loading a custom sidebar for a specific page

Sidebars can be loaded for specific pages.

/**
 * Load a custom sidebar for a specific page.
 * If no sidebar is found in the child theme, it will look for it in the parent theme.
 *
 * @param string $sidebar
 *
 * @return string $sidebar The sidebar to load
 */
function themedd_snippet_load_sidebar_page( $sidebar ) {

	/**
	 * Loads a custom sidebar for the "about" page
	 * E.g. sidebar-{sidebar-name}.php
	 * In this example, it will look for sidebar-about.php
	 */
    if ( is_page( 'about' ) ) {
        $sidebar = 'about';
    }

	// Return the new sidebar.
    return $sidebar;

}
add_filter( 'themedd_get_sidebar', 'themedd_snippet_load_sidebar_page', 10, 1 );

Loading a custom sidebar for a specific download

Sidebars can be loaded for specific downloads with Easy Digital Downloads.

/**
 * Load a custom sidebar for a specific download.
 * If no sidebar is found in the child theme, it will look for it in the parent theme.
 *
 * @param string $sidebar
 *
 * @return string $sidebar The sidebar to load
 */
function themedd_snippet_load_sidebar_download( $sidebar ) {

	/**
	 * Loads a custom sidebar for download with the ID of 1234
	 * E.g. sidebar-{sidebar-name}.php
	 * In this example, it will look for sidebar-special-download.php
	 */
    if ( 1234 == get_the_ID() ) {
        $sidebar = 'special-download';
    }

	// Return the new download sidebar.
    return $sidebar;

}
add_filter( 'themedd_get_sidebar', 'themedd_snippet_load_sidebar_download', 10, 1 );

PHP should be added to your child theme's functions.php file.