-1

I want to remove the author name from every post. O am using a website in wordpress.org. and I'm using tweenty fourteen theme.

How to remove the author name?

Do I have to go to the Author template (author.php)?

And then will I edit here

    <?php
/**
 * The template for displaying Author archive pages
 *
 * @link http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Fourteen
 * @since Twenty Fourteen 1.0
 */

get_header(); ?>

    <section id="primary" class="content-area">
        <div id="content" class="site-content" role="main">

            <?php if ( have_posts() ) : ?>

            <header class="archive-header">
                <h1 class="archive-title">
                    <?php
                        /*
                         * Queue the first post, that way we know what author
                         * we're dealing with (if that is the case).
                         *
                         * We reset this later so we can run the loop properly
                         * with a call to rewind_posts().
                         */
                        the_post();

                        printf( __( 'All posts by %s', 'twentyfourteen' ), get_the_author() );
                    ?>
                </h1>
                <?php if ( get_the_author_meta( 'description' ) ) : ?>
                <div class="author-description"><?php the_author_meta( 'description' ); ?></div>
                <?php endif; ?>
            </header><!-- .archive-header -->

            <?php
                    /*
                     * Since we called the_post() above, we need to rewind
                     * the loop back to the beginning that way we can run
                     * the loop properly, in full.
                     */
                    rewind_posts();

                    // Start the Loop.
                    while ( have_posts() ) : the_post();

                        /*
                         * Include the post format-specific template for the content. If you want to
                         * use this in a child theme, then include a file called called content-___.php
                         * (where ___ is the post format) and that will be used instead.
                         */
                        get_template_part( 'content', get_post_format() );

                    endwhile;
                    // Previous/next page navigation.
                    twentyfourteen_paging_nav();

                else :
                    // If no content, include the "No posts found" template.
                    get_template_part( 'content', 'none' );

                endif;
            ?>

        </div><!-- #content -->
    </section><!-- #primary -->

<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

enter image description here I don't want the author name mentioned in the picture

7
  • where's the rest of the code?
    – GhostToast
    Jan 29, 2014 at 16:13
  • From single post meta? Jan 29, 2014 at 16:18
  • It is the author template author.php
    – user44691
    Jan 29, 2014 at 16:22
  • Can you post a link to your site and tell us exactly where the author name that you want to remove is? If not, take a screen shot and add a red circle to it, then update your question.
    – David Gard
    Jan 29, 2014 at 16:24
  • Also, I'd suggest looking in to Child Themes.
    – David Gard
    Jan 29, 2014 at 16:27

2 Answers 2

2

First you need to have a child theme.

Add this to your style.css of your child theme

.entry-meta .byline { display: none; }

This should remove only the author from the post.

Here's a bit more information on customizing twenty fourteen theme in wordpress: http://techdwarf.com/customize-twenty-fourteen-theme-wordpress

1

First, rather than directly editing a template from the twentyfourteen theme, I'd recommend using a Child Theme. These are incredibly simple to implement and it means that your changes will be preserved should WP update the theme.

Now, assuming that you mean the Author name in a single post, the file that you need to edit is content.php. On lines 33-34, delete the following -

if ( 'post' == get_post_type() )
    twentyfourteen_posted_on();

Note - this will also remove the date, but you can easilly add that back in if you so choose.

Update

I've just noticed that the offending function is actually pluggable (I.e. you can overwrite it). If you still require the date, you can add this to your functions.php file (hopefully you're now using a Child Theme).

If you do this, you must ensure that the code above is still included in content.php -

function twentyfourteen_posted_on() {
    if ( is_sticky() && is_home() && ! is_paged() ) {
        echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>';
    }

    // Set up and print post meta information.
    printf( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span>',
        esc_url( get_permalink() ),
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date() )
    );
}
4
  • I have not found it, can you please mark the code in my question.
    – user44691
    Jan 29, 2014 at 16:49
  • It's not in your question. In that, you reference author.php, but this code is in content.php. Anyway, I'd recommend using the solution from the Update on my answer, as this will ensure the author name is removed site-wide.
    – David Gard
    Jan 29, 2014 at 17:06
  • Before updating the css, i need then a Child Theme. Which editor is good to write? can you give me some hints. I'm neophyte in css and php.
    – user44691
    Jan 29, 2014 at 17:11
  • I use Notepadd++ or Total Edit. Both are free and offer some good features. And you don't need to update any CSS, you need to add PHP (the function in my answer). Child Themes are really outside of the scope of this question (I.e. those that know best will never see it), so if you still require help after following the instructions in the docs (here), start a new, targeted, question.
    – David Gard
    Jan 30, 2014 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.