1

My client would like me to replace the s's with just ' on the links and breadcrumbs of user blogs for user names that end in s.

For example, the breadcrumb and blog links for the user Joe would remain Joe's blog while the breadcrumb and links for user Chris would be Chris' blog (instead of Chris's blog).

I searched for this and although I did find a way to do this inversion 6 it doesn't seem to work in version 7.

How can I do this?

2 Answers 2

2

Adding to what Suresh commented about only modifying the breadcrumbs on a specific page, you could use either hook_preprocess_node or hook_preprocess_page to check the post type of your content and then apply the breadcrumb changes:

function example_preprocess_node(&$variables, $hook){
    if($variables['node']->type == 'YOUR_CONTENT_TYPE_HERE'){
        $bread = drupal_get_breadcrumb();
        $title = $bread[0];
        $lastCharacter = substr($title, -1);
        $variables['newcrumbs'] = $lastCharacter;
    }
}
2

I had similar, work to be done, in drupal 7.

So, what I did, is, I collected the breadcrumb title, like this,

$bread = drupal_get_breadcrumb();
$title = $bread[0];

$lastCharacter = substr($title, -1);

$lastCharacter gave whether the breadcrumb title ends in S or not. If it ended, then, I appended, (')at last otherwise, I apended, ('s).I did this by adding a function in template.php file. Also, you can do by making any module, or any other way you wish.

1
  • The above code worked for me, but I want to do that in every pages. Since, you want to only appear in blog page, then, you need to be careful in that section as well. Feb 18, 2013 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.