- This topic has 14 replies, 3 voices, and was last updated 7 months, 1 week ago by
Tom.
-
AuthorPosts
-
June 5, 2020 at 11:34 am #1315983
Linda
Hi Support,
I’ve been searching support for the answer to this and found this:
Custom Author Name
One more example is if you want to completely customize your author name and link:add_filter( 'generate_post_author_output', function( $output ) { return '<a href="MY CUSTOM URL">My Name</a>'; } );
My question is: where does this go? It’s PHP, correct? So can I add it via Code Snippets plugin?
Thanks,
Linda
June 5, 2020 at 2:22 pm #1316160Leo
StaffCustomer SupportHi there,
Yes that’s PHP so one of these methods:
Adding PHP: https://docs.generatepress.com/article/adding-php/Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 6, 2020 at 8:58 am #1316990Linda
Thanks, Leo. I recall that article link from another time you helped me out. I’ll use the Code Snippet for now.
Stay safe,
Linda
June 6, 2020 at 4:16 pm #1317312Leo
StaffCustomer SupportNo problem ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 10, 2020 at 12:44 pm #1322631Linda
Well,phooey, Leo. It didn’t work.
Here’s what I’m trying to do: link guest bloggers’ names to their web sites instead of to ours, as now happens.
Here’s what I did: created a new Code Snippet and pasted the PHP below into it. I made one slight modification in line 2 due to error message:
`add_filter( โgenerate_post_author_outputโ, function( $output ) {
return โMy Nameโ;
} );`
I deleted the space in My Name since it returned a syntax error with the space (error marked with a wiggly red line which disappeared when I removed space).Once saved, the name link still reverts to our site. Did my modification cause this? Or is the PHP I found not the right one? Or did I insert it incorrectly? Or…??
A second question: the author name doesn’t appear on the edit blog page so I’m not sure how I would add the correct link anyway! Is there a totally different way to fix this issue?
Hope this all makes sense, Leo.
Linda
June 10, 2020 at 2:15 pm #1322732Leo
StaffCustomer SupportI wonder if David’s solution here would work better?
https://generatepress.com/forums/topic/change-author-link-in-blog-posts/#post-850163Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 12, 2020 at 12:19 pm #1325497Linda
Positive suggestion, Leo. I did try David’s plugin. From all I read about it, however, I don’t think it will do what I want. It seems to refer to the role of a user, i.e., admin, author, editor…
What I’m trying to do is change link from its default:
https://mygoforthegreen.com/author/author-name/to something that will take a viewer to the author’s website: https://authorwebsite.com
I don’t think I can replace “author-name” with the author’s website URL in an author slug. Or can I?
None of the research I’ve been doing seems to give me a way to do this which is why I keep bugging you!
Do you have anything else I can try? I’m not sure how else to handle links to guest bloggers’ sites. There has to be a way and I’m just not getting it.
Thanks,
Linda
PS If there’s a way to stop author name from being automatically generated on the guest blogs, I could just type it in on the edit post page and add a hyperlink in the usual way.
June 12, 2020 at 4:56 pm #1325713Tom
Lead DeveloperLead DeveloperHi Linda,
How many guest authors do you typically have? Are there still authors (like yourself) where you want to keep the current URL structure?
Let me know ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 13, 2020 at 9:08 am #1326516Linda
Hi Tom,
Trust you and your family are coping well with the “situation” we’re all in!
90% of posts are currently written by my business partner or myself.
That said, I’m pretty sure the current 10% guest author number will increase over time.
Re. current author structure a question: not quite sure why current author name default is what it is, i.e., links author to our home page. Anyone who reads the blog is already on our site. Does it make sense to remove current author structure and just add author manually each time with its preferred URL link, as I mentioned earlier?
Or am I missing something here that requires default structure to be maintained?
Hope this makes sense!
Linda
June 13, 2020 at 4:12 pm #1326826Tom
Lead DeveloperLead DeveloperThe current structure should link to the author archive for that specific author.
You could disable the default link and manually add one to the content.
Another option is to create a custom field in the “Users” area (using something like Advanced Custom Fields) where you can give each user a unique URL. Then we could filter the default output to use that URL if it exists.
Let me know if you need help with the second option ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 14, 2020 at 10:36 am #1327622Linda
Thanks, Tom.
The current structure should link to the author archive for that specific author.
Hmm. Both Peter’s (partner) and my author names redirect me to our homepage and not to either author archive. Is this anything to worry about? Regardless …
… to avoid taking up any more of your time, I think the simplest approach for now would be to disable the default link … as long as it won’t adversely affect SEO.
Then, I would add author names only to guest posts and add links to their sites at the end of their articles.
If this is valid technically and SEO-wise, could you please explain how to do this (or link me to an explanation). I did find this for OceanWP theme. Would it be the same for yours?
Go to Customize > Blog > Blog Entry โ find Meta option and click on the eye icon of the author elements.
Repeat it for the single post page โ Customize > Blog > Single PostsThank you so much for helping me through this … and on your weekend, too! ๐
Linda
June 14, 2020 at 4:35 pm #1327913Tom
Lead DeveloperLead DeveloperHi Linda,
Yes, you’d do the same in GP. You’ll find a display author option in Customize > Layout > Blog for archives and single posts.
We can also conditionally disable that with a PHP snippet if the author isn’t you or your partner. That way it would continue to display for both of you but wouldn’t display for the guest authors.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 15, 2020 at 12:14 pm #1329056Linda
Excellent, Tom. Since it doesn’t affect technical or SEO issues, I’ll disable it for now and see how that goes. I’m glad to know we can conditionally disable the default with a PHP snippet later if disabling doesn’t work out for us.
I also appreciate the confirmation “how to” you provided for GP and reminder to apply it in both archives and single posts. Will give this a try and let you know how it goes … or if I get stuck!
Once again, thank you for your help and, especially, for getting back to me on a Sunday, family day!
Stay safe,
Linda
June 15, 2020 at 1:35 pm #1329112Linda
UPDATE: it worked in Customize … and it was easy to do, following your directions. I think all the research I’d done before coming to GP had me convinced fixing this was a hugely technical issue so I managed to totally confuse myself. Thanks for straightening me out! ๐
Linda
June 15, 2020 at 2:33 pm #1329166Tom
Lead DeveloperLead DeveloperAwesome, glad it’s all working as needed. Thanks for letting me know ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.