Yes, the call must be $theme->function_name() not MyTheme->function_name()
> There is also one other complication is that I have a few functions
> which are common building blocks for other custom theme functions,
> e.g. formatting output for time difference between 2 dates etc...
> what's best approach to change them?
Say you want a template function that lets you call this to show how
old a post is in days:
echo $theme->age($post);
You would implement a function in your theme class like this:
function filter_theme_call_age( $output, $theme, $post ) {
return $this->date_diff_days($post->pubdate, time());
}
Note that date_diff_days() is also a function you would include in
your theme. This function would not be exposed via the theme object;
in other words, this wouldn't work:
echo $theme->date_diff_days()
Unless you also included:
function filter_theme_call_date_diff_days( $output, $theme, $date1, $date2) {
return $this->date_dif_days( $date1, $date2 );
}
Note that I've completely left the implementation of the
date_diff_days() function to you. ;)
> I suggest there's some sort of announcement in user group for things
> like this to warn user before they hit return to 'svn update'. If I
> have not omitted this I would have tried/tested this in an development
> environement before updating.
Well, I was talking about this today, and it's my impression that:
1) We are still in kind of a pre-release mode, having not released a 1.0 yet.
2) The revision that includes this change is only available via SVN.
3) The commit logs include mention of this change.
I submit that it's reasonably fair to have done this without notice,
assuming that when 0.4 is released we'll make clear mention of this
change in the release notes.
> PS: funny enough after svn updating my theme broke and I saw one error
> message in a blank page. When I managed to fall back to the default
> K2 (removing the theme folder) and logged in there is no error message
> logged? What about the feature of falling back to the system
> defalut theme if custom theme has failed? This would be nice as
> everyone is experimenting here.
This could actually be a security risk. If your custom theme depends
on not displaying data that a core theme does display (for example, if
your theme omits posts with a certain tag from output if you are not a
registered user), then this could cause problems. So unfortunately, I
think you might have to live with this one. Still, you should be able
to get into the admin reasonably easy to change it manually if needed.
Owen