[wp-hackers] how to check if current loop is main loop?

Konrad Karpieszuk kkarpieszuk at gmail.com
Sat May 28 18:59:18 UTC 2011


i want to add smth before first post on the page. i am thinking about
action hack loop_start, is it a right direction?

but i want to add this smth only in main loop. if it is homepage (or
any archive page), only before first post in main loop. if it is
single post, only before first post.

because theme developers usually put in theme many special loops (for
example loop for featured posts, used in some sliders etc) i want to
avoid to run my function in this special loop. how can i check (inside
the function) if loop_start is fired in context of main loop for
particular page?

(en) regards / (pl) pozdrawiam
Konrad Karpieszuk

More information about the wp-hackers mailing list