Implement hook_token_info and hook_tokens I am trying to create custom tokens, but my implementation doesn't work. 
I have implemented hook_token_info() and hook_tokens() like this in my .theme file for Drupal 7.

/**
* Implements hook_token_info().
*/
function THEMENAME_token_info() {
  $info = array();

  $info['types'] = array(
    'commerce-order:commerce-customer-billing' =&gt; array(
      'name' =&gt; t('Commerce Order Billing'),
      'description' =&gt; t('Global commerce order billing tokens'),
     ),
  );
  $info['tokens'] = array(
    'commerce-order:commerce-customer-billing' =&gt; array(
      'address-info' =&gt; array(
        'name' =&gt; t('Commerce address information'),
        'description' =&gt; t('Token for commerce address information'),
      ),
    ),
  );
  return $info;
}

/**
*
* Implements hook_tokens().
*/
function THEMENAME_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();

  if ($type == 'commerce-order:commerce-customer-billing') {
    foreach ($tokens as $name =&gt; $original) {
      switch ($name) {
      case 'address-info':
        $address_info = theme('nr_commerce_address_information', array('order' =&gt; $order));
        $replacements[$original] = $address_info;
        break;
      }
    }
  }
}


When I see the list of available tokens in the interface, my tokens does not show up. Why? Is there anything wrong in my code, or is the reason another one?
I found out. It was because I tried to implement hooks in my template rather than doing it in my module.