Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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