The MU forums have moved to WordPress.org

Theme Alphabetical Links? (5 posts)

  1. fogster
    Member
    Posted 16 years ago #

    I have over 100 themes installed. It's maybe a bit of an obsession, I admit, but it gives my users choice.

    The problem is that it's a royal pain to scroll through them. I've thought about trying to edit themes.php to add a simple link at top, with each letter of the alphabet, and using anchors within the page (e.g., the "A" link would just 'link' to #A, scrolling down appropriately).

    The problem is that the current code doesn't seem well-suited to this. I wondered if anyone has ever done this before, before I go mucking with the source. :)

  2. lunabyte
    Member
    Posted 16 years ago #

    Digging into the source would be the way to accomplish it, unfortunately.

    Just keep track of your edits so you can repeat them when you upgrade.

  3. theapparatus
    Member
    Posted 16 years ago #

    May want to look into this hack as well:

    http://mu-plugins.livelyblog.com/Themes.php-hack

    edit: I do hope you've tested all of those themes. :)

  4. fogster
    Member
    Posted 16 years ago #

    theapparatus: Interesting, but the page includes some crazy 9/11 conspiracy agenda and some other stuff that offends even someone *far* to the left like me.

    I'm kind of sorry to report that I *have* tested every single one.

    I ended up doing what lunabyte suggested...

    The changes were easier than I expected...

    # diff --normal themes.original.php themes.php
    68a69,79
    > <!-- Quick Links -->
    > <div id="quicknav" class="updated fade">
    > Quick navigation:
    > <?php
    >   for($a=65; $a<91;$a++) {
    >     // A is ASCII 65
    >     $letter = chr($a);
    >     echo "<a href='#$letter'>$letter</a> ";
    >   }
    > ?>
    > </div>
    83a95
    >
    88a101
    > $is_used= array();
    95a109
    >               $firstletter=  strtoupper($title{0});
    102a117
    >
    103a119,129
    >
    > <?php
    >   // Insert an anchor for quick links if appropriate
    >   if(!$is_used[$firstletter] && $firstletter>= 'A' && $firstletter <= 'Z') {
    >     echo "<a>&nbsp;</a>";
    >     $is_used[$firstletter] = 1;
    >   }
    >
    > ?>
  5. lunabyte
    Member
    Posted 16 years ago #

    Editing the core isn't a bad thing, when you need to do it.

    Just remember to keep track of all your edits (like in a separate text file) so that you can repeat the process when you upgrade.

About this Topic

  • Started 16 years ago by fogster
  • Latest reply from lunabyte