WordPress – Theme Editor: Alphabetical File Sorting

A quick fix some people might be interested in is how to sort the files listed on the theme editor page alphabetically. Some themes can have a large number of files and the default WordPress coding puts the list in no particular coding, making it difficult to track down a particular page. The addition of 2 lines of code can order the list to make it easier to work with.

  1. Save a copy of wp-admin/theme-editor.php to your local computer
  2. Backup the original version
  3. Open the local copy with a plain text editor (notepad works nicely)
  4. Around line 35 there should be a statement identical to:
    $allowed_files = array_merge($themes[$theme][‘Stylesheet Files’], $themes[$theme][‘Template Files’]);
  5. After this insert the following two lines directly after:
    natcasesort($allowed_files);
    $allowed_files = array_values($allowed_files);
  6. Save your copy and upload it back to the server
  7. Presto, list of files is now in alphabetical order

This will order by filename, but some files might display aliases like “Stylesheet” instead of styles.css, but it will still sort using styles.css, just be aware of that.

WordPress: Order Link Categories manually?

Now that the semester is over I’m going to devote some more of my time to my blog and also developing software. One of the first things I was going to do on my blog is add more links over on the right and realized it is a major pain in the butt to order not only the links but also the link categories themselves. WordPress has no facility for manually ordering the link categories so I changed that. My quick fix was adding a column to the database and then editing the select query to order by “my_order” instead of whatever it was doing.

My plan is to develop a plugin to add this functionality because it is sorely missing and the weakest point of WordPress that I have found. I’ll update as I work on that and hopefully I can get it released to the WP community for others to use.

A Non-Geek Friendly Introduction to AJAX

Just like the Internet, Al Gore didn’t invent it. Some of you might not be terribly nerdy/geeky/techie people, but since you are here looking at this site you are using the Internet, this should be of interest to you. If anything it will make you smarter and in a few years you can impress your friends by saying “Eh whatever, I heard about AJAX back in 2005, big deal.”

AJAX stands for (Asynchronous JavaScript and XML), this may be gibberish but it will change (you may have already unknowingly experienced it) the way you interact with your computer and the Internet. With the current state of the net, you are presented with a static page that loads in your browser and you read it or make some changes and refresh the page or submit a form, etc… Nothing very exciting.

AJAX uses technology behind the scenes to communicate with a server and returns information to the page you are looking at without refreshing the page, allowing it to become truly dynamic and interactive. The best way to further explain is to see it in action and decide for yourself the cool factor.

Google Maps, Google Suggest, Meebo

More information on AJAX