Posting twice won’t get you a quicker response π
It looks like you’re modifying a function that’s used in multiple places. You might use a conditional like is_singular()
to do some part of the function on the single post page, and then default to the original code for the archive pages.
Hi Daniel.
Sorry for the duplicate post.
I hope you can give me more idea on how to use this is_singular() function because I’m not PHP savvy.
I know little debugging in PHP but not as deep as your knowledge.
Hope you can give me more option to use this co-author plug-in for my archive page.
To give more information, here are the links I want of the post I want to resolve.
This article has two authors: http://www.asiapathways-adbi.org/2012/03/reforming-asias-trade-in-services-will-help-human-development/
Below the article, you will notice that the authors bio is displayed. Once you click the archive link of the author, is display the archive articles but also the two bio’s. Would it be possible to display only one bio instead of two like the link below:
http://www.asiapathways-adbi.org/author/stephen-groff/
Any help is deeply appreciated.
Thank you very much.
The singular condition should go into the woo_author_box() function somewhat like this:
function woo_author_box() {
if ( is_singular() ) {
// Do the co-authors plus code in here
} else {
// Do whatever you had before
}
}
Based on the example you submitted, there’s already some use of is_singular() to conditionally display the profile link. It might be worth playing around with that.
Hi Daniel,
Thank you for your help.
Now, I able to display only one author for the archive page.
See the link below:
http://www.asiapathways-adbi.org/author/ben-shepherd/
Unfortunately, for the co-author archive page, it displays the first co-author bio instead of the second one:
http://www.asiapathways-adbi.org/author/gp-gloria-pasadilla/
Thank you very for your help in advance.
Here’s my code based on the previous post:
[78 lines of code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]
On the author.php template, you should use get_queried_object_id() to get the user ID for the author.
Post your code in pastebin and I’ll show you what you need to modify
Hi Daniel,
Thank you again for your help.
Here’s the code:
http://pastebin.com/embed_iframe.php?i=uZ92Tn6H
Sorry, can you pastebin the woo_author_box() function again?
Still needing help with this?
Hi Daniel,
Yes. I would really appreciate your help on this one.
Thanks.
Andy
Hi Daniel,
Any feedback?
Thanks for your help in advance.
Regards,
Andy
Sorry about the delay. Here’s what your new woo_author_box() should be:
https://gist.github.com/21788891d530b71ffbc3
Here’s the extent of the changes I made:
https://img.skitch.com/20120426-t57rmsnd5nshj3q5sx5s7tdeid.jpg
Basically, what I did was to add a check in the code that pulls the queried object ID instead of the post_author for the first post if you’re pulling the author box on an author archive. The original approach is problematic because it uses the post_author value which, when you’re using Co-Authors Plus, is the first author on the post.
Hi Daniel,
It works fine now.
I really appreciate your help on this one.
Regards,
Andy