3

I want to hide the user's blog link that appears on blog entries e.g Anonymous's blog

How can I do this in node--blog.tpl.php?

I tried hide($content['author']); but that doesn't seem to work.

2
  • You could always just use display:none in a CSS and that way you don't have to mess with the php. – user19441 Jul 23 '13 at 2:09
  • That would be: .blog_usernames_blog { display: none !important; } For anyone who likes a dirty CSS hack. – WebWanderer Dec 10 '14 at 19:11
1

Try following code in your template.php file.

<?php
function phptemplate_links($links, $attributes = array()) {
    unset($links['blog_usernames_blog']);
    return theme_links($links, $attributes);
}
?>

To get the more information about all the links use following code:

<?php
function phptemplate_links($links, $attributes = array()) {
    print_r($links);
    return "Hello World";
}
?>
4

In your node--blog.tpl.php add unset ($content['links']['blog']['#links']); instead of hide($content['author']);

1

For remove user blog link you have to just comment or remove bellow line from your node--blog.tpl.php

<?php print render($content['links']); ?>

remove above line from your tpl file its remove user blog link perfectly

1
  • This would remove any link, not just the one the OP wants to remove. – apaderno May 13 '15 at 16:53
0

Taken from https://www.drupalcasts.com/blog/remove-users-blog-link-view-recent-blog-entries

function your_module_user_view_alter(&$build, $account, $display) {
  unset($build['summary']['blog']);
}
0

First create a node tpl file for your blog content (reference: https://drupal.stackexchange.com/a/42653/1254). Then inside that file, you can use the below code:

unset ($content['links']['blog']['#links']); // Unset the blog links
print render($content['links']); // Print the links

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.