author.php will only pull in posts where the author is a co-author…
Can you use pastebin to share the code you’re looking at and/or link to example?
Details:
The author is listed as a coauthor. Basically, this is a real estate website where co-authors are used as the listing agents and their listings are pulled into author.php. However, listings with the tag “sold” are also pulled into author.php using a custom query… this is where the conflict happens.
Example pages:
http://www.theagencyre.com/for-sale/8744-dorrington-ave-west-hollywood/ – On the left of the page are the two “authors” (agents), both shown as associated with this custom post type using CAP. Note the “SOLD” tag below the main nav in the top right, this indicates the post has_tag(‘sold’).
http://www.theagencyre.com/agent/tori-barnao/ – here is the author.php page for the second agent. At the bottom you can see there is only one property with the “sold” tag over the image, but it is not the example property, just the only one on which he is listed first. It looks like because he’s listed second in CAP, the query is not pulling in the example property.
Pastebin for relevant query from author.php: http://pastebin.com/3YXtXDax
Thanks for any help, much appreciated.
Oh, I see what’s going on.
Basically, the problem is that Jeeb O’Reilly is saved as the post_author in this case, so when you query for all posts by Tori Barnao the listing doesn’t come up.
Co-authors Plus actually uses a taxonomy to store author associations with content. You should be able to modify your query to search for all posts with $curauth->user_login
as the term slug under the ‘author’ taxonomy.
Here’s information on how you can do a taxonomy query.
Thanks for the quick response. Took a look at that link and some things work and some don’t. The “simple” taxonomy query does not work in conjunction with the custom post type, the query just ignores the taxonomy/term parameter and just displays everything from that post type. So, you have to use the “complex” argument (the array of arrays) to get it to work.
Here’s what ended working for me if you need this in the future:
$args = array(
'post_type' => 'sale',
'tax_query' => array(
array(
'taxonomy' => 'author',
'field' => 'slug',
'terms' => $curauth->user_login
)
),
'posts_per_page' => '3',
'has_tag' => 'sold'
);
Again, thanks for the help. Great plugin.
Hoping maybe you’re still monitoring this topic, this question relates directly to the earlier issue…
The listing page showing the agent/author to the left:
http://www.theagencyre.com/for-sale/34545-scenic-dr-dana-point/
That agent/author page doesn’t show the property even though it’s assigned to that agent/author (it would appear first, before the other listings – the listings showing are just generic listings under every agent/author):
http://www.theagencyre.com/agent/hana-cha/
here’s how it would ideally look:
http://www.theagencyre.com/agent/billy-rose/
thoughts?
here’s the pastebin: http://pastebin.com/K0TKPvUu