Jonas Knutsen : Archive

Author Archive

Disappearing page templates thanks to bad taxonomy naming

Posted on: 5th February 2012 No Comments

On one of my other sites, I’ve recently transferred all the old, static content into a WordPress installation, so that I can WordPress as a CMS. The content is divided into five main categories, and for each category I’ve created a custom page template. The main menu links to the category pages, making them “category portals”, so to speak. And it looks good.

But yesterday, WordPress stopped using the custom page templates, and defaulted to index.php on all of my pages. But in the admin area, the pages were still listed as using the templates, and the files were actually still on the web server. I tried to upload the theme once more, without it helping, and also reinstalled WordPress through the Dahboard -> Updates screen without result. It was not until I turned off and on again my custom permalink structure that it went back to normal. My custom structure was /%category%/%postname%/ and choosing default, saving, and choosing custom structure once more, solved it. Or so I believed.

Because this morning, the custom page templates did once again not work. And I had to turn the custom structure off and on again to make it go back. And it was ok for about ten minutes, before defaulting back to the index.php again.

After some time looking angrily at my screen, it dawned on me that it might have something to do with my custom taxonomies. I had set up a taxonomy named year, that i used for the posts. In retrospect, not a very good name for a taxonomy. I had not managed to get any output for this taxonomy yet, and had kind of given up yesterday. Not one before I discovered the defaulting. So I deleted the taxonomy from the functions file, and no the problem seem to be solved.

So the moral of the story has probably something to do with naming conventions. Well, well…

Displaying custom WordPress taxonomy terms with or without links

Posted on: 22nd January 2012 No Comments

WordPress lets you create custom taxonomy terms, a feature that makes WordPress a very good CMS. If you want to display these terms (on a specific post), there are more than one way to do this.

If you want to list the terms associated with a specific post with a link to a term archive, you can use the get_the_term_list() function. This displays the terms (including a term link). To run through the terms, use code similar to this (from the codex):

<?php echo get_the_term_list( $post->ID, 'people', 'People: ', ' ', '' ); ?>

But if you want to display the terms without the links, you can use code similar to this, using wp_get_object_terms():

$people_terms = wp_get_object_terms($post->ID, 'people');
if(!empty($people_terms)){
  if(!is_wp_error( $people_terms )){
    echo '<ul>';
      foreach($people_terms as $term){
      echo '<li>'.$term->name.'</li>';
      }
    echo '</ul>';
  }
}

To display all the terms, regardless of the specific post, you can use the get_terms() function. Code similar to this lists the terms in a unordered list

<?php
$terms = get_terms("people");
 $count = count($terms);
 if ( $count > 0 ){
     echo "<ul>";
     foreach ( $terms as $term ) {
       echo "<li>" . $term->name . "</li>";
     }
     echo "</ul>";
 }
?>

Updating iOS 5 with the new over-the-air update function

Posted on: 10th November 2011 No Comments

Today, Apple released the first iOS 5 update, updating from 5.0 to 5.0.1, fixing the battery problem. And this was the first chance to use the new over-the-air update, meaning updating the iOS without plugging it into a computer. So how does it work? Let me show you.

If you don’t get a pop-up telling you about the update, you can go look for it by choosing Settings -> General -> Software Update on your iOS device. Your device will perform the check, and show you the result. If it finds an update, just press Download and install, and the process is pretty self explanatory.

Updating iOS over-the-air

Starting updating iOS over-the-air

You must have over 50% left of your battery, or be plugged into a socket, to do the update,

Updating iOS over-the-air

Finishing updating iOS over-the-air

Unlike the previous updates, this update just sends you the updated parts, not everything as it used to do.

Worked like a charm.

When Photo Stream won’t sync

Posted on: 10th November 2011 3 Comments

So, today Photo Stream on my Mac decided that syncing was too much of a hassle. So it stopped. It was not the Photo Stream service itself that halted, as it synced between my iPhone and my iPad. It was just on the Mac that it was sleeping in.

And since this is a “just working” product, there are really no settings you can have a look at, to see if something is wrong.

So the answer, as it always is: Turn Photo Stream on and off under System Preferences -> Internet and Wireless -> iCloud. And that woke it up, and my missing photos turned up where I wanted them.

Missing iBooks covers after iOS 5.0 update

Posted on: 10th November 2011 No Comments

After I updated my iPad to iOS 5.0, the covers of most of my books in iBooks went missing. Don’t know why, but I know many had the same issue.

Missong covers in iBooks

Missing covers in iBooks

I didn’t look at it until tonight, and found the solution to be simple, but successful: Remove the books, and then add them again. Seems like overkill, but it is the only way I could make it work.

And how do you do it? Just pop into iTunes while connected, go to the Books tab, and un-tick the Sync Books box. iTunes will tell you it will delete the books from the iPad, and that’s OK for you.

Un-sync books in iTunes

Un-sync books in iTunes

And after the books are gone from the iPad, tick the box again, and the books will be transferred back. It takes a couple of minutes before it registered all the covers, but I have all mine now.

Udating iBooks covers

Udating iBooks covers

And here are the good part: If you had created different collections iBooks, it will remember these, and sort your books for you. But they will not be in the same order.

Covers in iBooks

Covers in iBooks