- This topic has 25 replies, 3 voices, and was last updated 1 year, 8 months ago by
Tom.
-
AuthorPosts
-
February 1, 2020 at 12:12 pm #1151596
Carlo
Hi,
the author page at the moment isnt too customizable, is it possible to create a page and use that as the author(s) page. Basically replacing the author’s archive with a custom page?
February 1, 2020 at 2:03 pm #1151650Leo
StaffCustomer SupportHi there,
GP doesn’t have anything built-in for this.
Perhaps an article like this would help?
https://www.wpbeginner.com/wp-themes/how-to-add-a-custom-author-profile-page-to-your-wordpress/Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 1, 2020 at 11:39 pm #1151825Carlo
Is it possible to completely replace it with a static page, like the example in Toms WP Show Posts: https://docs.wpshowposts.com/article/use-static-pages-as-category-archives/
February 2, 2020 at 10:52 am #1152285Tom
Lead DeveloperLead DeveloperYou could try this:
add_filter( 'author_link', function( $link, $author_id ) { if ( 1 === $author_id ) { return 'URL TO YOUR AUTHOR PAGE'; } if ( 2 === $author_id ) { return 'URL TO ANOTHER AUTHOR PAGE'; } return $link; }, 10, 2 );
Just adjust the author IDs to the actual IDs you’re targeting.
Hope this helps 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 4, 2020 at 12:20 am #1153681Carlo
Cheers Tom,
Got that working well, so in essence, this code overrides all the author links to whatever we set for each author.
if i manually lookup site.com/author/”authorname”/ then the archive is still there but i guess they wont find it. any way to disable it?
February 4, 2020 at 8:12 am #1154347Tom
Lead DeveloperLead DeveloperIf you’re using Yoast SEO, this should help: https://kb.yoast.com/kb/disable-enable-author-archives/
If not, this might help: https://wordpress.org/plugins/disable-author-archives/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 8, 2020 at 10:08 am #1159013Carlo
thanks Tom, hadn’t thought of looking at other plugins for disabling the author archive. I use SEOPress instead and i found the same diable feature.
Anyway got it all working now 🙂
thanksFebruary 8, 2020 at 8:48 pm #1159294Tom
Lead DeveloperLead DeveloperAwesome, no problem! 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 10, 2020 at 8:32 pm #1161286Dana
Hi GP Team,
I tried using the same info above to also override the default archive.php for author archive. However in my Elements I’m using the
{{post_author}}
tag and despite disabling the author archive page via Yoast, author links still point to //website.com/author/author-name but brings me to the root of the site if I click on the author since I disabled author archives. I’m using Example 2 from the documentation for my Element.How would I go about getting the
{{post_author}}
tag to point to my custom author pages? Or should it be automatically going to my custom author pages with the filter above? Perhaps using an actual author.php file would be better in this case?Thanks.
February 11, 2020 at 9:11 am #1162109Tom
Lead DeveloperLead DeveloperJust to confirm, are you using this filter?: https://generatepress.com/forums/topic/custom-autor-page/#post-1152285
Have you updated the author ID? That filter should work for the Elements post author as well.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 11, 2020 at 7:36 pm #1162436Dana
Thanks for the reply Tom.
Correct. I am using https://generatepress.com/forums/topic/custom-autor-page/#post-1152285.
I think I’m just not understanding the author ID piece. From my dashboard I go to Users and then hover over the number in the Posts column of the Users table. This shows me //mywebsite.com/wp-admin/edit.php?author=1. I only have two authors so they are 1 and 2 respectively.
I’m reading …
if ( 1 === $author_id )
… with the number 1 being the author ID. Is this correct?February 12, 2020 at 6:18 am #1162834David
StaffCustomer SupportI’m reading …if ( 1 === $author_id )… with the number 1 being the author ID. Is this correct?
That is correct
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 12, 2020 at 10:10 am #1163279Dana
Thanks David. Interesting. Then my author ID’s are correct in this case yet hovering over the author name in a post which has an Element Header still shows //mywebsite.com/author/author-name. My posts are created in Elementor but I do not think that would mess with my Element Header, would it?
I did a random search on my site and the author name in the search results shows //mywebsite.com/author-name which is the expected outcome.
Seems like the filter is not liking the Element Header
{{post_author}}
tag? I’m using the code from the example here for my Element Header.February 12, 2020 at 5:24 pm #1163591Tom
Lead DeveloperLead DeveloperI just double-checked our code – we’re using the core function which the
author_link
filter applies to.Wonder what this could be.. maybe the action order is off..
It’s a shot in the dark, but try this:
add_action( 'wp', function() { add_filter( 'author_link', function( $link, $author_id ) { if ( 1 === $author_id ) { return 'URL TO YOUR AUTHOR PAGE'; } if ( 2 === $author_id ) { return 'URL TO ANOTHER AUTHOR PAGE'; } return $link; }, 10, 2 ); }, 50 );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 16, 2020 at 8:32 pm #1167591Dana
Thanks Tom. I gave that a shot but no go.
Any other ideas?
Maybe creating custom author pages would be a better route in this case?
-
AuthorPosts
- You must be logged in to reply to this topic.