Tact is saying "I don't get it" instead of "you don't make sense".

Commonly Edited Files

June 20th, 2007

If you’re like me and you have multiple WordPress themes, you know how hard it is to have to update every single sidebar to change a link or so on. I have two sidebars, which I edit semi-regularly, so I know how difficult that is! Previously, I’d just link them in every theme to the sidebar files in the default theme, but when I changed my default theme…then what?

I figured there had to be a better way, so I searched my WordPress admin panel, and came across Manage > Files, which somehow I hadn’t been there before! (And I usually poke through every link in my admin panel pretty frequently!) There, I saw the list of recently used files, and the list of common files. Well, I got the bright idea to put my sidebar files in the common files list! So, I opened templates.php (found in wp-admin), and looked until I found something familiar.

<?php $common_files = array('index.php', '.htaccess', 'my-hacks.php' );
$old_files = array('wp-layout.css', 'wp-comments.php', 'wp-comments-popup.php' );

I just added in the names of my files, which I uploaded to my root, and voila! Now, I just have to link all my templates to get the sidebars from my root dir, and I only have one place to change them, no matter what theme! Yay me!

Thanks to Elliot Swan’s Postable to make that code post-friendly!

Leave a Reply

1+1=