Html 从Drupal 7中提交的时间标签中删除“pubdate”属性
当前,当一个节点或评论被提交时,它会收到一条提交的文本,上面写着“用户于2015年1月4日星期三提交”—18:07 这方面的加价是:Html 从Drupal 7中提交的时间标签中删除“pubdate”属性,html,drupal-7,drupal-nodes,pubdate,Html,Drupal 7,Drupal Nodes,Pubdate,当前,当一个节点或评论被提交时,它会收到一条提交的文本,上面写着“用户于2015年1月4日星期三提交”—18:07 这方面的加价是: <span>Submitted by *user* on <time pubdate="pubdate" datetime="2015-04-01T18:07:34+0000">Wed, 04/01/2015 - 18:07</time></span> 我需要做的是从标记中删除pubdate属性,因为它在W3C验证
<span>Submitted by *user* on <time pubdate="pubdate" datetime="2015-04-01T18:07:34+0000">Wed, 04/01/2015 - 18:07</time></span>
我需要做的是从标记中删除pubdate属性,因为它在W3C验证中失败
我试图在template.php文件中添加以下代码,但没有成功
function ThemeName_preprocess_node(&$variables) {
$attributes['datetime'] = '<time'.drupal_attributes($attributes) .'>'.$variables['date'] . '</time>';
}
如何删除SubmittedBy标记中的pubdate属性 需要挂接到preprocess_节点以访问$submitted变量,如下所示:
function THEME-NAME_preprocess_node(&$variables, $hook) {
$variables['pubdate'] = '<time datetime="' . format_date($variables['node']->created, 'custom', 'c') . '">' . $variables['date'] . '</time>';
$variables['submitted'] = t('Submitted by !username on !datetime', array('!username' =>$variables['name'], '!datetime' => $variables['pubdate']));
}