Archived topic
Removing author link not working
7 replies · Started by marc on June 10, 2021
Hey guys,
I'm using a page hero element on all my pages (not post) with the preset tag: {{post_author}}
I tried using the following code you gave on many topics but it didn't work for me.
add_filter( 'generate_post_author_output', function() {
printf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <span class="fn n author-name" itemprop="name">%4$s</span></span>',
__( 'by','generatepress'),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ),
get_the_author() ) ),
esc_html( get_the_author() )
)
);
} );
Any idea why?
Thanks in advance
Marc
Hi there,
Any chance you can link us to the site in question?
You can use the private information field.
Let me know :)
Hi Leo,
I sent you the link in the private section.
Thanks for your help.
Marc
Can I make a recommendation of migrating the current page hero to a block page hero with dynamic content?
https://docs.generatepress.com/article/block-element-page-hero/
This template here is what you need:
https://www.screencast.com/t/kmoulqhkkV4
And the author name is already unlinked.
It's the new and better method so you will on longer need any PHP snippets.
Hey Leo,
I just did what you recommended however I cannot get rid of a white slash just before the updated date?
I selected the dynamic updated post date element with some text before saying "Updated on" but not matter what I do there's always a | right before the date. I made sure there's no are no border size set etc.
You can check it live on the private info area.
Thanks in advance,
Marc
That's added as the border left of the date headline block:
https://www.screencast.com/t/OkVIgQ6kcL6
Let me know if this helps :)
Hey Leo,
my bad, it wasn't the border size but I had some custom css that i didn't remove on .entry_date.
Thanks for your help! Marc
No problem :)