1

I need help,need to pass data from page,to widget function,I need to pass author id to widget,any idea? Tnx

1

It should be possible to read the global $post variable in your widget function. This will contain all information about the post (or page) displayed on the current page.

  • Ok,but in that way,if we are not on page where we dont have global $post var,how to find id of author,for example if we are on archive page,where we list all post from one category? – user1147 Oct 27 '10 at 10:37
  • @user1147: The author of which post do you want? On an archive page you can still rewind the loop and go over every displayed post to collect the authors. If you want one specific post, you can use get_post() to query for it. – Jan Fabry Oct 27 '10 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.