The MU forums have moved to WordPress.org

Plugin - List all available themes (125 posts)

  1. andrea_r
    Moderator
    Posted 18 years ago #

    ITA - the only reason they are is "they" declared it so, I think. :-/

  2. andrewbillits
    Member
    Posted 18 years ago #

    Hey guys,

    I apologize in advance for posting this across several threads but I don't want anyone to think i'm just ignoring them. I'm going to be on vacation from now through Aug 11th. So if anyone asks a question and I don't reply, please don't think that i'm just avoiding it. I'll try to pop in between now and Aug 5th but after that i'll be without a decent (as in faster than 28K Dialup) internet connection.

    When i get back i'm going to update all of the plugins in the List-All series with the requested features as well as upload a few other plugins I have sitting on my hard drive.

    I'm hoping that this week and next will be relativly "slow" since Donncha is in SF for WordCamp. However, if anything goes wrong, i'll be checking my email regularly so feel free to email at "andrew (aT} idtstudios.com".

    I'm counting on drmike and andrea to hold down the fort while i'm gone ;)

  3. andrea_r
    Moderator
    Posted 18 years ago #

    Ahhh! Good thing I'll be here all week then... have a great vacation. :)

  4. Ovidiu
    Member
    Posted 18 years ago #

    @drmike:

    can you make your modified version available again, please?

    http://daria.be/list-all-themes.phps is not working

  5. Ba22Man
    Member
    Posted 17 years ago #

    anybody have a copy of drmikes modified version of list all themes?

  6. suleiman
    Member
    Posted 17 years ago #

    does anyone know how to get the themes displayed to show up 3 or 2 to a row instead of 1 to a row?

  7. Ovidiu
    Member
    Posted 17 years ago #

    would this be what you are looking for? http://zice.ro/theme-list/

    I could get 3 in a row if I had not limited it to 2 because I want to introduce a sidebar later (I mean it is already there, I just have no content in the sidebar yet...)

    If you are looking for something similar I'll have a look how Idid it and post here, if not I will bore no-one :-)

  8. conpeo
    Member
    Posted 17 years ago #

    Ovidiu, can you show me how to list 3 screenshot in a row?
    eg: http://zice.ro/theme-list/

  9. Ovidiu
    Member
    Posted 17 years ago #

    on the page you quoted above I currently have 2 in a row, because I want to keep my sidebar, if I remove the sidebar it will 3 in a row.

    I'll post here what makes that work:

    here you'll see how I call the function in the template:

    <?php
    /*
    Filename: theme_list.php
    Template Name: List ALL Themes
    */
    $aOptions = get_option('gi_subtle_theme');
    ?>
    <?php get_header(); ?>
    <!-- Content Start -->
    <div id="loop_page">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div id="post_<?php the_ID(); ?>"
    class="post lead">
    <h3 class="title"><a href="<?php
    the_permalink() ?>"><span><?php
    the_title(); ?></span></h3>
    <div class="content">
    <?php if
    (function_exists(list_all_wpmu_themes))
    {list_all_wpmu_themes();} ?>
    <?php
    link_pages('<h4>Pages:</h4>',
    '', 'number'); ?>
    </div>
    </div>
    <?php endwhile; endif; ?>
    </div>
    <div id="widgets" class="page">
    <div id="widgets_page" class="widget_set
    reduced">

    here is the CSS that you have to add template:

    #content #theme-list{
    /*background-color: #A5AC44;*/
    width: 270px;
    float: left;
    text-decoration: none;
    list-style-type: none;
    }

    and here is my list-all-themes.php, I might have modified it a bit i am not sure about this:

    <?php
    /*
    Plugin Name: List-All-Themes
    Plugin URI: http://www.wpmudev.org/project/list-all-themes
    Description: Creates a list of all themes on a WPMU site
    Author: Andrew Billits
    Author URI:
    Version: 0.0.1
    */
    global $name_or_url;
    global $begin_wrap;
    global $end_wrap;
    function list_all_wpmu_themes() {
    $themes = get_themes();
    $theme_names = array_keys($themes);
    natcasesort($theme_names);
    echo"
    <ul>";
    foreach ($theme_names as $theme_name) {
    if ( $theme_name == $ct->name )
    continue;
    $title = $themes[$theme_name]['Title'];
    $description = $themes[$theme_name]['Description'];
    $author = $themes[$theme_name]['Author'];
    $screenshot = $themes[$theme_name]['Screenshot'];
    ?>
    <li id="theme-list"><?php echo $title; ?>
    <img width="200" height="150" src="<?php echo
    $themes[$theme_name]['Template Dir']; ?>/<?php echo $screenshot;
    ?>">
    made by <?php echo $author; ?>
    <?php } echo"</ul>
    "; // end foreach theme_names
    }
    ?>

    hope this helps :-)
    ovidiu

  10. Ovidiu
    Member
    Posted 17 years ago #

    here is the modified CSS for 3 in a row if your theme is wide enough :-)


    #content #theme-list{
    /*background-color: #A5AC44;*/
    width: 225px;
    height: 215px;
    float: left;
    text-decoration: none;
    list-style-type: none;
    padding: 0

    looks good with my template, you might have to modify that a bit

  11. andrea_r
    Moderator
    Posted 17 years ago #

    Just thought I;d add the plain-english explanation:

    The plugin spews it all out in a lis,t but not really. The images appear either in a line or two in a row, because that's all that can fit in the width of the div in the layout. Make the div bigger, get more in a "row". No magic there.

  12. Ovidiu
    Member
    Posted 17 years ago #

    thx andrea, I have to admit that pretty much sums it up although you just dispelled my magic ;-)

    I guess what I changed in the plugin was this line: <li id="theme-list"> so that our "items" have a name but I just realized it is crap, I was using id="theme-list" where it should be class="theme-list" instead

    then you define in your css that all members of theme-list, float: left; and are width: "whateverfitsyourlayout"px;

    :-)

  13. andrea_r
    Moderator
    Posted 17 years ago #

    "width: "whateverfitsyourlayout"px;"

    Best declaration I've seen all day.:D

  14. ladeem
    Member
    Posted 17 years ago #

    OK - I've tried yours Ovidiu, and I get one messed up page. Not sure if it's my theme, and the bulleted list or what. You can see it here: http://web-princess.com/theme-list/ Can anyone tell me what I may be doing wrong?

    Thanks in advance.

  15. Ovidiu
    Member
    Posted 17 years ago #

    I played around with yout layout, to get 2 in a row, you need to use this:

    #theme-list{
    width: 225px;
    height: 215px;
    float: left;
    text-decoration: none;
    list-style-type: none;
    padding: 0px;
    }

    for 3 in a row your content is too narrow, so you would need to adjust your content width like this:

    /* content */
    .content {
    float: left;
    margin: 10px 0;
    padding: 0 16px;
    width: 770px;
    }

    before it was just 531px wide...

    keep in mind, this is just a quick fix for you to keep you going, still needs fine tuning by you :-)

  16. ladeem
    Member
    Posted 17 years ago #

    Well, upon further inspection, I see that what you posted is geared towards your theme and site specifically. Also, in the code you posted for the list.php, the <br> break codes were missing. This made it all FUBAR. Now I need to get them to wrap. If I don't figure it out myself (I'm impatient), can you tell me how you wrap them on your page?

    Thanks again! ;)

  17. Ovidiu
    Member
    Posted 17 years ago #

    first of all, in a later post I said:

    I guess what I changed in the plugin was this line: <li id="theme-list"> so that our "items" have a name but I just realized it is crap, I was using id="theme-list" where it should be class="theme-list" instead

    explaining what I had changed. It seems posting the code here broke th <br> tags.

    and about this being specific for my site, I do not understand what you mean. what you said did was setting the height of theme-list to 115 instead of 225 thats half of the screenshot height, that can't work. take the code I posted above, and you'll have 2 in a row... I tested it.

    as far as getting them to wrap, its the float: left; AND do not use: #content #theme-list => thats what you are using right now, your layout will work with this: #theme-list.

    another hint: 2 elements on your side have the same class, that means you cannot set their width different, here is an excerpt from your source code:

    <div class="theme-list">

      <li class="theme-list">2 Column K2<br>

    the div contains the li and as they are the same class their width will be the same, so you will never get more than 1 in a row :-)

  18. ladeem
    Member
    Posted 17 years ago #

    Please don't get me wrong - I really appreciate your help, because I've been wondering how I was going to accomplish this. I meant only that I'm a bonehead, and if something doesn't work for me, more than likely it's my fault and not yours. ;)

    What I meant specific for your site, is for the theme-list.php template you posted
    $aOptions = get_option('gi_subtle_theme');
    ?>
    <?php get_header(); ?>
    <!-- Content Start -->
    <div id="loop_page">

    I figured that must be for your site, because it wouldn't work for my theme, is all. It took me a few minutes looking at it before I realized that. :)

    And I still don't know what I'm doing wrong ... It's not wrapping. :( Ah well, I'll just keep hacking at it! :)

  19. Ovidiu
    Member
    Posted 17 years ago #

    regarding the example above, that should just show you how I call the plugin, the relevant part was: <?php if
    (function_exists(list_all_wpmu_themes))
    {list_all_wpmu_themes();} ?>

    the code on your site right now is: #theme-list {
    this is meant to be used if theme-list is an id, BUT you use it as a class so make that .theme-list instead => works instantly

    only change the # into a . in your stylesheet, thats it.

  20. ladeem
    Member
    Posted 17 years ago #

    *sniff sniff* I'm going to cry! :) Thank you, THANK YOU, for all of your help with this! You're awesome! It looks beautiful, check it out yourself! hehe I'm not a coder, per se, and I can usually take what I'm given and make it work, but you taught me a lot right there. I feel like an idiot! :) Thank you again, so much!

  21. qza
    Member
    Posted 17 years ago #

    Above codes didn't work for me because of screenshot links. I kinda used mix of codes in current topic and this topic:
    http://mu.wordpress.org/forums/topic.php?id=2032&replies=6
    and it works fine. The code for screenshot is:
    <img width="200px" height="150px" src="<?php echo get_option('siteurl') . '/' . $themes[$theme_name]['Template Dir'] . '/' . $screenshot; ?>"/>
    I want to know is it because of misconfiguration on my server or something else?
    PS: I'm using wpmu 1.1

  22. drmike
    Member
    Posted 17 years ago #

    Depends. What are you getting for output?

    Might help if you gave us a link.

    But anyway...

    I would just cut and paste it out of the themes.php file myself. The page defines as following:

    $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
    $screenshot = $themes[$theme_name]['Screenshot'];

    Then to display it:

    <img src="../<?php echo $stylesheet_dir . '/' . $screenshot; ?>" alt="" />

  23. qza
    Member
    Posted 17 years ago #

    Thank you drmike. Problem was screenshot didn't show when page source reads like this:
    <img width="200" height="150" src="wp-content/themes/connections(tp)/screenshot.png">
    But it showed when source reads like this:
    <img width="200" height="150" src="http://mysite.tld/wp-content/themes/connections(tp)/screenshot.png">
    I was wondering what was the problem.

    Also I couldn't show templates in 2 or 3 in a row. I made changes to dKret theme's style.css, but I think css change had no effect. Someone please take a look into it:
    http://delhii.net/%D0%B7%D0%B0%D0%B3%D0%B2%D0%B0%D1%80/

  24. lunabyte
    Member
    Posted 17 years ago #

    The "problem" was a relative url, but that's basic html.

  25. conpeo
    Member
    Posted 17 years ago #

    qza, maybe you check again the style.css you using is current theme?
    list-all-themes page is create by Page template (write post new page)

    add the following code to style.css (refer this post)
    show in 2 or 3 in a row is ok.

    #theme-list
    {
    width: 225px;
    height: 215px;
    float: left;
    text-decoration: none;
    list-style-type: none;
    padding: 0px;
    }
    .content
    {
    float: left;
    margin: 10px 0;
    padding: 0 16px;
    width: 770px;
    }

  26. qza
    Member
    Posted 17 years ago #

    Thank you conpeo. Yes style.css is from current theme and I created template list using Page template. I added above code to end of theme's style.css, but it still shows themes in 1 column...

  27. agapecatholic
    Member
    Posted 17 years ago #

    Please forgive the noob question but how does one create a php page for this plugin? I've tried a couple of plugins that are supposed to enable php in the WP write section but neither of them worked.

    Thanks

  28. Ovidiu
    Member
    Posted 17 years ago #

    no you create a new page template and put the php in the template but your try should also work I can't imagine why you should not be able to use a php executing plugin to achieve this but on the other hand you don't want a php executing widget available sitewide...

  29. yyvonne
    Member
    Posted 16 years ago #

    No pagination and preview for this?

    I have this for pagination, it works, but I can't get it to link to the next page, please help.

    <?php
    /*
    Plugin Name: List-All-Themes
    Plugin URI: http://www.wpmudev.org/project/list-all-themes
    Description: Creates a list of all themes on a WPMU site
    Author: Andrew Billits
    Author URI:
    Version: 0.0.1
    */

    global $name_or_url;
    global $begin_wrap;
    global $end_wrap;

    function list_all_wpmu_themes() {
    $themes = get_themes();

    $theme_names = array_keys($themes);
    natcasesort($theme_names);

    // Pagination
    $themes_per_page = (int) apply_filters('themes_per_page', 30);
    $actual_page = (int) ( isset($_GET['pagination']) ) ? $_GET['pagination'] : 1;

    $found_themes = count($theme_names);
    $max_num_pages = ceil($found_themes/$themes_per_page);

    if( $actual_page != 1 ) {
    if($actual_page > $max_num_pages) {
    $actual_page = $max_num_pages;
    }
    }

    $start = ($actual_page - 1) * $themes_per_page;
    $end = $start + $themes_per_page;

    if ( $max_num_pages > 1 ) {
    $output = '<div class="pagination">';
    $output .= __('Page: ');
    for ( $i = 1; $i <= $max_num_pages; $i++ ) {
    $output .= ''.$i.'';
    }
    $output = str_replace('pagination='.$actual_page.'">', 'pagination='.$actual_page.'" class="current_page">', $output);
    $output .= '</div>';
    echo $output;
    }

    $i = 0;
    foreach ( (array) $theme_names as $theme_name) {
    if ( ($i >= $start) && ($i < $end) ) {
    $template = $themes[$theme_name]['Template'];
    $stylesheet = $themes[$theme_name]['Stylesheet'];
    $title = $themes[$theme_name]['Title'];
    $version = $themes[$theme_name]['Version'];
    $description = $themes[$theme_name]['Description'];
    $author = $themes[$theme_name]['Author'];
    $screenshot = $themes[$theme_name]['Screenshot'];
    $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
    $activate_link = wp_nonce_url("list-all-themes.php?action=activate&pagination=".$actual_page."&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
    ?>
    <div class="available-theme">
    <h3>"><?php echo $title; ?></h3>

    " class="screenshot">
    <?php if ( $screenshot ) : ?>
    <img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" width="220" alt="<?php echo attribute_escape(strip_tags($title)); ?>" />
    <?php endif; ?>

    <p><?php echo $description; ?></p>
    </div>
    <?php
    }
    $i++;
    } // end foreach theme_names

    if ( $max_num_pages > 1 ) {
    $output = '<div class="pagination">';
    $output .= __('Page: ');
    for ( $i = 1; $i <= $max_num_pages; $i++ ) {
    $output .= ''.$i.'';
    }
    $output = str_replace('pagination='.$actual_page.'">', 'pagination='.$actual_page.'" class="current_page">', $output);
    $output .= '</div>';
    echo $output;
    }

    }
    ?>

  30. dsader
    Member
    Posted 16 years ago #

    First up, a couple lines of code in a post is fine(if you are certain it isn't being "borked") but for long chunks or entire pages use

    http://pastebin.com/

    It's free, takes a couple seconds to chuck it up there.
    Every character in your code shows up line for line as you intend.

About this Topic

  • Started 18 years ago by NickR
  • Latest reply from billdennis5