Hello,

I have a taxonomy terms page that I have given a url-alias 'straling'. The url is allright now, but the same word 'straling' now appears on top of my page, which is very ugly. Taxonomy pages are no nodes, so how do I get rid of it? Is there for instance a way to refer to that page from my CSS and tell it 'do not display'? If so what is the syntax, if not, is there an alternative way?

Many thanks

Theo Richel

Comments

jount’s picture

Hello, Theo!

Title removal is simple and can be made in template.php. All you need is to call yourthemename_preprocess_page() function in your theme's template.php file:

function yourthemename_preprocess_page(&$vars) {
  //check if you are on the correct page first
  if(strpos($_SERVER['REQUEST_URI'], 'url-alias-of-your-page') !== FALSE) {
    unset($vars['title']); //$vars['title'] contains page title, $vars['head_title'] contains title for the <title> tag
  }
}

hope it helps :)

theorichel’s picture

Since at first I got the message that function themagrk_preprocess_page(&$vars) was already in use, I merged your work with that one. That produced the code below, but 'straling' (here with full url, but just 'straling' produces the same). When I run this, tehere are no errors, but the title remains, even after emtying of cache.

//check if you are on the correct page first
  if(strpos($_SERVER['REQUEST_URI'], 'http://www.groenerekenkamer.nl/straling') !== FALSE) {
    unset($vars['title']); //$vars['title'] contains page title, $vars['head_title'] contains title for the <title> tag
  }
 }
}
jount’s picture

you should use relative path here, like this:

if(strpos($_SERVER['REQUEST_URI'], 'straling') !== FALSE) { 
  // your title workaround goes here
}

but be careful if you have urls like "straling/*", in that case you should use preg_match function. For example:

//this condition below will work when you're on /straling page
//pages with urls like /straling/something-else will not pass this condition
if(preg_match('@straling$@', request_uri())) { 
  //your title workaround goes here
}
theorichel’s picture

I copy the whole block below. Clearing the cache makes no difference.

function  themagrk_preprocess_page(&$vars) {
  themagrk_removetab('Web Links', $vars);
  themagrk_removetab('My Web Links', $vars);
    themagrk_removetab('My newsletters', $vars);
  // add additional lines here to remove other tabs
    // Titles are ignored by content type when they are not desired in the design.
  $vars['original_title'] = $vars['title'];
  if (!empty($vars['node']) && in_array($vars['node']->type, array('storyzondertitel'))) {
    $vars['title'] = '';
	//check if you are on the correct page first
  if(strpos($_SERVER['REQUEST_URI'], 'straling') !== FALSE) {
    // your title workaround goes here
  }
 }
}
theorichel’s picture

The thing works when I put the desired code first position after function themagrk_preprocess_page. The other calls for this function seem unaffected. Wonderful!

skein’s picture

If you're using views to display the page you can just remove the title in the views UI.