title: how do I set the page title for a template wordpress page?
body: <p>I'm fairly new to wp. I have found other people using this filter code at the top of the template to set the title for that page:</p>
  
  <pre><code>function assignPageTitle(){
    return "Custome Title";
  }
  add_filter('wp_title', 'assignPageTitle');
  </code></pre>
  
  <p>But I need to pass my <code>assignPageTitle</code> function 1 parameter from the query_vars <code>$wp_query-&gt;query_vars['claim_id']</code>, And my <code>getTitle</code> function builds the title based on the id of the content. Something like this i thought, but it does not work. <code>$wp_query-&gt;query_vars['claim_id']</code> is <code>null</code> when called inside this function:</p>
  
  <pre><code>function assignPageTitle(){
    return getTitle($wp_query-&gt;query_vars['claim_id']);
  }
  add_filter('wp_title', 'assignPageTitle'); 
  </code></pre>
  
  <p>I see some people using parameters with these filters something like this:</p>
  
  <pre><code>function assignPageTitle($claim_id){
    return getTitle($claim_id);
  }
  add_filter('wp_title', 'assignPageTitle',10,1); 
  </code></pre>
  
  <p>But this is where I am getting extremely confused. WHERE is it that I can pass the claim_id variable to <code>assignPageTitle($claim_id)</code> function? Putting <code>assignPageTitle(312)</code> under that filter code does nothing, and <code>wp_title(234)</code> just echoes a title like string wherever I put it on the template page.</p>
  
  <p>I also tried just editing the <strong>functions.php</strong> where the title is made:</p>
  
  <pre><code>&lt;title&gt;&lt;?php getTitle($wp_query-&gt;query_vars['claim_id']);?&gt;&lt;/title&gt;
  </code></pre>
  
  <p>But <code>$wp_query-&gt;query_vars['claim_id']</code> is <code>null</code> when called in the functions. </p>
  
  <p>I must be totally not understanding these filters, how can i get the title to be set to the output of <code>getTitle($wp_query-&gt;query_vars['claim_id'])</code> ?</p>