Hello,

I've created various taxonomy terms for my blog entries. On those taxonomy pages, the blog entries that fall into that category show up -- which is great! The thing is, I want to get rid of the link that says "So-and-so's Blog" because that will just bring the user to the main blog which has got all the topics mixed up.

I heard about using hooks, and added the following code to my theme's template.php file:

function blog_link_alter(&$links, $node) {
foreach ($links AS $module => $link) {
if (strstr($module, 'blog_usernames_blog')) {
// empty out the link
$links[$module]['href'] = str_replace('blog_usernames_blog', '', $link['href']);
}
}
}

But it's not working. Please know that I'm pretty new to drupal and only moderately versed in php -- so I may ask for elaboration on your answers!

Thanks!
Beth

Comments

bitsyboo’s picture

Okay, I just went into the blog module itself and modified the blog_link hook. Probably a bad idea but it did what I wanted.

joachim’s picture

Hooks don't go in template, they go in modules.

To use hook_link_alter, create a module that just to hold that hook. The handbook explains what you need to make a module (just the module file and an info file).

It's probably best not to change core modules, as you'll lose the change when you update.

bitsyboo’s picture

Ha, I'd update, except Fantastico didn't seem to include the update.php file in my installation!

Good point though. Thanks!