Passing Jquery value to WordPress function

You have to use AJAX for that. What you have to do is:

  1. Create a JS script which sends an AJAX request to admin-ajax.php file:

<script>
 jQuery(".author-popup").on("click", function(){
  var id = jQuery(this).attr("id");
  jQuery.post("http://www.yourdomain.com/admin-ajax.php", {action: "my_author_box", id: id}, function(response){
   console.log("Response: " + response);
   //NOTE that 'action' MUST be the same as PHP function name you want to fire
   //you can do whatever you want here with your response
  });
 })
</script>
  1. Create new file e.x. myajax.php and include it to functions.php
  2. Now write a function you want to fire on click, e.x.:

function my_author_box(){
   $args = array(
    'author' => $_REQUEST['id'];
   );
   query_posts($args);
   die();
}
add_action( 'wp_ajax_my_author_box', 'my_author_box' );
add_action( 'wp_ajax_nopriv_my_author_box', 'my_author_box' );

That’s all. As I said note that actionhas to be the same as PHP function. If you want to have some response from your PHP function just echo it and this is what you will get as a response. If you’ll get 0 as a response it means that function you want to fire does not exists or you didn’t call die() at the end of your function. Should work