The MU forums have moved to WordPress.org

list-all-themes minor modification (6 posts)

  1. thatposhgirl
    Member
    Posted 18 years ago #

    I added some code to the List-all-themes plugin so that it will only show available themes and won't show the home theme. I hope it is okay if I post this? Keep in mind I know almost nothing about php...

    After:
    $themes = get_themes();
    add this:

    $allowed_themes = get_site_option( "allowed_themes" );
    if( $allowed_themes == false ) {
    $allowed_themes = array();
    }
    $blog_allowed_themes = get_option( "allowed_themes" );

    if( is_array( $blog_allowed_themes ) )
    $allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes );

    reset( $themes );
    while( list( $key, $val ) = each( $themes ) ) {
    if( isset( $allowed_themes[ $key ] ) == false ) {
    unset( $themes[ $key ] );
    }
    }
    reset( $themes );

    after:
    $screenshot = $themes[$theme_name]['Screenshot'];
    add this:
    if ( $stylesheet_dir == "wp-content/themes/home" ) continue;

    Okay, that last bit is a total hack but nothing else I tried worked.

    here it is in action: http://screenwriters.la/theme-directory/

    I also added a bit so it would show thumbnails:
    <img width="300px" height="220px" src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="<?php echo $title ?>" />

  2. drmike
    Member
    Posted 18 years ago #

    One thing you may want to do, and I suggest this because folks raised heck on my support forum is a lot of those screencaps are very large *.pngs, some of them 150kb+.

    I went though and resaved each and everyone of them as *.jpgs of less than 15kb. Lots of folks thanked me even though it took most of an afternoon to do it.

  3. suleiman
    Member
    Posted 17 years ago #

    how do you get the themes to list 3 to a row?

  4. conpeo
    Member
    Posted 17 years ago #

    dig...

    how to list 3 in one row?

  5. ladeem
    Member
    Posted 17 years ago #

    It will automatically make 3 in a row if the width of your box is wide enough. You may need to play with it to get it to work. For mine, I made a theme.php template and tweaked it. I had a lot of help from Ovidiu in this thread:

    http://mu.wordpress.org/forums/topic.php?id=845&replies=50

  6. ladeem
    Member
    Posted 17 years ago #

    Oh, and posh ... works beautifully - but I did notice that if you have a theme activated for just one blog, it's on the list. The theme I use for my main blog is only activated for that one, yet it shows up in the list. Other than that, it took all the other ones out! Beautimous! ;)

About this Topic

  • Started 18 years ago by thatposhgirl
  • Latest reply from ladeem