如何删除wordpress博客帖子上的作者姓名?

时间:2013-12-01 07:01:58

标签: wordpress wordpress-theming

我想从wordpress博客帖子中删除作者姓名。另外我不想删除作者名称becoz我在管理员端使用不同的作者名称。

4 个答案:

答案 0 :(得分:1)

WP v4.1.2 编辑content-single.php: Appearance->编辑器 - >内容-single.php中

<div class="entry-meta">
      <?php // twentyeleven_posted_on(); ?>
</div><!-- .entry-meta -->

评论中间线&#34; Twentyeleven_posted_on();&#34;像上面一样 帖子上的标题行说:由DUTH出版的DATE将不会显示

OR(少推荐,因为它影响范围更广) 的functions.php

COMMENTED LINE get_the_author()

function twentyeleven_posted_on() {
printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ),
    esc_url( get_permalink() ),
    esc_attr( get_the_time() ),
    esc_attr( get_the_date( 'c' ) ),
    esc_html( get_the_date() ),
    esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
       esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) )/*,
       get_the_author()*/
);

}

答案 1 :(得分:0)

  1. 通过ftp客户端或信息中心打开当前主题的single.php文件 - &gt;外观 - &gt;编辑
  2. 删除此代码:
    <span class="meta_author"><?php the_author(); ?></span>

  3. 希望这有帮助

答案 2 :(得分:0)

您可以评论/删除打印作者姓名的行。

<span class="meta_author"><?php the_author(); ?></span>

答案 3 :(得分:-1)

此处与WP的PHP代码相关的其他答案都是正确的,但也可以通过修改站点的CSS代码来完成。

在主样式表文件(style.css)下,您可以添加以下定义:

.blog-title-body SPAN {
    display:none !important;
}

这将特别隐藏帖子页面标题下的作者姓名和类别名称(帖子名称)。

例如,如果您只想删除类别名称,则可以输入以下定义:

.blog-title-body SPAN.cat-links {
    display:none !important;
}

注意: 一定要总是制作你修改的WP站点上每个内置文件的备份副本! 强烈建议定期进行整个站点备份,与修改和更改无关。

相关问题