[wp-hackers] Sidebar/Widget conditionnal tag?

Demetris Kikizas kikizas at gmail.com
Tue Jan 4 17:28:25 UTC 2011


On Tue, Jan 4, 2011 at 17:25, Olivier <autremonde75 at gmail.com> wrote:
> Thanks Demetris! Unfortunately, I had tried this before and it doesn't
> seem to work. The flag is still set while going through the widgets...

Just did a test with a simple filter and it works for me:

function uppercase_title_in_sidebar($o) {
    if (in_the_loop()) {
        return $o;
    } else {
        return strtoupper($o);
    }
}

add_filter('the_title', 'uppercase_title_in_sidebar');

(It turns post titles found in sidebars to all caps.)

Maybe your theme templates do something unusual with the loop?  What
theme are you using?

Cheers,

Demetris
http://op111.net/81/ › What is new in WordPress 3.1


More information about the wp-hackers mailing list