Remove author information from posts

After the most recent update to the Colorlib theme, I noticed that each post now has 'By (author name)" next to the title. Is there a way to remove it? I changed my username so it was difficult to guess for hackers, but now if you click on the author name next to the post, it is clearly visible in the URL.

Hey there,
I hope you’re doing well today

You’ll have to edit the theme files to do this.
Please note that modification of theme files are beyond the scope of support I’m able to provide, I can only point you in the right direction. If you have no experience editing code, I suggest you recruit the assistance of someone who does.

BEFORE MAKING ANY CHANGES TO CODE, PLEASE BACK UP YOUR WEBSITE.

The file you’ll need to edit the template-tags.php located activello > inc > template-tags.php

Around line 86-96
Which will look like this:

printf( '<span class="posted-on">' . __( 'Posted on ', 'activello' ) . 
				sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
					esc_url( get_permalink() ),
					$time_string
				)
			);
	}

Will be replaced by this:

printf( '<span class="posted-on">' . __( 'Posted on ', 'activello' ) . 
				sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
					esc_url( get_permalink() ),
					$time_string
				)
			);
	}

As an alternative you can use the following CSS to make the author name non-clickable.
This doesn’t hid the URL in the inspect tool.

span.author.vcard {
pointer-events: none !important;
}

Best Regards,
Support

Thanks for the quick response. The two bits of code that you shared look the same to me - is that right? Maybe I’m missing something?

Hey there,

Thank you for pointing that out, and I apoloigzie.

Here’s the code you need to replace.

		printf( '<span class="posted-on">' . __( 'Posted on', 'activello' ) . ' %1$s</span>' . __( 'by', 'activello' ) . ' %2$s',
				sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
					esc_url( get_permalink() ),
					$time_string
				),
				sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
					esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
					esc_html( get_the_author() )
				)
			);
	}

Best regards,
Support.

Thank you. Just to be clear, I see this code in the CSS:

		printf( '&lt;span class="posted-on"&gt;' . __( 'Posted on', 'activello' ) . ' %1$s&lt;/span&gt;' . __( 'by', 'activello' ) . ' %2$s',
			sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
				esc_url( get_permalink() ),
				$time_string
			),
			sprintf( '&lt;span class="author vcard"&gt;<a href="%1$s">%2$s</a>&lt;/span&gt;',
				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
				esc_html( get_the_author() )

And I am replacing it with:

printf( ‘<span class=“posted-on”>’ . __( 'Posted on ', ‘activello’ ) .
sprintf( ‘%2$s’,
esc_url( get_permalink() ),
$time_string
)
);
So I’m just removing the second bit of code about the author vcard - is that correct?

Just to be clear, I see this code in the CSS

In the CSS?

That is PHP code and not CSS code.

Where are you editing it?

Sorry for the confusion - I meant PHP. I’m editing it using the Editor in Wordpress. I’ve added the CSS code to make the author un-clickable for now, but I just wanted to confirm I’d understood correctly what needs to be edited in the PHP code.

Alternatively you can hide it by adding the following CSS code in the Custom CSS option of your theme on the below path.

Admin Area -> Appearance -> Customize -> Additional CSS

.entry-meta {
    font-size: 0;
}

.entry-meta .posted-on {
    font-size: 14px;
}

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

That’s worked - thanks for all your help!

You are most welcome here :slight_smile: