The MU forums have moved to WordPress.org

Themes in subdirectories - got a problem :( (3 posts)

  1. TimePeak
    Member
    Posted 15 years ago #

    Hello guys

    Basically I tried to change the default wp-admin/themes.php page behavior.

    I wanted this page to display a list of categories and when clicked - it would display themes in that particular category.

    I created folders inside wp-content/themes and I made the page wp-admin/themes.php display all these folders, then when clicked on - the page displayes all themes I have put there.

    For example, I have wp-content/themes/favorites and the page wp-admin/themes.php displayes a link 'Favorites', when I click on it - it displayes all the themes I have put in wp-content/themes/favorites folder.

    But now I got a problem. I cannot apply any of these themes in wp-content/themes/favorites to live blog.

    What I did. I only changed wp-admin/themes.php

    line 4, there was:

    $themes = get_themes();

    changed to:

    if ( isset($_GET['folder']) ) $themes = get_themes($_GET['folder']);
    else $themes = get_themes();

    After line 47 I added:

    <?php if ( isset($_GET['folder']) ) { ?>

    After line 212 (214 in edited file) I added:

    </div>
    
    <?php } else { ?>
    
    <div class="wrap">
    <h2><?php _e('Themes folders:'); ?></h2>
    
    <?php
    	$theme_loc = $theme_root = get_theme_root();
    	if ( '/' != ABSPATH ) // don't want to replace all forward slashes, see Trac #4541
    		$theme_loc = str_replace(ABSPATH, '', $theme_root);
    
    	// Files in wp-content/themes directory and one subdir down
    	$themes_dir = @ opendir($theme_root);
    	if ( !$themes_dir )
    		return false;
    
    	while ( ($theme_dir = readdir($themes_dir)) !== false ) {
    	if (($theme_dir != ".")  && ($theme_dir != "..") && ($theme_dir != "home"))
      echo '<br /><a href="themes.php?folder='.$theme_dir.'">'. ucfirst(strtolower($theme_dir)) . '</a>';
    }
    
    ?>
    
    </div>
    
    <?php } ?>
    
    <?php require('admin-footer.php'); ?>

    Well, the problem is that I cannot apply any theme located in any subdirectory of wp-content/themes/ to blogs.

    Can anyone help?

  2. TimePeak
    Member
    Posted 15 years ago #

  3. VentureMaker
    Member
    Posted 15 years ago #

    Looks like your problem is solved now ;)
    Check this: http://wpmudevorg.wordpress.com/project/Themes-in-backend-sorted-by-tags
    Uploaded it yesterday.

About this Topic

  • Started 15 years ago by TimePeak
  • Latest reply from VentureMaker