How to create global pattern for terms title (not page title)? I'm trying to override the titles of taxonomy terms. Not the page title, the heading tag at the top of the taxonomy term page.

I found the Taxonomy Title module that created to control the title individually for every term.


  This module was designed to update the heading tag at the top of the
  taxonomy term page. The contents of this H1 (or sometimes H2) tag are
  extremely important for SEO (Search Engine Optimization).


This module seems good but it doesn't give us the option to set global patterns for taxonomy terms, we can only set titles individually for each term.

There is an issue opened about global pattern but there is no solution presented.


How can I create global patterns for taxonomy terms?


Example (from the issue):

A real estate company is listing its offerings and each property is tagged with location.

Then for the location vocabulary I could set a pattern "Properties in the [term] area".

Note 1: the Page Title module doesn't give us the opportunity I wanted but we can set global patterns for page title with that module.

Note 2: It's possible to set global title pattern with the Automatic Nodetitles module for only nodes. I wonder if it is possible to use this kind of module (or piece of code) to set global pattern for taxonomy terms.
As I said above (in the question), there isn't any module for overriding the H1 heading (title).

I could do this as explained here:


I copied (and pasted) the page.tpl.php into my theme folder.
I renamed it page--vocabulary--[machine name].tpl.php

(for me it was: page--vocabulary--cities.tpl.php
Opened the template.php file in the theme folder. And added this function:


(I've already had the preprocess_page function in the template.php file and I didn't add the preprocess_page function again, I added the if (arg(0) ... part. Don't forget to change the THEME to your theme name.)

function THEME_preprocess_page(&amp;$vars) {
  if (arg(0) == 'taxonomy' &amp;&amp; arg(1) == 'term' &amp;&amp; is_numeric(arg(2))) {
    $term = taxonomy_term_load(arg(2));
    $vars['theme_hook_suggestions'][] = 'page__vocabulary__' . $term-&gt;vocabulary_machine_name;
  }
}





Opened the page--vocabulary--cities.tpl.php file and found that line:


(Your theme's template.php file may be different but the main structure is the same.)

&lt;?php if ($title): ?&gt;&lt;h1 class="title" id="page-title"&gt;&lt;?php print $title; ?&gt; CUSTOM TEXT&lt;/h1&gt; &lt;?php endif; ?&gt;





Cleared all caches.



Done! It works :)

(Note: This solution is per vocabulary solution and if you've got a large amount of vocabularies this solution maybe not very for you.)