• Resolved hgh001

    (@hgh001)


    In the themes list, if a theme is a parent for a child theme that is active on multiple blogs, the child theme is listed for each blog where it is active, resulting in duplication.

    Suggested fix, in class-add-theme-list.php, call array_unique on result list before returning:

    	
    /**
    	 * Gets an array of themes which have the selected one as parent.
    	 *
    	 * @since  21/02/2015
    	 *
    	 * @param String $theme_key The key of each theme.
    	 *
    	 * @return array
    	 */
    	public function is_parent( $theme_key ) {
    
    		$blogs_themes = $this->get_blogs_themes();
    		$parent_of    = array();
    
    		/**
    		 * Provide the data to the Theme of each site.
    		 *
    		 * @var array $data
    		 */
    		foreach ( (array) $blogs_themes as $blog_id => $data ) {
    
    			$template = FALSE;
    			if ( array_key_exists( 'template', $data ) ) {
    				$template = $data[ 'template' ];
    			}
    
    			if ( $template !== $data[ 'stylesheet' ] && $template === $theme_key ) {
    				$theme       = wp_get_theme( $data[ 'stylesheet' ] );
    				$parent_of[] = $theme->get( 'Name' );
    			}
    		}
    
    		return array_unique($parent_of);
    	}
    
Viewing 1 replies (of 1 total)
  • Plugin Author Frank Bueltge

    (@bueltge)

    Thanks a lot for this hint! Great.
    I have implement this change in the current development version on GitHub and will release in the next version.

Viewing 1 replies (of 1 total)
  • The topic ‘Suggestion: remove duplicates from list of child themes’ is closed to new replies.