Skip Navigation

[Resolved] Filtering results by post author

This support ticket is created 4 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by adamL-11 4 years, 7 months ago.

Assisted by: Waqar.

Author
Posts
#1886197

Tell us what you are trying to do?
I wanted to make a link or button on each post page to link to a page listing the Author's other posts. I even tried making a view on the post itself to list their other posts, but there doesn't seem to be an option for post author. Just page author.
Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/filtering-views-query-by-author/?utm_source=plugin&utm_medium=gui&utm_campaign=views
Is there a similar example that we can see?

What is the link to your site?

#1886653
author-post-link-example.png

Hi,

Thank you for contacting us and I'd be happy to assist.

To show a link to the current post's author archive, you can add a "Single Field" block and select it to show the "Author Posts Link".
( screenshot: author-post-link-example.png )

Note: If you're not using the blocks editor, you can use the shortcode "wpv-post-author".
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-author )

Example:


[wpv-post-author format="link"]

As for using a view to show the current post author's other posts (on the single post page), you'll select the option "Post author is the author of the page where this View is shown".
( https://toolset.com/documentation/user-guides/views/filtering-views-query-by-author/#post-author-is-the-author-of-the-page-where-this-view-is-shown )

In this context "page" refers to the current "single post page".

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1887475

wpv-post-author format="link" will just create a link to a blank page. Could a php be missing from my theme? I had a similar issue with the archives.php.
I try to make a toolset archive with a "standard archive" of "author archive", but it creates a link loop. every link listed is of the standard post on the site and clicking on them links back to the list of authors. I am not using standard posts, so this has been confusing me for a while and the title links don't even link to the post, it links back to the author archive template.

"Post author is the author of the page where this View is shown" on the post page did work, but I would still like to know what I can do about the link.

#1888441

Thanks for the update.

To troubleshoot this further, I'll need to see how the archives are set up on your website's backend.

Can you please share temporary admin login details along with the link to a page where this post author archive link can be seen?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

#1889883

I have read this issue in another support post but the answer was omitted. The problem was that the default author archive does not include custom posts and therefore toolset's author archive can not include custom posts.
I had to add a little bit of code to the functions.php in the wp-includes folder. Where people, group, event and service are my custom post types that I needed to add to post (which is the default post type)

	
function post_types_author_archives($query) {
 
	// Add  post type to author archives
	// Add your own Post types in single quotes before 'post'
	if ( $query->is_author ) {
		$query->set( 'post_type', array('people','groups','event','service','post') );
		// Remove the action after it's run
		remove_action( 'pre_get_posts', 'post_types_author_archives' );
	}
}
add_action( 'pre_get_posts', 'post_types_author_archives' );