Forums › Forums › Search & Filter Pro › Display author name in template
- This topic has 3 replies, 2 voices, and was last updated 7 years, 8 months ago by Trevor.
-
Trevor(Private) February 20, 2017 at 11:07 pm #91545
This would depend on the Display Results method you are using. Some depend on the theme template to do this, and the shortcode results method relies on the results.php template we supply with the plugin. See here for the customisation guide.
Once you have a copy of that template, you would need to follow the coding advice in the WordPress Codex in how to display the author. as there are many ways you can do this, a specific answer is hard. With link to the author’s posts, or their profile? With their name , or nickname, or their avatar?
Anonymous(Private) February 21, 2017 at 8:29 am #91601Hello Trevor,
What i meant : You give some snippets to display some informations like thais :global $searchandfilter; $sf_current_query = $searchandfilter->get(802)->current_query(); echo $sf_current_query->get_field_string("_sft_category").'<br />'; echo $sf_current_query->get_field_string("_sft_thematique").'<br />'; echo 'Terme(s): '.$sf_current_query->get_search_term().'<br />'; echo 'Elément(s) trouvés(s): ' .$wp_query->found_posts;
I’d like to have a snippet to display the author chosen in my select list. If i try that code, it doesn’t work :
echo $sf_current_query->get_field_string("authors");
Is it possible to realize this ? It’s not in your documentation.
Thank you for your help.
Best regards.
Trevor(Private) February 21, 2017 at 6:49 pm #91736The display of the author is not part of Search and Filter as such. That is why I pointed you to the WordPress Codex. You can see some examples of the Codex in use in the results.php template that you will find in the wp-content/plugins/search-filter-pro/templates folder. You can see there how the permalink, the title, the categories, the tags, etc. are output.
-
AuthorPosts