When upgrading the firmware on your PopcornHour A-100 Network Media Tank, you might end up with a hung machine before any operations take place. You’ll know this has happened because your TV screen will go black as soon as you start the process. If this happens to you, there’s a simple solution…remove your custom theme. You don’t have to delete it, just renaming the theme folder form _theme_ to theme and rebooting the A-100 is enough to get you in the firmware updating business. Once you’ve updated, you can safely re-apply your theme and be back in business.
Tag: tips
WordPress Plugins Upgrade Tip
Got a WordPress-powered blog that’s been around a while (since 2.1 or thereabouts)? Is your Admin panel telling you that you have plugins that need to be updated, but when you try, you end up downloading the WordPress Widgets plugin? Fear not, there is a (possibly) easy solution. Check your plugins folder for a “widgets” folder.
I was updating the plugins on my development server this morning when I ran into this issue. The fix was simple; I just moved everything in the widgets folder up to the plugins folder, and like magic, the upgrade notifications went away. So if you’re having this issue, give this tip a shot.
Dynamic Page Graphics in WordPress
Recently, while developing a WordPress theme for a client, I devised a handy trick to use different headline graphics for pages (it should work for posts too) based on the page title. The basis of the trick is to name your headline graphics the same as the pages they are to show up on (ex. about.png for the About page). Once you do this, you simply need to insert the following bits of code into your theme’s page template:
Part 1: Add this to the beginning of your template (just after the line that starts with “<?php get_header(); ?>”):
NOTE: Modified this to actually, you know, WORK! 🙂
If you tried it before, and it didn’t do what you expected, change the code at the top of your template to this new version.
<?php
global $post;
$title = $post->post_name;
$title = strtolower($title);
$titlepic = $title.".png";
?>
For those who don’t read PHP, what this block does is gets the title of the current page, stores it in a variable, converts it to lowercase, and then adds “.png” (changes this if you use gifs or jpgs) to the page title to create the image’s file name.
Part 2: Add this where you want the graphic to appear:
<img src="<?php bloginfo('template_directory'); ?>/images/<?php echo $titlepic ?>" alt="<?php $title ?>" />
This is a standard XHTML image tag. Change the directory to suit your needs, but leave the “<?php echo $titlepic ?>” bit as this is what does the magic. The alt parameter could likewise be changed, but it does need to be there for the XHTML to validate.
So there you have it. A painless method to get dynamic graphics for your blog, based on your page titles.