【问题标题】:Remove username from recent content block Drupal 7从最近的内容块中删除用户名 Drupal 7
【发布时间】:2011-06-04 09:31:13
【问题描述】:

我正在使用 Drupal 7 和 Garland 主题。最近内容块当前显示最近修改的节点的标题名称以及相应用户的用户名。

我想从显示中删除用户名。 我不会接受使用 Views 模块的解决方案。

非常感谢!

【问题讨论】:

    标签: css drupal drupal-7


    【解决方案1】:

    您需要修改 Garland 主题,使其不会将用户名显示为该块的一部分。您可以直接在 Garland 主题中执行此操作,方法是将以下代码添加到 /themes/garland/template.php 的末尾:

    /**
     * Returns HTML for a recent node to be displayed in the recent content block.
     *
     * @param $variables
     *   An associative array containing:
     *   - node: A node object.
     *
     * @ingroup themeable
     */
    function garland_node_recent_content($variables) {
      $node = $variables['node'];
    
      $output = '<div class="node-title">';
      $output .= l($node->title, 'node/' . $node->nid);
      $output .= theme('mark', array('type' => node_mark($node->nid, $node->changed)));
      $output .= '</div>';
    
      return $output;
    }
    

    只需保存然后清除所有缓存(在管理|性能下)。

    但是,我建议您创建一个 Garland 主题的副本并在 /sites/all/themes/ 下创建一个新主题。然后你在那里修改template.php。因此,如果您升级您的更改,您不会因为 Garland 是 Drupal 核心的一部分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-04
      • 2012-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多