[wp-hackers] Sidebar/Widget conditionnal tag?

Demetris Kikizas kikizas at gmail.com
Tue Jan 4 14:30:15 UTC 2011


On Tue, Jan 4, 2011 at 16:11, Olivier <autremonde75 at gmail.com> wrote:
> Hello,
>
> I need to filter widget content (for recent posts and recent
> comments). The issue I am facing is that the posts_where filter I am
> hooking on is applicable to the entire page queries (ie main content +
> sidebar).
>
> Please, is there a way to check if the query is performed from the
> sidebar or widget?
>
> Something like is_sidebar or is_widget would be nice to perform some
> tests in the filter hooks.
>
> Thanks!
You could try in_the_loop():

http://codex.wordpress.org/Function_Reference/in_the_loop

I have never used it myself, but I imagine that’s where I would start.

Cheers!

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


More information about the wp-hackers mailing list