Skip Navigation

[Resolved] information disappears when adding query filters to author archive

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to display author information on author archive created using custom search view archive with Layouts

Solution:
You need to add custom shortcode to your current theme's functions.php file in order to get author ID or current author archive.

You can find proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/information-disappears-when-adding-query-filters-to-author-archive/#post-620176

Relevant Documentation:

This support ticket is created 6 years, 9 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Author
Posts
#619006
Screen Shot 2018-02-23 at 10.18.56.png
Screen Shot 2018-02-23 at 10.19.58.png

Hi,

In a previous thread, I had some issues getting the custom search to work on an author archive, I've got the custom search working but it had a negative effect on the author archive.

See the previous thread here: https://toolset.com/forums/topic/ad-custom-search-to-author-page/

Now normally the author archive looks like this: Screen Shot 2018-02-23 at 10.19.58.png

There is a logo and custom fields displayed at the top of the page.

However, once I add the query filter for the custom search that information no longer displays, see: Screen Shot 2018-02-23 at 10.18.56.png

The thread on how I got that information at the top to display can be found here: https://toolset.com/forums/topic/need-more-help-with-adding-content-to-author-archive/

#619646

Hi Minesh,

I did some more troubleshooting but still no luck.

Have you had a chance to have a look at my issue yet?

#619681

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Ok - I checked and I would like to know here - the information at top is you want to display those information related to the current displayed author - correct?

#619789

That's correct yes.

The information at the top is related to that specific author. Each author on the site will have similar on their respective pages.

#620002

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately the FTP access details you sent to me in previous ticket is not working now. Could you please send me working FTP access details.

I have set the next reply to private which means only you and I have access to it.

#620176

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added following code to your current theme's functions.php file - to get the ID current author archive we are displaying:

function func_get_author_object_id( $atts ) {
		
		$x = explode("/",$_SERVER['REQUEST_URI']);
		
		$custom_user = get_user_by( 'slug', $x[count($x)-2]);
		return $custom_user->ID;
    
}

add_shortcode( 'get_author_object_id', 'func_get_author_object_id' );

And created following view:
=> hidden link

And in your layout called the view as:

[wpv-view name="author-info-view" users="[get_author_object_id]"]

You can format the output within view as per your requirement. I can see now its displaying the correct results.

#620241

Hi Minesh,

Firstly thank you very much for all your help so far, it really is appreciated.

I just tried to check the website but got an error, when I checked the theme folder I noticed the functions.php file is not there.

#620329

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I can see that all working fine here:
=> hidden link

Could you please confirm?

#620344

Hi Minesh,

Once again thank you very very much.

I added the rest of the query filters and tested the search, everything is working fine now.

Greatly appreciate your help.