I am using the Views plugin to create the author archives on Echoes and Dust.
It has been working fine, but following a recent update the view is pulling through information for the wrong author.
This is an example of an author page: hidden link
It is correctly pulling through Geoff's posts, however it is showing the profile image, name and twitter/website urls for Dan Salter. All of the author pages are doing this, and they are all showing Dan's information.
This is the code I am using in the author archive:
[wpv-layout-start]
<div class="author-detail clearfix">
[types usermeta='profile-image' size='medium' align='left' resize='proportional' user_is_author='true'][/types]
<h2>[types usermeta='name' user_is_author='true'][/types]</h2>
<h4 class="author-socials"> [wpv-conditional if="('[types usermeta='author-twitter' output='raw'][/types]' ne ' ')" ][types usermeta='author-twitter' title='twitter' target='_blank' user_is_author='true'][/types][/wpv-conditional][wpv-conditional if="('[types usermeta='author-instagram' output='raw'][/types]' ne ' ')" ][types usermeta='author-instagram' title='instagram' target='_blank' user_is_author='true'][/types][/wpv-conditional][wpv-conditional if="('[types usermeta='author-website' output='raw'][/types]' ne ' ')" ][types usermeta='author-website' title='website' target='_blank' user_is_author='true'][/types][/wpv-conditional]</h4>
<p> [types usermeta='author-bio' user_is_author='true'][/types]</p>
</div>
[wpv-items-found]
<h2 class="articles-by-header">Articles by [types usermeta='name' user_is_author='true'][/types]</h2>
<!-- wpv-loop-start -->
<wpv-loop>
<div class="post-in-list">
<a class="post-featured-image" href="[wpv-post-url]">[wpv-post-featured-image size='thumbnail']</a>
<div class="post-title"><h4>[wpv-post-link]</h4></div>
<div class="post-meta">by [wpv-post-author format="link"] | [wpv-post-date]</div>
<div class="post-excerpt">[wpv-post-excerpt]</div>
<div style="clear:both;"></div>
</div>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
It looks as though the author fields - which I have created as User Fields using Types - are displaying for the author of the page, rather than the author currently being displayed in the archive view. Is there anything I can do about this?
Many thanks
Hannah
Hi Hannah,
Thank you for contacting us and I'll be happy to assist.
I couldn't find any change in recent Toolset Views plugin's release, which would affect the existing author archive views.
But to get the information from the user, whose author archive page is being viewed, you'll need a custom shortcode to get that author's ID, as suggested in this reply:
https://toolset.com/forums/topic/author-page-single/#post-618800
Please include this custom shortcode's snippet in theme's "functions.php" file and also go to Toolset > Settings > Frontend content and add "get_author_id_in_archive" in the "Third-party shortcode arguments" input field.
After that, you can update your view's [types] shortcodes as shown in this example:
Existing:
[types usermeta='profile-image' size='medium' align='left' resize='proportional' user_is_author='true'][/types]
Updated:
[types usermeta='profile-image' size='medium' align='left' resize='proportional' user_id='[get_author_id_in_archive]'][/types]
I hope this helps.
regards,
Waqar
This worked perfectly, thanks so much for your help!