[Resolved] Issue with multiple author templates
So I managed to get co-authors working on the front/back end.
The issue I am having is on my site we have different profile templates for certain users. The original profile template works fine and one post will show up on both of the authors profile page. However this second version which is basically the same template is not showing the post on the co-authors page.
Is this something to do with the plugin not being able to work with different templates? Or is this theme related?
Thanks for reading.
To confirm — both of you are using the template tags in your theme?
However this second version which is basically the same template is not showing the post on the co-authors page.
This sounds like your theme uses an alternate query to generate the list of co-author posts. Can you share what’s inside of your author.php template using pastebin?
Thank you for your reply!
Yes, I have been adding the templates tags to any file that includes the_author_post_links but not to the template pages below as I was unsure about “the_author_meta” and other variances. We have two author templates, “author.php” and “author-template-gamer.php”. The code for each is pasted below.
Thank you so much for your assistance!
It looks like you have something like the following in both templates:
$args = array( 'view' => 'grid-small', 'cat' => $cat, 'link' => $link, 'author' => $user_id, 'post_type' => 'post', 'ignore_sticky_posts' => true, 'posts_per_page' => 3 ); dp_section_box($args);
This means the posts in those sections are limited to posts where post_author == $user_id. Because Co-Authors Plus stores byline information as taxonomy terms, I suspect that any post where the user is the second author is missing from your list.
I’m not sure how
dp_section_box()works, but you might be able to pass a tax query to it. If that’s the case, it would look something like this:
$args = array( 'view' => 'grid-small', 'cat' => $cat, 'link' => $link, 'tax_query' => array( array( 'taxonomy' => 'author', 'term' => get_queried_object()->user_login, 'field' => 'name', ) ), 'post_type' => 'post', 'ignore_sticky_posts' => true, 'posts_per_page' => 3 ); dp_section_box($args);
That worked!! I just had to change ‘term’ to ‘terms’ and it fixed the issue! Thank you so much!
First thanks so much for the assistance you’ve been a great help.
However we’re noticing a weird issue with the new code in place. Some thumbnails are not showing for the 4 categories we have on the gamer templates. The category thumbnails missing are not specific but random.
Using the older version of author-template-gamer fixes everything but then we’re back to where we were.
Is there anything you can see in the code you provided that is causing this issue?
As you can see each one has different thumbnails showing even though each category has content.
Thanks again for helping us with this issue.
- The topic ‘[Resolved] Issue with multiple author templates’ is closed to new replies.